summaryrefslogtreecommitdiffstats
path: root/gcc/ada/scn.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/scn.adb')
-rw-r--r--gcc/ada/scn.adb33
1 files changed, 20 insertions, 13 deletions
diff --git a/gcc/ada/scn.adb b/gcc/ada/scn.adb
index ff0792c2cf0..b1e57079bbf 100644
--- a/gcc/ada/scn.adb
+++ b/gcc/ada/scn.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2003 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2004 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -170,6 +170,7 @@ package body Scn is
begin
while Source (Scan_Ptr) /= CR
and then Source (Scan_Ptr) /= LF
+ and then Source (Scan_Ptr) /= EOF
loop
Scan_Ptr := Scan_Ptr + 1;
end loop;
@@ -210,21 +211,27 @@ package body Scn is
Check_End_Of_Line;
- declare
- Physical : Boolean;
+ if Source (Scan_Ptr) /= EOF then
- begin
- Skip_Line_Terminators (Scan_Ptr, Physical);
+ -- We have to take into account a degenerate case when the source
+ -- file contains only comments and no Ada code.
- -- If we are at start of physical line, update scan pointers
- -- to reflect the start of the new line.
+ declare
+ Physical : Boolean;
- if Physical then
- Current_Line_Start := Scan_Ptr;
- Start_Column := Scanner.Set_Start_Column;
- First_Non_Blank_Location := Scan_Ptr;
- end if;
- end;
+ begin
+ Skip_Line_Terminators (Scan_Ptr, Physical);
+
+ -- If we are at start of physical line, update scan pointers
+ -- to reflect the start of the new line.
+
+ if Physical then
+ Current_Line_Start := Scan_Ptr;
+ Start_Column := Scanner.Set_Start_Column;
+ First_Non_Blank_Location := Scan_Ptr;
+ end if;
+ end;
+ end if;
end loop;
end Determine_License;
OpenPOWER on IntegriCloud