aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorQuentin Ochem <ochem@adacore.com>2007-04-06 11:17:01 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2007-04-06 11:17:01 +0200
commit35a41b73c7dace49b7abd8b8a6fdc6d58a5e612a (patch)
tree4bcff816ebdb41bea765ca1719759ac07fd664c7 /gcc
parent320ae22ae0b8d417adf8da52e195eb9aaa026688 (diff)
downloadgcc-35a41b73c7dace49b7abd8b8a6fdc6d58a5e612a.zip
gcc-35a41b73c7dace49b7abd8b8a6fdc6d58a5e612a.tar.gz
gcc-35a41b73c7dace49b7abd8b8a6fdc6d58a5e612a.tar.bz2
ali.ads, ali.adb (Get_Nat): Raise an exception if the file cursor is not on a natural.
2007-04-06 Quentin Ochem <ochem@adacore.com> * ali.ads, ali.adb (Get_Nat): Raise an exception if the file cursor is not on a natural. (Scan_ALI): Cancel the xref line if there has been a reading ALI error. From-SVN: r123548
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ali.adb29
-rw-r--r--gcc/ada/ali.ads2
2 files changed, 28 insertions, 3 deletions
diff --git a/gcc/ada/ali.adb b/gcc/ada/ali.adb
index 81008c8..b987636 100644
--- a/gcc/ada/ali.adb
+++ b/gcc/ada/ali.adb
@@ -195,6 +195,7 @@ package body ALI is
function Get_Nat return Nat;
-- Skip blanks, then scan out an unsigned integer value in Nat range
+ -- raises ALI_Reading_Error if the encoutered type is not natural.
function Get_Stamp return Time_Stamp_Type;
-- Skip blanks, then scan out a time stamp
@@ -347,7 +348,6 @@ package body ALI is
-- Find start of line
Ptr1 := P;
-
while Ptr1 > T'First
and then T (Ptr1 - 1) /= CR
and then T (Ptr1 - 1) /= LF
@@ -478,9 +478,17 @@ package body ALI is
begin
Skip_Space;
+ -- Check if we are on a number. In the case of bas ALI files, this
+ -- may not be true.
+
+ if not (Nextc in '0' .. '9') then
+ Fatal_Error;
+ end if;
+
V := 0;
loop
V := V * 10 + (Character'Pos (Getc) - Character'Pos ('0'));
+
exit when At_End_Of_Field;
exit when Nextc < '0' or Nextc > '9';
end loop;
@@ -2186,6 +2194,24 @@ package body ALI is
XE.Last_Xref := Xref.Last;
C := Nextc;
+
+ exception
+ when Bad_ALI_Format =>
+
+ -- If ignoring errors, then we skip a line with an
+ -- unexpected error, and try to continue subsequent
+ -- xref lines.
+
+ if Ignore_Errors then
+ Xref_Entity.Decrement_Last;
+ Skip_Line;
+ C := Nextc;
+
+ -- Otherwise, we reraise the fatal exception
+
+ else
+ raise;
+ end if;
end Read_Refs_For_One_Entity;
end loop;
@@ -2209,7 +2235,6 @@ package body ALI is
exception
when Bad_ALI_Format =>
return No_ALI_Id;
-
end Scan_ALI;
---------
diff --git a/gcc/ada/ali.ads b/gcc/ada/ali.ads
index 7d702b7..5a4dcaa 100644
--- a/gcc/ada/ali.ads
+++ b/gcc/ada/ali.ads
@@ -839,7 +839,7 @@ package ALI is
-- reference for the entity name.
Oref_File_Num : Sdep_Id;
- -- This field is set to No_Sdep_Id is the entity doesn't override any
+ -- This field is set to No_Sdep_Id if the entity doesn't override any
-- other entity, or to the dependency reference for the overriden
-- entity.