diff options
author | Tristan Gingold | 2013-12-29 04:10:36 +0100 |
---|---|---|
committer | Tristan Gingold | 2013-12-29 04:10:36 +0100 |
commit | 8d37e1b6f69f60ccdf1dd8197f1e7225d80c2e05 (patch) | |
tree | ffdfd8ec4def9b27c087c5ef1d6104355e773591 /translate/ghdldrv/ghdlprint.adb | |
parent | e053480a1adc2d170ab2b4434413e0e56e0e27a1 (diff) | |
download | ghdl-8d37e1b6f69f60ccdf1dd8197f1e7225d80c2e05.tar.gz ghdl-8d37e1b6f69f60ccdf1dd8197f1e7225d80c2e05.tar.bz2 ghdl-8d37e1b6f69f60ccdf1dd8197f1e7225d80c2e05.zip |
Fix bug16144 (ghdl --lines on empty line).
Diffstat (limited to 'translate/ghdldrv/ghdlprint.adb')
-rw-r--r-- | translate/ghdldrv/ghdlprint.adb | 8 |
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; |