summaryrefslogtreecommitdiff
path: root/translate/ghdldrv/ghdlprint.adb
diff options
context:
space:
mode:
Diffstat (limited to 'translate/ghdldrv/ghdlprint.adb')
-rw-r--r--translate/ghdldrv/ghdlprint.adb8
1 files changed, 7 insertions, 1 deletions
diff --git a/translate/ghdldrv/ghdlprint.adb b/translate/ghdldrv/ghdlprint.adb
index dedc1eb..dfe44ff 100644
--- a/translate/ghdldrv/ghdlprint.adb
+++ b/translate/ghdldrv/ghdlprint.adb
@@ -868,6 +868,7 @@ package body Ghdlprint is
begin
Local_Id := Get_Identifier ("");
for I in Args'Range loop
+ -- Load the file.
Id := Get_Identifier (Args (I).all);
Fe := Files_Map.Load_Source_File (Local_Id, Id);
if Fe = No_Source_File_Entry then
@@ -875,6 +876,8 @@ package body Ghdlprint is
raise Compile_Error;
end if;
Set_File (Fe);
+
+ -- Scan the content, to compute the number of lines.
loop
Scan.Scan;
exit when Current_Token = Tok_Eof;
@@ -925,7 +928,10 @@ package body Ghdlprint is
end loop;
-- Disp line.
- Put (String (Buf (Ptr .. Eptr - 1)));
+ if Eptr > Ptr then
+ -- Avoid constraint error on conversion of nul array.
+ Put (String (Buf (Ptr .. Eptr - 1)));
+ end if;
New_Line;
end loop;
end loop;