aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRobert Dewar <dewar@adacore.com>2009-04-22 10:36:37 +0000
committerArnaud Charlet <charlet@gcc.gnu.org>2009-04-22 12:36:37 +0200
commit6d2a112099a7d69ea9a4f0d0468882289583bb48 (patch)
tree184b37529ffc00a287c44c3089b5f31ff094b55b /gcc
parent3b81743f8901ad7bf8055d461c3cb6d1e7e13e8a (diff)
downloadgcc-6d2a112099a7d69ea9a4f0d0468882289583bb48.zip
gcc-6d2a112099a7d69ea9a4f0d0468882289583bb48.tar.gz
gcc-6d2a112099a7d69ea9a4f0d0468882289583bb48.tar.bz2
mlib.adb: Minor reformatting
2009-04-22 Robert Dewar <dewar@adacore.com> * mlib.adb: Minor reformatting * sem_aggr.adb: Minor reformatting. Defend against junk aggregate from syntax error. From-SVN: r146562
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog7
-rw-r--r--gcc/ada/mlib.adb1
-rw-r--r--gcc/ada/sem_aggr.adb23
3 files changed, 27 insertions, 4 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index a70a712..9c8c15d 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,10 @@
+2009-04-22 Robert Dewar <dewar@adacore.com>
+
+ * mlib.adb: Minor reformatting
+
+ * sem_aggr.adb: Minor reformatting. Defend against junk aggregate from
+ syntax error.
+
2009-04-22 Nicolas Setton <setton@adacore.com>
* link.c: Add flag __gnat_separate_run_path_options.
diff --git a/gcc/ada/mlib.adb b/gcc/ada/mlib.adb
index 22d24ab..6c1a491 100644
--- a/gcc/ada/mlib.adb
+++ b/gcc/ada/mlib.adb
@@ -450,7 +450,6 @@ package body MLib is
Separate_Paths : Boolean;
for Separate_Paths'Size use Character'Size;
pragma Import (C, Separate_Paths, "__gnat_separate_run_path_options");
-
begin
return Separate_Paths;
end Separate_Run_Path_Options;
diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb
index 2e7ba8e..22557b7 100644
--- a/gcc/ada/sem_aggr.adb
+++ b/gcc/ada/sem_aggr.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2009, 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- --
@@ -896,6 +896,15 @@ package body Sem_Aggr is
-- which is the subtype of the context in which the aggregate was found.
begin
+ -- Ignore junk empty aggregate resulting from parser error
+
+ if No (Expressions (N))
+ and then No (Component_Associations (N))
+ and then not Null_Record_Present (N)
+ then
+ return;
+ end if;
+
-- Check for aggregates not allowed in configurable run-time mode.
-- We allow all cases of aggregates that do not come from source,
-- since these are all assumed to be small (e.g. bounds of a string
@@ -1504,6 +1513,15 @@ package body Sem_Aggr is
-- Start of processing for Resolve_Array_Aggregate
begin
+ -- Ignore junk empty aggregate resulting from parser error
+
+ if No (Expressions (N))
+ and then No (Component_Associations (N))
+ and then not Null_Record_Present (N)
+ then
+ return False;
+ end if;
+
-- STEP 1: make sure the aggregate is correctly formatted
if Present (Component_Associations (N)) then
@@ -2171,13 +2189,12 @@ package body Sem_Aggr is
then
A_Type := Etype (Imm_Type);
return True;
-
else
Imm_Type := Etype (Base_Type (Imm_Type));
end if;
end loop;
- -- If previous loop did not find a proper ancestor, report error.
+ -- If previous loop did not find a proper ancestor, report error
Error_Msg_NE ("expect ancestor type of &", A, Typ);
return False;