diff options
author | Bob Duff <duff@adacore.com> | 2021-03-22 16:22:49 -0400 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2021-06-18 04:36:53 -0400 |
commit | ca5cdc9053ffe033e8ece1c4be7882c67b3f5a39 (patch) | |
tree | 41694e5fcab4967e641e900a84da58e73065df61 /gcc | |
parent | f86c2f9c8e5d7d02cc6b79fc80a647a9a27e23f2 (diff) | |
download | gcc-ca5cdc9053ffe033e8ece1c4be7882c67b3f5a39.zip gcc-ca5cdc9053ffe033e8ece1c4be7882c67b3f5a39.tar.gz gcc-ca5cdc9053ffe033e8ece1c4be7882c67b3f5a39.tar.bz2 |
[Ada] Make "gcc -gnatDGL" handle unterminated last lines properly
gcc/ada/
* sprint.adb (Write_Source_Line): Check for EOF in
Line_Terminator loop. Note that when a source file is read in,
an EOF character is added to the end.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/sprint.adb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/ada/sprint.adb b/gcc/ada/sprint.adb index 5f2d027..7fc7340 100644 --- a/gcc/ada/sprint.adb +++ b/gcc/ada/sprint.adb @@ -4847,7 +4847,10 @@ package body Sprint is Write_Int (Int (L)); Write_Str (": "); - while Src (Loc) not in Line_Terminator loop + -- We need to check for EOF here, in case the last line of the source + -- file does not have a Line_Terminator. + + while Src (Loc) not in Line_Terminator | EOF loop Write_Char (Src (Loc)); Loc := Loc + 1; end loop; |