2011-08-03 Ed Schonberg <schonberg@adacore.com>
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 3 Aug 2011 09:26:00 +0000 (09:26 +0000)
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 3 Aug 2011 09:26:00 +0000 (09:26 +0000)
* sem_ch6.adb: guard against error nodes in return statements.

2011-08-03  Arnaud Charlet  <charlet@adacore.com>

* errout.adb (Error_Msg_Internal): the main unit has not been read yet,
a warning can only appear on a configuration file, so emit warning
without further checks.

2011-08-03  Arnaud Charlet  <charlet@adacore.com>

* s-interr.ads: add overriding keyword.

2011-08-03  Geert Bosch  <bosch@adacore.com>

* exp_attr.adb: Fix minor typo.

2011-08-03  Ed Schonberg  <schonberg@adacore.com>

* par-ch4.adb: improve error recovery.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@177245 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ada/ChangeLog
gcc/ada/errout.adb
gcc/ada/exp_attr.adb
gcc/ada/par-ch4.adb
gcc/ada/s-interr.ads
gcc/ada/sem_ch6.adb

index 1c1cf9b..9fb4ce8 100644 (file)
@@ -1,3 +1,25 @@
+2011-08-03  Ed Schonberg  <schonberg@adacore.com>
+
+       * sem_ch6.adb: guard against error nodes in return statements.
+
+2011-08-03  Arnaud Charlet  <charlet@adacore.com>
+
+       * errout.adb (Error_Msg_Internal): the main unit has not been read yet,
+       a warning can only appear on a configuration file, so emit warning
+       without further checks.
+
+2011-08-03  Arnaud Charlet  <charlet@adacore.com>
+
+       * s-interr.ads: add overriding keyword.
+
+2011-08-03  Geert Bosch  <bosch@adacore.com>
+
+       * exp_attr.adb: Fix minor typo.
+
+2011-08-03  Ed Schonberg  <schonberg@adacore.com>
+
+       * par-ch4.adb: improve error recovery.
+
 2011-08-03  Emmanuel Briot  <briot@adacore.com>
 
        * prj-part.adb, prj-part.ads, prj-makr.adb, prj-pars.adb, prj-conf.adb,
index e794057..49068ef 100644 (file)
@@ -751,6 +751,12 @@ package body Errout is
          if In_Extended_Main_Source_Unit (Sptr) then
             null;
 
+         --  If the main unit has not been read yet. the warning must be on
+         --  a configuration file: gnat.adc or user-defined.
+
+         elsif No (Cunit (Main_Unit)) then
+            null;
+
          --  If the flag location is not in the main extended source unit, then
          --  we want to eliminate the warning, unless it is in the extended
          --  main code unit and we want warnings on the instance.
index a2c2bcc..686bf04 100644 (file)
@@ -4998,7 +4998,7 @@ package body Exp_Attr is
       -- Value --
       -----------
 
-      --  Value attribute is handled in separate unti Exp_Imgv
+      --  Value attribute is handled in separate unit Exp_Imgv
 
       when Attribute_Value =>
          Exp_Imgv.Expand_Value_Attribute (N);
index 4c25c3c..8d45b2c 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2010, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2011, 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- --
@@ -606,8 +606,18 @@ package body Ch4 is
             raise Error_Resync;
 
          elsif Token /= Tok_Right_Paren then
-            T_Right_Paren;
-            raise Error_Resync;
+            if Token = Tok_Arrow then
+
+               --  This may be an aggregate that is missing a qualification
+
+               Error_Msg_SC
+                 ("context of aggregate must be a qualified expression");
+               raise Error_Resync;
+
+            else
+               T_Right_Paren;
+               raise Error_Resync;
+            end if;
 
          else
             Scan; -- past right paren
index 3b66f06..1d936f5 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                  S p e c                                 --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2011, Free Software Foundation, Inc.         --
 --                                                                          --
 -- GNARL 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- --
@@ -256,6 +256,7 @@ package System.Interrupts is
      (Object : access Static_Interrupt_Protection) return Boolean;
    --  Returns True
 
+   overriding
    procedure Finalize (Object : in out Static_Interrupt_Protection);
    --  Restore previous handlers as required by C.3.1(12) then call
    --  Finalize (Protection).
index d487921..11c807b 100644 (file)
@@ -628,8 +628,19 @@ package body Sem_Ch6 is
 
       if Nkind (N) = N_Simple_Return_Statement then
          Expr := Expression (N);
-         Analyze_And_Resolve (Expr, R_Type);
-         Check_Limited_Return (Expr);
+
+         --  Guard against a malformed expression. The parser may have
+         --  tried to recover but the node is not analyzable.
+
+         if Nkind (Expr) = N_Error then
+            Set_Etype (Expr, Any_Type);
+            Expander_Mode_Save_And_Set (False);
+            return;
+
+         else
+            Analyze_And_Resolve (Expr, R_Type);
+            Check_Limited_Return (Expr);
+         end if;
 
          --  RETURN only allowed in SPARK is as the last statement function