OSDN Git Service

PR 33870
[pf3gnuchains/gcc-fork.git] / gcc / ada / sem_prag.adb
index 9ad244c..65ee287 100644 (file)
@@ -6,18 +6,17 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2006, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2007, 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- --
--- ware  Foundation;  either version 2,  or (at your option) any later ver- --
+-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
 -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
 -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
 -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
 -- for  more details.  You should have  received  a copy of the GNU General --
--- Public License  distributed with GNAT;  see file COPYING.  If not, write --
--- to  the  Free Software Foundation,  51  Franklin  Street,  Fifth  Floor, --
--- Boston, MA 02110-1301, USA.                                              --
+-- Public License  distributed with GNAT; see file COPYING3.  If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license.          --
 --                                                                          --
 -- GNAT was originally developed  by the GNAT team at  New York University. --
 -- Extensive contributions were provided by Ada Core Technologies Inc.      --
 
 with Atree;    use Atree;
 with Casing;   use Casing;
+with Checks;   use Checks;
 with Csets;    use Csets;
 with Debug;    use Debug;
 with Einfo;    use Einfo;
 with Errout;   use Errout;
 with Exp_Dist; use Exp_Dist;
-with Hostparm; use Hostparm;
 with Lib;      use Lib;
 with Lib.Writ; use Lib.Writ;
 with Lib.Xref; use Lib.Xref;
@@ -174,6 +173,12 @@ package body Sem_Prag is
    --  (the original one, following the renaming chain) is returned.
    --  Otherwise the entity is returned unchanged. Should be in Einfo???
 
+   procedure rv;
+   --  This is a dummy function called by the processing for pragma Reviewable.
+   --  It is there for assisting front end debugging. By placing a Reviewable
+   --  pragma in the source program, a breakpoint on rv catches this place in
+   --  the source, allowing convenient stepping to the point of interest.
+
    procedure Set_Unit_Name (N : Node_Id; With_Item : Node_Id);
    --  Place semantic information on the argument of an Elaborate or
    --  Elaborate_All pragma. Entity name for unit and its parents is
@@ -253,6 +258,11 @@ package body Sem_Prag is
       type Args_List is array (Natural range <>) of Node_Id;
       --  Types used for arguments to Check_Arg_Order and Gather_Associations
 
+      procedure Ada_2005_Pragma;
+      --  Called for pragmas defined in Ada 2005, that are not in Ada 95. In
+      --  Ada 95 mode, these are implementation defined pragmas, so should be
+      --  caught by the No_Implementation_Pragmas restriction
+
       procedure Check_Ada_83_Warning;
       --  Issues a warning message for the current pragma if operating in Ada
       --  83 mode (used for language pragmas that are not a standard part of
@@ -482,8 +492,8 @@ package body Sem_Prag is
       --  returned, otherwise Arg is returned unchanged.
 
       procedure GNAT_Pragma;
-      --  Called for all GNAT defined pragmas to note the use of the feature,
-      --  and also check the relevant restriction (No_Implementation_Pragmas).
+      --  Called for all GNAT defined pragmas to check the relevant restriction
+      --  (No_Implementation_Pragmas).
 
       function Is_Before_First_Decl
         (Pragma_Node : Node_Id;
@@ -633,6 +643,17 @@ package body Sem_Prag is
       --  node, which is used for error messages on any constructs
       --  that violate the profile.
 
+      ---------------------
+      -- Ada_2005_Pragma --
+      ---------------------
+
+      procedure Ada_2005_Pragma is
+      begin
+         if Ada_Version <= Ada_95 then
+            Check_Restriction (No_Implementation_Pragmas, N);
+         end if;
+      end Ada_2005_Pragma;
+
       --------------------------
       -- Check_Ada_83_Warning --
       --------------------------
@@ -1417,8 +1438,8 @@ package body Sem_Prag is
                      Pragma_Misplaced;
 
                   elsif (Nkind (Parent_Node) = N_Generic_Package_Declaration
-                          or else Nkind (Parent_Node)
-                            = N_Generic_Subprogram_Declaration)
+                           or else Nkind (Parent_Node) =
+                                             N_Generic_Subprogram_Declaration)
                     and then Plist = Generic_Formal_Declarations (Parent_Node)
                   then
                      Pragma_Misplaced;
@@ -2085,9 +2106,9 @@ package body Sem_Prag is
          begin
             --  Ada 2005 (AI-430): Check invalid attempt to change convention
             --  for an overridden dispatching operation. Technically this is
-            --  an amendment and should only be done in Ada 2005 mode.
-            --  However, this is clearly a mistake, since the problem that is
-            --  addressed by this AI is that there is a clear gap in the RM!
+            --  an amendment and should only be done in Ada 2005 mode. However,
+            --  this is clearly a mistake, since the problem that is addressed
+            --  by this AI is that there is a clear gap in the RM!
 
             if Is_Dispatching_Operation (E)
               and then Present (Overridden_Operation (E))
@@ -2117,10 +2138,10 @@ package body Sem_Prag is
                Set_Convention (Class_Wide_Type (E), C);
             end if;
 
-            --  If the entity is a record type, then check for special case
-            --  of C_Pass_By_Copy, which is treated the same as C except that
-            --  the special record flag is set. This convention is also only
-            --  permitted on record types (see AI95-00131).
+            --  If the entity is a record type, then check for special case of
+            --  C_Pass_By_Copy, which is treated the same as C except that the
+            --  special record flag is set. This convention is only permitted
+            --  on record types (see AI95-00131).
 
             if Cname = Name_C_Pass_By_Copy then
                if Is_Record_Type (E) then
@@ -2172,11 +2193,11 @@ package body Sem_Prag is
          elsif Is_Convention_Name (Cname) then
             C := Get_Convention_Id (Chars (Expression (Arg1)));
 
-         --  In DEC VMS, it seems that there is an undocumented feature
-         --  that any unrecognized convention is treated as the default,
-         --  which for us is convention C. It does not seem so terrible
-         --  to do this unconditionally, silently in the VMS case, and
-         --  with a warning in the non-VMS case.
+         --  In DEC VMS, it seems that there is an undocumented feature that
+         --  any unrecognized convention is treated as the default, which for
+         --  us is convention C. It does not seem so terrible to do this
+         --  unconditionally, silently in the VMS case, and with a warning
+         --  in the non-VMS case.
 
          else
             if Warn_On_Export_Import and not OpenVMS_On_Target then
@@ -2198,17 +2219,21 @@ package body Sem_Prag is
             Error_Pragma_Arg ("entity name required", Arg2);
          end if;
 
+         if Ekind (Entity (Id)) = E_Enumeration_Literal then
+            Error_Pragma ("enumeration literal not allowed for pragma%");
+         end if;
+
          E := Entity (Id);
 
-         --  Go to renamed subprogram if present, since convention applies
-         --  to the actual renamed entity, not to the renaming entity.
-         --  If subprogram is inherited, go to parent subprogram.
+         --  Go to renamed subprogram if present, since convention applies to
+         --  the actual renamed entity, not to the renaming entity. If the
+         --  subprogram is inherited, go to parent subprogram.
 
          if Is_Subprogram (E)
            and then Present (Alias (E))
          then
-            if Nkind (Parent (Declaration_Node (E)))
-              = N_Subprogram_Renaming_Declaration
+            if Nkind (Parent (Declaration_Node (E))) =
+                                       N_Subprogram_Renaming_Declaration
             then
                E := Alias (E);
 
@@ -2556,9 +2581,8 @@ package body Sem_Prag is
             then
                Error_Msg_Sloc := Sloc (Def_Id);
                Error_Pragma_Arg
-                 ("no initialization allowed for declaration of& #",
-                  "\imported entities cannot be initialized ('R'M' 'B.1(24))",
-                  Arg1);
+                 ("imported entities cannot be initialized (RM B.1(24))",
+                  "\no initialization allowed for & declared#", Arg1);
             else
                Set_Imported (Def_Id);
                Note_Possible_Modification (Arg_Internal);
@@ -2822,9 +2846,9 @@ package body Sem_Prag is
 
          --  Here we have the Export case which can set the entity as exported
 
-         --  But does not do so if the specified external name is null,
-         --  since that is taken as a signal in DEC Ada 83 (with which
-         --  we want to be compatible) to request no external name.
+         --  But does not do so if the specified external name is null, since
+         --  that is taken as a signal in DEC Ada 83 (with which we want to be
+         --  compatible) to request no external name.
 
          elsif Nkind (Arg_External) = N_String_Literal
            and then String_Length (Strval (Arg_External)) = 0
@@ -2917,7 +2941,6 @@ package body Sem_Prag is
 
                   if Present (Expressions (Arg_Mechanism)) then
                      Mname := First (Expressions (Arg_Mechanism));
-
                      while Present (Mname) loop
                         if No (Formal) then
                            Error_Pragma_Arg
@@ -2934,7 +2957,6 @@ package body Sem_Prag is
 
                   if Present (Component_Associations (Arg_Mechanism)) then
                      Massoc := First (Component_Associations (Arg_Mechanism));
-
                      while Present (Massoc) loop
                         Choice := First (Choices (Massoc));
 
@@ -3078,19 +3100,25 @@ package body Sem_Prag is
               or else
             Ekind (Def_Id) = E_Constant
          then
+            --  We do not permit Import to apply to a renaming declaration
+
+            if Present (Renamed_Object (Def_Id)) then
+               Error_Pragma_Arg
+                 ("pragma% not allowed for object renaming", Arg2);
+
             --  User initialization is not allowed for imported object, but
             --  the object declaration may contain a default initialization,
             --  that will be discarded. Note that an explicit initialization
             --  only counts if it comes from source, otherwise it is simply
             --  the code generator making an implicit initialization explicit.
 
-            if Present (Expression (Parent (Def_Id)))
-               and then Comes_From_Source (Expression (Parent (Def_Id)))
+            elsif Present (Expression (Parent (Def_Id)))
+              and then Comes_From_Source (Expression (Parent (Def_Id)))
             then
                Error_Msg_Sloc := Sloc (Def_Id);
                Error_Pragma_Arg
                  ("no initialization allowed for declaration of& #",
-                  "\imported entities cannot be initialized ('R'M' 'B.1(24))",
+                  "\imported entities cannot be initialized (RM B.1(24))",
                   Arg2);
 
             else
@@ -3212,9 +3240,9 @@ package body Sem_Prag is
                                              N_Subprogram_Renaming_Declaration
                      then
                         Error_Msg_Sloc := Sloc (Def_Id);
-                        Error_Msg_NE ("cannot import&#," &
-                           " already completed by a renaming",
-                           N, Def_Id);
+                        Error_Msg_NE
+                          ("cannot import&, renaming already provided for " &
+                           "declaration #", N, Def_Id);
                      end if;
                   end;
 
@@ -3235,12 +3263,14 @@ package body Sem_Prag is
                end if;
             end loop;
 
-         --  When the convention is Java, we also allow Import to be given
-         --  for packages, exceptions, and record components.
+         --  When the convention is Java or CIL, we also allow Import to be
+         --  given for packages, generic packages, exceptions, and record
+         --  components.
 
-         elsif C = Convention_Java
+         elsif (C = Convention_Java or else C = Convention_CIL)
            and then
              (Ekind (Def_Id) = E_Package
+                or else Ekind (Def_Id) = E_Generic_Package
                 or else Ekind (Def_Id) = E_Exception
                 or else Nkind (Parent (Def_Id)) = N_Component_Declaration)
          then
@@ -3256,7 +3286,24 @@ package body Sem_Prag is
             if not Is_Tagged_Type (Def_Id) then
                Error_Msg_Sloc := Sloc (Def_Id);
                Error_Pragma_Arg ("imported 'C'P'P type must be tagged", Arg2);
+
             else
+               --  Types treated as CPP classes are treated as limited, but we
+               --  don't require them to be declared this way. A warning is
+               --  issued to encourage the user to declare them as limited.
+               --  This is not an error, for compatibility reasons, because
+               --  these types have been supported this way for some time.
+
+               if not Is_Limited_Type (Def_Id) then
+                  Error_Msg_N
+                    ("imported 'C'P'P type should be " &
+                       "explicitly declared limited?",
+                     Get_Pragma_Arg (Arg2));
+                  Error_Msg_N
+                    ("\type will be considered limited",
+                     Get_Pragma_Arg (Arg2));
+               end if;
+
                Set_Is_CPP_Class (Def_Id);
                Set_Is_Limited_Record (Def_Id);
             end if;
@@ -3338,8 +3385,8 @@ package body Sem_Prag is
                --  trivially possible.
 
                elsif
-                 Nkind (Unit_Declaration_Node (Corresponding_Body (Decl)))
-                   = N_Subprogram_Renaming_Declaration
+                 Nkind (Unit_Declaration_Node (Corresponding_Body (Decl))) =
+                                             N_Subprogram_Renaming_Declaration
                then
                   return False;
 
@@ -3569,9 +3616,11 @@ package body Sem_Prag is
                C := Get_String_Char (S, J);
 
                if Warn_On_Export_Import
-                 and then (not In_Character_Range (C)
-                             or else Get_Character (C) = ' '
-                             or else Get_Character (C) = ',')
+                 and then
+                   (not In_Character_Range (C)
+                     or else (Get_Character (C) = ' '
+                               and then VM_Target /= CLI_Target)
+                     or else Get_Character (C) = ',')
                then
                   Error_Msg_N
                     ("?interface name contains illegal character", SN);
@@ -3584,6 +3633,18 @@ package body Sem_Prag is
       begin
          if No (Link_Arg) then
             if No (Ext_Arg) then
+               if VM_Target = CLI_Target
+                 and then Ekind (Subprogram_Def) = E_Package
+                 and then Nkind (Parent (Subprogram_Def)) =
+                                                 N_Package_Specification
+                 and then Present (Generic_Parent (Parent (Subprogram_Def)))
+               then
+                  Set_Interface_Name
+                     (Subprogram_Def,
+                      Interface_Name
+                        (Generic_Parent (Parent (Subprogram_Def))));
+               end if;
+
                return;
 
             elsif Chars (Ext_Arg) = Name_Link_Name then
@@ -3634,7 +3695,6 @@ package body Sem_Prag is
                     and then Ekind (Scope (E)) = E_Package
                   then
                      Par := Parent (E);
-
                      while Present (Par) loop
                         if Nkind (Par) = N_Package_Body then
                            Error_Msg_Sloc  := Sloc (E);
@@ -3669,15 +3729,16 @@ package body Sem_Prag is
 
          else
             Start_String;
-            Store_String_Char (Get_Char_Code ('*'));
-            String_Val := Strval (Expr_Value_S (Link_Nam));
 
-            for J in 1 .. String_Length (String_Val) loop
-               Store_String_Char (Get_String_Char (String_Val, J));
-            end loop;
+            if VM_Target = No_VM then
+               Store_String_Char (Get_Char_Code ('*'));
+            end if;
 
+            String_Val := Strval (Expr_Value_S (Link_Nam));
+            Store_String_Chars (String_Val);
             Link_Nam :=
-              Make_String_Literal (Sloc (Link_Nam), End_String);
+              Make_String_Literal (Sloc (Link_Nam),
+                Strval => End_String);
          end if;
 
          Set_Encoded_Interface_Name
@@ -3906,18 +3967,20 @@ package body Sem_Prag is
          --------------------------------
 
          procedure Suppress_Unsuppress_Echeck (E : Entity_Id; C : Check_Id) is
-            ESR : constant Entity_Check_Suppress_Record :=
-                    (Entity   => E,
-                     Check    => C,
-                     Suppress => Suppress_Case);
-
          begin
             Set_Checks_May_Be_Suppressed (E);
 
             if In_Package_Spec then
-               Global_Entity_Suppress.Append (ESR);
+               Push_Global_Suppress_Stack_Entry
+                 (Entity   => E,
+                  Check    => C,
+                  Suppress => Suppress_Case);
+
             else
-               Local_Entity_Suppress.Append (ESR);
+               Push_Local_Suppress_Stack_Entry
+                 (Entity   => E,
+                  Check    => C,
+                  Suppress => Suppress_Case);
             end if;
 
             --  If this is a first subtype, and the base type is distinct,
@@ -3945,11 +4008,17 @@ package body Sem_Prag is
          Check_No_Identifier (Arg1);
          Check_Arg_Is_Identifier (Arg1);
 
-         if not Is_Check_Name (Chars (Expression (Arg1))) then
+         C := Get_Check_Id (Chars (Expression (Arg1)));
+
+         if C = No_Check_Id then
             Error_Pragma_Arg
               ("argument of pragma% is not valid check name", Arg1);
-         else
-            C := Get_Check_Id (Chars (Expression (Arg1)));
+         end if;
+
+         if not Suppress_Case
+           and then (C = All_Checks or else C = Overflow_Check)
+         then
+            Opt.Overflow_Checks_Unsuppressed := True;
          end if;
 
          if Arg_Count = 1 then
@@ -3960,10 +4029,10 @@ package body Sem_Prag is
 
             if C = All_Checks then
 
-               --  For All_Checks, we set all specific checks with the
-               --  exception of Elaboration_Check, which is handled specially
-               --  because of not wanting All_Checks to have the effect of
-               --  deactivating static elaboration order processing.
+               --  For All_Checks, we set all specific predefined checks with
+               --  the exception of Elaboration_Check, which is handled
+               --  specially because of not wanting All_Checks to have the
+               --  effect of deactivating static elaboration order processing.
 
                for J in Scope_Suppress'Range loop
                   if J /= Elaboration_Check then
@@ -3971,24 +4040,23 @@ package body Sem_Prag is
                   end if;
                end loop;
 
-            --  If not All_Checks, just set appropriate entry. Note that we
-            --  will set Elaboration_Check if this is explicitly specified.
+            --  If not All_Checks, and predefined check, then set appropriate
+            --  scope entry. Note that we will set Elaboration_Check if this
+            --  is explicitly specified.
 
-            else
+            elsif C in Predefined_Check_Id then
                Scope_Suppress (C) := Suppress_Case;
             end if;
 
-            --  Also make an entry in the Local_Entity_Suppress table. See
-            --  extended description in the package spec of Sem for details.
+            --  Also make an entry in the Local_Entity_Suppress table
 
-            Local_Entity_Suppress.Append
-              ((Entity   => Empty,
-                Check    => C,
-                Suppress => Suppress_Case));
+            Push_Local_Suppress_Stack_Entry
+              (Entity   => Empty,
+               Check    => C,
+               Suppress => Suppress_Case);
 
-         --  Case of two arguments present, where the check is
-         --  suppressed for a specified entity (given as the second
-         --  argument of the pragma)
+         --  Case of two arguments present, where the check is suppressed for
+         --  a specified entity (given as the second argument of the pragma)
 
          else
             Check_Optional_Identifier (Arg2, Name_On);
@@ -4017,7 +4085,7 @@ package body Sem_Prag is
               and then Scope (E) /= Current_Scope
             then
                Error_Pragma_Arg
-                 ("entity in pragma% is not in package spec ('R'M 11.5(7))",
+                 ("entity in pragma% is not in package spec (RM 11.5(7))",
                   Arg2);
             end if;
 
@@ -4203,18 +4271,23 @@ package body Sem_Prag is
 
       procedure Set_Imported (E : Entity_Id) is
       begin
-         Error_Msg_Sloc  := Sloc (E);
+         --  Error message if already imported or exported
 
          if Is_Exported (E) or else Is_Imported (E) then
-            Error_Msg_NE ("import of& declared# not allowed", N, E);
-
             if Is_Exported (E) then
-               Error_Msg_N ("\entity was previously exported", N);
+               Error_Msg_NE ("entity& was previously exported", N, E);
             else
-               Error_Msg_N ("\entity was previously imported", N);
+               Error_Msg_NE ("entity& was previously imported", N, E);
             end if;
 
-            Error_Pragma ("\(pragma% applies to all previous entities)");
+            Error_Msg_Name_1 := Chars (N);
+            Error_Msg_N
+              ("\(pragma% applies to all previous entities)", N);
+
+            Error_Msg_Sloc  := Sloc (E);
+            Error_Msg_NE ("\import not allowed for& declared#", N, E);
+
+         --  Here if not previously imported or exported, OK to import
 
          else
             Set_Is_Imported (E);
@@ -4441,16 +4514,32 @@ package body Sem_Prag is
    --  Start of processing for Analyze_Pragma
 
    begin
+      --  Deal with unrecognized pragma
+
       if not Is_Pragma_Name (Chars (N)) then
          if Warn_On_Unrecognized_Pragma then
-            Error_Pragma ("unrecognized pragma%?");
-         else
-            return;
+            Error_Msg_Name_1 := Chars (N);
+            Error_Msg_N ("?unrecognized pragma%!", N);
+
+            for PN in First_Pragma_Name .. Last_Pragma_Name loop
+               if Is_Bad_Spelling_Of
+                 (Get_Name_String (Chars (N)),
+                  Get_Name_String (PN))
+               then
+                  Error_Msg_Name_1 := PN;
+                  Error_Msg_N ("\?possible misspelling of %!", N);
+                  exit;
+               end if;
+            end loop;
          end if;
-      else
-         Prag_Id := Get_Pragma_Id (Chars (N));
+
+         return;
       end if;
 
+      --  Here to start processing for recognized pragma
+
+      Prag_Id := Get_Pragma_Id (Chars (N));
+
       --  Preset arguments
 
       Arg1 := Empty;
@@ -4524,9 +4613,25 @@ package body Sem_Prag is
 
          when Pragma_Ada_83 =>
             GNAT_Pragma;
+            Check_Arg_Count (0);
+
+            --  We really should check unconditionally for proper configuration
+            --  pragma placement, since we really don't want mixed Ada modes
+            --  within a single unit, and the GNAT reference manual has always
+            --  said this was a configuration pragma, but we did not check and
+            --  are hesitant to add the check now.
+
+            --  However, we really cannot tolerate mixing Ada 2005 with Ada 83
+            --  or Ada 95, so we must check if we are in Ada 2005 mode.
+
+            if Ada_Version >= Ada_05 then
+               Check_Valid_Configuration_Pragma;
+            end if;
+
+            --  Now set Ada 83 mode
+
             Ada_Version := Ada_83;
             Ada_Version_Explicit := Ada_Version;
-            Check_Arg_Count (0);
 
          ------------
          -- Ada_95 --
@@ -4539,9 +4644,25 @@ package body Sem_Prag is
 
          when Pragma_Ada_95 =>
             GNAT_Pragma;
+            Check_Arg_Count (0);
+
+            --  We really should check unconditionally for proper configuration
+            --  pragma placement, since we really don't want mixed Ada modes
+            --  within a single unit, and the GNAT reference manual has always
+            --  said this was a configuration pragma, but we did not check and
+            --  are hesitant to add the check now.
+
+            --  However, we really cannot tolerate mixing Ada 2005 with Ada 83
+            --  or Ada 95, so we must check if we are in Ada 2005 mode.
+
+            if Ada_Version >= Ada_05 then
+               Check_Valid_Configuration_Pragma;
+            end if;
+
+            --  Now set Ada 95 mode
+
             Ada_Version := Ada_95;
             Ada_Version_Explicit := Ada_Version;
-            Check_Arg_Count (0);
 
          ---------------------
          -- Ada_05/Ada_2005 --
@@ -4574,6 +4695,17 @@ package body Sem_Prag is
 
             else
                Check_Arg_Count (0);
+
+               --  For Ada_2005 we unconditionally enforce the documented
+               --  configuration pragma placement, since we do not want to
+               --  tolerate mixed modes in a unit involving Ada 2005. That
+               --  would cause real difficulties for those cases where there
+               --  are incompatibilities between Ada 95 and Ada 2005.
+
+               Check_Valid_Configuration_Pragma;
+
+               --  Now set Ada 2005 mode
+
                Ada_Version := Ada_05;
                Ada_Version_Explicit := Ada_05;
             end if;
@@ -4628,10 +4760,11 @@ package body Sem_Prag is
             Check_Arg_Is_Identifier (Arg1);
 
             declare
-               Arg : Node_Id := Arg2;
+               Arg : Node_Id;
                Exp : Node_Id;
 
             begin
+               Arg := Arg2;
                while Present (Arg) loop
                   Exp := Expression (Arg);
                   Analyze (Exp);
@@ -4665,6 +4798,7 @@ package body Sem_Prag is
             Expr : Node_Id;
 
          begin
+            Ada_2005_Pragma;
             Check_At_Least_N_Arguments (1);
             Check_At_Most_N_Arguments (2);
             Check_Arg_Order ((Name_Check, Name_Message));
@@ -4737,6 +4871,7 @@ package body Sem_Prag is
          --  pragma Assertion_Policy (Check | Ignore)
 
          when Pragma_Assertion_Policy =>
+            Ada_2005_Pragma;
             Check_Arg_Count (1);
             Check_Arg_Is_One_Of (Arg1, Name_Check, Name_Ignore);
             Assertions_Enabled := Chars (Expression (Arg1)) = Name_Check;
@@ -5098,6 +5233,40 @@ package body Sem_Prag is
             end if;
          end C_Pass_By_Copy;
 
+         ----------------
+         -- Check_Name --
+         ----------------
+
+         --  pragma Check_Name (check_IDENTIFIER);
+
+         when Pragma_Check_Name =>
+            Check_No_Identifiers;
+            GNAT_Pragma;
+            Check_Valid_Configuration_Pragma;
+            Check_Arg_Count (1);
+            Check_Arg_Is_Identifier (Arg1);
+
+            declare
+               Nam : constant Name_Id := Chars (Expression (Arg1));
+
+            begin
+               for J in Check_Names.First .. Check_Names.Last loop
+                  if Check_Names.Table (J) = Nam then
+                     return;
+                  end if;
+               end loop;
+
+               Check_Names.Append (Nam);
+            end;
+
+         ---------------------
+         -- CIL_Constructor --
+         ---------------------
+
+         --  pragma CIL_Constructor ([Entity =>] LOCAL_NAME);
+
+         --  Processing for this pragma is shared with Java_Constructor
+
          -------------
          -- Comment --
          -------------
@@ -5141,6 +5310,15 @@ package body Sem_Prag is
          when Pragma_Compile_Time_Warning =>
             Process_Compile_Time_Warning_Or_Error;
 
+         -------------------
+         -- Compiler_Unit --
+         -------------------
+
+         when Pragma_Compiler_Unit =>
+            GNAT_Pragma;
+            Check_Arg_Count (0);
+            Set_Is_Compiler_Unit (Get_Source_Unit (N));
+
          -----------------------------
          -- Complete_Representation --
          -----------------------------
@@ -5199,6 +5377,13 @@ package body Sem_Prag is
 
             else
                Set_Has_Complex_Representation (Base_Type (E));
+
+               --  We need to treat the type has having a non-standard
+               --  representation, for back-end purposes, even though in
+               --  general a complex will have the default representation
+               --  of a record with two real components.
+
+               Set_Has_Non_Standard_Rep (Base_Type (E));
             end if;
          end Complex_Representation;
 
@@ -5334,6 +5519,8 @@ package body Sem_Prag is
          when Pragma_Convention => Convention : declare
             C : Convention_Id;
             E : Entity_Id;
+            pragma Warnings (Off, C);
+            pragma Warnings (Off, E);
          begin
             Check_Arg_Order ((Name_Convention, Name_Entity));
             Check_Ada_83_Warning;
@@ -5359,7 +5546,7 @@ package body Sem_Prag is
             Check_Optional_Identifier (Arg1, Name_Name);
             Check_Optional_Identifier (Arg2, Name_Convention);
             Check_Arg_Is_Identifier (Arg1);
-            Check_Arg_Is_Identifier (Arg1);
+            Check_Arg_Is_Identifier (Arg2);
             Idnam := Chars (Expression (Arg1));
             Cname := Chars (Expression (Arg2));
 
@@ -5413,6 +5600,22 @@ package body Sem_Prag is
                Error_Pragma_Arg ("pragma% applicable to tagged types ", Arg1);
             end if;
 
+            --  Types treated as CPP classes are treated as limited, but we
+            --  don't require them to be declared this way. A warning is issued
+            --  to encourage the user to declare them as limited. This is not
+            --  an error, for compatibility reasons, because these types have
+            --  been supported this way for some time.
+
+            if not Is_Limited_Type (Typ) then
+               Error_Msg_N
+                 ("imported 'C'P'P type should be " &
+                    "explicitly declared limited?",
+                  Get_Pragma_Arg (Arg1));
+               Error_Msg_N
+                 ("\type will be considered limited",
+                  Get_Pragma_Arg (Arg1));
+            end if;
+
             Set_Is_CPP_Class      (Typ);
             Set_Is_Limited_Record (Typ);
             Set_Convention        (Typ, Convention_CPP);
@@ -5558,7 +5761,7 @@ package body Sem_Prag is
          --  pragma Detect_Blocking;
 
          when Pragma_Detect_Blocking =>
-            GNAT_Pragma;
+            Ada_2005_Pragma;
             Check_Arg_Count (0);
             Check_Valid_Configuration_Pragma;
             Detect_Blocking := True;
@@ -5591,7 +5794,8 @@ package body Sem_Prag is
 
                   --  If there is no parameter, then from now on this pragma
                   --  applies to any enumeration, exception or tagged type
-                  --  defined in the current declarative part.
+                  --  defined in the current declarative part, and recursively
+                  --  to any nested scope.
 
                   Set_Discard_Names (Current_Scope);
                   return;
@@ -5757,7 +5961,6 @@ package body Sem_Prag is
             Arg := Arg1;
             Outr : while Present (Arg) loop
                Citem := First (List_Containing (N));
-
                Innr : while Citem /= N loop
                   if Nkind (Citem) = N_With_Clause
                     and then Same_Name (Name (Citem), Expression (Arg))
@@ -5936,15 +6139,6 @@ package body Sem_Prag is
                Source_Location);
          end Eliminate;
 
-         -------------------------
-         -- Explicit_Overriding --
-         -------------------------
-
-         when Pragma_Explicit_Overriding =>
-            Check_Valid_Configuration_Pragma;
-            Check_Arg_Count (0);
-            Explicit_Overriding := True;
-
          ------------
          -- Export --
          ------------
@@ -5959,6 +6153,8 @@ package body Sem_Prag is
             C      : Convention_Id;
             Def_Id : Entity_Id;
 
+            pragma Warnings (Off, C);
+
          begin
             Check_Ada_83_Warning;
             Check_Arg_Order
@@ -6304,7 +6500,7 @@ package body Sem_Prag is
                      null;
                   else
                      Error_Msg_Sloc := Sloc (System_Extend_Pragma_Arg);
-                     Error_Pragma ("pragma% conflicts with that at#");
+                     Error_Pragma ("pragma% conflicts with that #");
                   end if;
 
                else
@@ -6348,8 +6544,11 @@ package body Sem_Prag is
          --    [, [Link_Name     =>] static_string_EXPRESSION ]);
 
          when Pragma_External => External : declare
-            C      : Convention_Id;
-            Def_Id : Entity_Id;
+               Def_Id : Entity_Id;
+
+               C : Convention_Id;
+               pragma Warnings (Off, C);
+
          begin
             GNAT_Pragma;
             Check_Arg_Order
@@ -6663,6 +6862,17 @@ package body Sem_Prag is
             end;
          end Ident;
 
+         -----------------------
+         -- Implicit_Packing --
+         -----------------------
+
+         --  pragma Implicit_Packing;
+
+         when Pragma_Implicit_Packing =>
+            GNAT_Pragma;
+            Check_Arg_Count (0);
+            Implicit_Packing := True;
+
          ------------
          -- Import --
          ------------
@@ -7337,7 +7547,7 @@ package body Sem_Prag is
                   Error_Msg_Sloc :=
                     Interrupt_States.Table (IST_Num).Pragma_Loc;
                   Error_Pragma_Arg
-                    ("state conflicts with that given at #", Arg2);
+                    ("state conflicts with that given #", Arg2);
                   exit;
                end if;
 
@@ -7351,10 +7561,14 @@ package body Sem_Prag is
 
          --  pragma Java_Constructor ([Entity =>] LOCAL_NAME);
 
-         when Pragma_Java_Constructor => Java_Constructor : declare
-            Id     : Entity_Id;
-            Def_Id : Entity_Id;
-            Hom_Id : Entity_Id;
+         --  Also handles pragma CIL_Constructor
+
+         when Pragma_CIL_Constructor | Pragma_Java_Constructor =>
+         Java_Constructor : declare
+            Id         : Entity_Id;
+            Def_Id     : Entity_Id;
+            Hom_Id     : Entity_Id;
+            Convention : Convention_Id;
 
          begin
             GNAT_Pragma;
@@ -7371,6 +7585,12 @@ package body Sem_Prag is
                return;
             end if;
 
+            case Prag_Id is
+               when Pragma_CIL_Constructor  => Convention := Convention_CIL;
+               when Pragma_Java_Constructor => Convention := Convention_Java;
+               when others                  => null;
+            end case;
+
             Hom_Id := Entity (Id);
 
             --  Loop through homonyms
@@ -7378,26 +7598,37 @@ package body Sem_Prag is
             loop
                Def_Id := Get_Base_Subprogram (Hom_Id);
 
-               --  The constructor is required to be a function returning
-               --  an access type whose designated type has convention Java.
+               --  The constructor is required to be a function returning an
+               --  access type whose designated type has convention Java/CIL.
 
                if Ekind (Def_Id) = E_Function
-                 and then Ekind (Etype (Def_Id)) in Access_Kind
                  and then
-                   (Atree.Convention
-                      (Designated_Type (Etype (Def_Id))) = Convention_Java
-                   or else
-                     Atree.Convention
-                      (Root_Type (Designated_Type (Etype (Def_Id))))
-                        = Convention_Java)
+                   (Is_Value_Type (Etype (Def_Id))
+                     or else
+                       (Ekind (Etype (Def_Id)) in Access_Kind
+                         and then
+                          (Atree.Convention
+                             (Designated_Type (Etype (Def_Id))) = Convention
+                            or else
+                              Atree.Convention
+                               (Root_Type (Designated_Type (Etype (Def_Id)))) =
+                                                                 Convention)))
                then
                   Set_Is_Constructor (Def_Id);
-                  Set_Convention     (Def_Id, Convention_Java);
+                  Set_Convention     (Def_Id, Convention);
+                  Set_Is_Imported    (Def_Id);
 
                else
-                  Error_Pragma_Arg
-                    ("pragma% requires function returning a 'Java access type",
-                      Arg1);
+                  if Convention = Convention_Java then
+                     Error_Pragma_Arg
+                       ("pragma% requires function returning a " &
+                        "'Java access type", Arg1);
+                  else
+                     pragma Assert (Convention = Convention_CIL);
+                     Error_Pragma_Arg
+                       ("pragma% requires function returning a " &
+                        "'CIL access type", Arg1);
+                  end if;
                end if;
 
                Hom_Id := Homonym (Hom_Id);
@@ -7557,7 +7788,7 @@ package body Sem_Prag is
                   --  differences in processing between Link_With
                   --  and Linker_Options).
 
-                  declare
+                  Arg_Store : declare
                      C : constant Char_Code := Get_Char_Code (' ');
                      S : constant String_Id :=
                            Strval (Expr_Value_S (Expression (Arg)));
@@ -7567,6 +7798,10 @@ package body Sem_Prag is
                      procedure Skip_Spaces;
                      --  Advance F past any spaces
 
+                     -----------------
+                     -- Skip_Spaces --
+                     -----------------
+
                      procedure Skip_Spaces is
                      begin
                         while F <= L and then Get_String_Char (S, F) = C loop
@@ -7574,6 +7809,8 @@ package body Sem_Prag is
                         end loop;
                      end Skip_Spaces;
 
+                  --  Start of processing for Arg_Store
+
                   begin
                      Skip_Spaces; -- skip leading spaces
 
@@ -7592,7 +7829,7 @@ package body Sem_Prag is
                            F := F + 1;
                         end if;
                      end loop;
-                  end;
+                  end Arg_Store;
 
                   Arg := Next (Arg);
 
@@ -7883,12 +8120,13 @@ package body Sem_Prag is
          -- Main --
          ----------
 
-         --  pragma Main_Storage
-         --   (MAIN_STORAGE_OPTION [, MAIN_STORAGE_OPTION]);
+         --  pragma Main
+         --   (MAIN_OPTION [, MAIN_OPTION]);
 
-         --  MAIN_STORAGE_OPTION ::=
-         --    [WORKING_STORAGE =>] static_SIMPLE_EXPRESSION
-         --  | [TOP_GUARD =>] static_SIMPLE_EXPRESSION
+         --  MAIN_OPTION ::=
+         --    [STACK_SIZE              =>] static_integer_EXPRESSION
+         --  | [TASK_STACK_SIZE_DEFAULT =>] static_integer_EXPRESSION
+         --  | [TIME_SLICING_ENABLED    =>] static_boolean_EXPRESSION
 
          when Pragma_Main => Main : declare
             Args  : Args_List (1 .. 3);
@@ -7985,6 +8223,22 @@ package body Sem_Prag is
             Check_Arg_Count (1);
             Check_Arg_Is_Integer_Literal (Arg1);
 
+         -------------
+         -- No_Body --
+         -------------
+
+         --  pragma No_Body;
+
+         --  The only correct use of this pragma is on its own in a file, in
+         --  which case it is specially processed (see Gnat1drv.Check_Bad_Body
+         --  and Frontend, which use Sinput.L.Source_File_Is_Pragma_No_Body to
+         --  check for a file containing nothing but a No_Body pragma). If we
+         --  attempt to process it during normal semantics processing, it means
+         --  it was misplaced.
+
+         when Pragma_No_Body =>
+            Error_Pragma ("misplaced pragma %");
+
          ---------------
          -- No_Return --
          ---------------
@@ -8337,18 +8591,6 @@ package body Sem_Prag is
             Check_Arg_Count (1);
             Check_Arg_Is_One_Of (Arg1, Name_Time, Name_Space, Name_Off);
 
-         -------------------------
-         -- Optional_Overriding --
-         -------------------------
-
-         --  These pragmas are treated as part of the previous subprogram
-         --  declaration, and analyzed immediately after it (see sem_ch6,
-         --  Check_Overriding_Operation). If the pragma has not been analyzed
-         --  yet, it appears in the wrong place.
-
-         when Pragma_Optional_Overriding =>
-            Error_Msg_N ("pragma must appear immediately after subprogram", N);
-
          ----------
          -- Pack --
          ----------
@@ -8400,7 +8642,7 @@ package body Sem_Prag is
                  or else Is_Atomic (Component_Type (Typ))
                then
                   Error_Pragma
-                       ("?pragma% ignored, cannot pack atomic components");
+                    ("?pragma% ignored, cannot pack atomic components");
                end if;
 
                --  If we had an explicit component size given, then we do not
@@ -8423,7 +8665,13 @@ package body Sem_Prag is
 
                else
                   if not Rep_Item_Too_Late (Typ, N) then
-                     Set_Is_Packed            (Base_Type (Typ));
+                     if VM_Target = No_VM then
+                        Set_Is_Packed (Base_Type (Typ));
+                     elsif not GNAT_Mode then
+                        Error_Pragma
+                          ("?pragma% ignored in this configuration");
+                     end if;
+
                      Set_Has_Pragma_Pack      (Base_Type (Typ));
                      Set_Has_Non_Standard_Rep (Base_Type (Typ));
                   end if;
@@ -8433,8 +8681,13 @@ package body Sem_Prag is
 
             else pragma Assert (Is_Record_Type (Typ));
                if not Rep_Item_Too_Late (Typ, N) then
+                  if VM_Target = No_VM then
+                     Set_Is_Packed (Base_Type (Typ));
+                  elsif not GNAT_Mode then
+                     Error_Pragma ("?pragma% ignored in this configuration");
+                  end if;
+
                   Set_Has_Pragma_Pack      (Base_Type (Typ));
-                  Set_Is_Packed            (Base_Type (Typ));
                   Set_Has_Non_Standard_Rep (Base_Type (Typ));
                end if;
             end if;
@@ -8483,6 +8736,7 @@ package body Sem_Prag is
             Ent : Entity_Id;
 
          begin
+            Ada_2005_Pragma;
             Check_Arg_Count (1);
             Check_No_Identifiers;
             Check_Arg_Is_Identifier (Arg1);
@@ -8496,6 +8750,14 @@ package body Sem_Prag is
             end if;
 
             Set_Known_To_Have_Preelab_Init (Ent);
+
+            if Has_Pragma_Preelab_Init (Ent)
+              and then Warn_On_Redundant_Constructs
+            then
+               Error_Pragma ("?duplicate pragma%!");
+            else
+               Set_Has_Pragma_Preelab_Init (Ent);
+            end if;
          end Preelab_Init;
 
          -------------
@@ -8770,6 +9032,7 @@ package body Sem_Prag is
             Upper_Val   : Uint;
 
          begin
+            Ada_2005_Pragma;
             Check_Arg_Count (3);
             Check_No_Identifiers;
             Check_Arg_Is_Task_Dispatching_Policy (Arg1);
@@ -8836,8 +9099,9 @@ package body Sem_Prag is
                   then
                      Error_Msg_Sloc :=
                        Specific_Dispatching.Table (J).Pragma_Loc;
-                     Error_Pragma ("priority range overlaps with" &
-                                   " Priority_Specific_Dispatching#");
+                        Error_Pragma
+                          ("priority range overlaps with "
+                           & "Priority_Specific_Dispatching#");
                   end if;
                end loop;
 
@@ -8846,8 +9110,9 @@ package body Sem_Prag is
 
                if Task_Dispatching_Policy /= ' ' then
                   Error_Msg_Sloc := Task_Dispatching_Policy_Sloc;
-                  Error_Pragma ("Priority_Specific_Dispatching incompatible" &
-                                " with Task_Dispatching_Policy#");
+                     Error_Pragma
+                       ("Priority_Specific_Dispatching incompatible "
+                        & "with Task_Dispatching_Policy#");
                end if;
 
                --  The use of Priority_Specific_Dispatching forces ceiling
@@ -8855,8 +9120,9 @@ package body Sem_Prag is
 
                if Locking_Policy /= ' ' and then Locking_Policy /= 'C' then
                   Error_Msg_Sloc := Locking_Policy_Sloc;
-                  Error_Pragma ("Priority_Specific_Dispatching incompatible" &
-                                " with Locking_Policy#");
+                     Error_Pragma
+                       ("Priority_Specific_Dispatching incompatible "
+                        & "with Locking_Policy#");
 
                --  Set the Ceiling_Locking policy, but preserve System_Location
                --  since we like the error message with the run time name.
@@ -8888,6 +9154,7 @@ package body Sem_Prag is
          --  profile_IDENTIFIER => Protected | Ravenscar
 
          when Pragma_Profile =>
+            Ada_2005_Pragma;
             Check_Arg_Count (1);
             Check_Valid_Configuration_Pragma;
             Check_No_Identifiers;
@@ -9388,6 +9655,7 @@ package body Sem_Prag is
          when Pragma_Reviewable =>
             Check_Ada_83_Warning;
             Check_Arg_Count (0);
+            rv;
 
          -------------------
          -- Share_Generic --
@@ -9537,6 +9805,24 @@ package body Sem_Prag is
          when Pragma_Source_Reference =>
             GNAT_Pragma;
 
+         --------------------------------
+         -- Static_Elaboration_Desired --
+         --------------------------------
+
+         --  pragma Static_Elaboration_Desired (DIRECT_NAME);
+
+         when Pragma_Static_Elaboration_Desired =>
+            GNAT_Pragma;
+            Check_At_Most_N_Arguments (1);
+
+            if Is_Compilation_Unit (Current_Scope)
+              and then Ekind (Current_Scope) = E_Package
+            then
+               Set_Static_Elaboration_Desired (Current_Scope, True);
+            else
+               Error_Pragma ("pragma% must apply to a library-level package");
+            end if;
+
          ------------------
          -- Storage_Size --
          ------------------
@@ -10078,80 +10364,6 @@ package body Sem_Prag is
             end if;
          end Task_Storage;
 
-         -----------------
-         -- Thread_Body --
-         -----------------
-
-         --  pragma Thread_Body
-         --    (  [Entity =>]               LOCAL_NAME
-         --     [,[Secondary_Stack_Size =>] static_integer_EXPRESSION]);
-
-         when Pragma_Thread_Body => Thread_Body : declare
-            Id : Node_Id;
-            SS : Node_Id;
-            E  : Entity_Id;
-
-         begin
-            GNAT_Pragma;
-            Check_Arg_Order ((Name_Entity, Name_Secondary_Stack_Size));
-            Check_At_Least_N_Arguments (1);
-            Check_At_Most_N_Arguments (2);
-            Check_Optional_Identifier (Arg1, Name_Entity);
-            Check_Arg_Is_Local_Name (Arg1);
-
-            Id := Expression (Arg1);
-
-            if not Is_Entity_Name (Id)
-              or else not Is_Subprogram (Entity (Id))
-            then
-               Error_Pragma_Arg ("subprogram name required", Arg1);
-            end if;
-
-            E := Entity (Id);
-
-            --  Go to renamed subprogram if present, since Thread_Body applies
-            --  to the actual renamed entity, not to the renaming entity.
-
-            if Present (Alias (E))
-              and then Nkind (Parent (Declaration_Node (E))) =
-                         N_Subprogram_Renaming_Declaration
-            then
-               E := Alias (E);
-            end if;
-
-            --  Various error checks
-
-            if Nkind (Parent (Declaration_Node (E))) = N_Subprogram_Body then
-               Error_Pragma
-                 ("pragma% requires separate spec and must come before body");
-
-            elsif Rep_Item_Too_Early (E, N)
-              or else Rep_Item_Too_Late (E, N)
-            then
-               raise Pragma_Exit;
-
-            elsif Is_Thread_Body (E) then
-               Error_Pragma_Arg
-                 ("only one thread body pragma allowed", Arg1);
-
-            elsif Present (Homonym (E))
-              and then Scope (Homonym (E)) = Current_Scope
-            then
-               Error_Pragma_Arg
-                 ("thread body subprogram must not be overloaded", Arg1);
-            end if;
-
-            Set_Is_Thread_Body (E);
-
-            --  Deal with secondary stack argument
-
-            if Arg_Count = 2 then
-               Check_Optional_Identifier (Arg2, Name_Secondary_Stack_Size);
-               SS := Expression (Arg2);
-               Analyze_And_Resolve (SS, Any_Integer);
-            end if;
-         end Thread_Body;
-
          ----------------
          -- Time_Slice --
          ----------------
@@ -10295,7 +10507,6 @@ package body Sem_Prag is
                end if;
 
                Discr := First_Discriminant (Typ);
-
                while Present (Discr) loop
                   if No (Discriminant_Default_Value (Discr)) then
                      Error_Msg_N
@@ -10310,10 +10521,8 @@ package body Sem_Prag is
 
                Comp := First (Component_Items (Clist));
                while Present (Comp) loop
-
                   Check_Component (Comp);
                   Next (Comp);
-
                end loop;
 
                if No (Clist) or else No (Variant_Part (Clist)) then
@@ -10373,6 +10582,31 @@ package body Sem_Prag is
             end if;
          end Unimplemented_Unit;
 
+         ------------------------
+         -- Universal_Aliasing --
+         ------------------------
+
+         --  pragma Universal_Aliasing [([Entity =>] type_LOCAL_NAME)];
+
+         when Pragma_Universal_Aliasing => Universal_Alias : declare
+            E_Id : Entity_Id;
+
+         begin
+            GNAT_Pragma;
+            Check_Arg_Count (1);
+            Check_Optional_Identifier (Arg2, Name_Entity);
+            Check_Arg_Is_Local_Name (Arg1);
+            E_Id := Entity (Expression (Arg1));
+
+            if E_Id = Any_Type then
+               return;
+            elsif No (E_Id) or else not Is_Type (E_Id) then
+               Error_Pragma_Arg ("pragma% requires type", Arg1);
+            end if;
+
+            Set_Universal_Aliasing (Implementation_Base_Type (E_Id));
+         end Universal_Alias;
+
          --------------------
          -- Universal_Data --
          --------------------
@@ -10422,9 +10656,10 @@ package body Sem_Prag is
 
             if Is_In_Context_Clause then
 
-               --  The arguments must all be units mentioned in a with
-               --  clause in the same context clause. Note we already checked
-               --  (in Par.Prag) that the arguments are either identifiers or
+               --  The arguments must all be units mentioned in a with clause
+               --  in the same context clause. Note we already checked (in
+               --  Par.Prag) that the arguments are either identifiers or
+               --  selected components.
 
                Arg_Node := Arg1;
                while Present (Arg_Node) loop
@@ -10789,36 +11024,29 @@ package body Sem_Prag is
                         String_To_Name_Buffer
                           (Strval (Expr_Value_S (Expression (Arg2))));
 
-                        --  Configuration pragma case
-
-                        if Is_Configuration_Pragma then
-                           if Chars (Argx) = Name_On then
-                              Error_Pragma
-                                ("pragma Warnings (On, string) cannot be " &
-                                 "used as configuration pragma");
-
-                           else
-                              Set_Specific_Warning_Off
-                                (No_Location, Name_Buffer (1 .. Name_Len));
-                           end if;
-
-                        --  Normal (non-configuration pragma) case
-
-                        else
-                           if Chars (Argx) = Name_Off then
-                              Set_Specific_Warning_Off
-                                (Loc, Name_Buffer (1 .. Name_Len));
-
-                           elsif Chars (Argx) = Name_On then
-                              Set_Specific_Warning_On
-                                (Loc, Name_Buffer (1 .. Name_Len), Err);
-
-                              if Err then
-                                 Error_Msg
-                                   ("?pragma Warnings On with no " &
-                                    "matching Warnings Off",
-                                    Loc);
-                              end if;
+                        --  Note on configuration pragma case: If this is a
+                        --  configuration pragma, then for an OFF pragma, we
+                        --  just set Config True in the call, which is all
+                        --  that needs to be done. For the case of ON, this
+                        --  is normally an error, unless it is canceling the
+                        --  effect of a previous OFF pragma in the same file.
+                        --  In any other case, an error will be signalled (ON
+                        --  with no matching OFF).
+
+                        if Chars (Argx) = Name_Off then
+                           Set_Specific_Warning_Off
+                             (Loc, Name_Buffer (1 .. Name_Len),
+                              Config => Is_Configuration_Pragma);
+
+                        elsif Chars (Argx) = Name_On then
+                           Set_Specific_Warning_On
+                             (Loc, Name_Buffer (1 .. Name_Len), Err);
+
+                           if Err then
+                              Error_Msg
+                                ("?pragma Warnings On with no " &
+                                 "matching Warnings Off",
+                                 Loc);
                            end if;
                         end if;
                      end if;
@@ -11012,6 +11240,8 @@ package body Sem_Prag is
       Pragma_Atomic                        =>  0,
       Pragma_Atomic_Components             =>  0,
       Pragma_Attach_Handler                => -1,
+      Pragma_Check_Name                    =>  0,
+      Pragma_CIL_Constructor               => -1,
       Pragma_CPP_Class                     =>  0,
       Pragma_CPP_Constructor               =>  0,
       Pragma_CPP_Virtual                   =>  0,
@@ -11021,6 +11251,7 @@ package body Sem_Prag is
       Pragma_Common_Object                 => -1,
       Pragma_Compile_Time_Error            => -1,
       Pragma_Compile_Time_Warning          => -1,
+      Pragma_Compiler_Unit                 =>  0,
       Pragma_Complete_Representation       =>  0,
       Pragma_Complex_Representation        =>  0,
       Pragma_Component_Alignment           => -1,
@@ -11036,7 +11267,6 @@ package body Sem_Prag is
       Pragma_Elaborate_Body                => -1,
       Pragma_Elaboration_Checks            => -1,
       Pragma_Eliminate                     => -1,
-      Pragma_Explicit_Overriding           => -1,
       Pragma_Export                        => -1,
       Pragma_Export_Exception              => -1,
       Pragma_Export_Function               => -1,
@@ -11051,6 +11281,7 @@ package body Sem_Prag is
       Pragma_Finalize_Storage_Only         =>  0,
       Pragma_Float_Representation          =>  0,
       Pragma_Ident                         => -1,
+      Pragma_Implicit_Packing              =>  0,
       Pragma_Import                        => +2,
       Pragma_Import_Exception              =>  0,
       Pragma_Import_Function               =>  0,
@@ -11085,12 +11316,12 @@ package body Sem_Prag is
       Pragma_Main_Storage                  => -1,
       Pragma_Memory_Size                   => -1,
       Pragma_No_Return                     =>  0,
+      Pragma_No_Body                       =>  0,
       Pragma_No_Run_Time                   => -1,
       Pragma_No_Strict_Aliasing            => -1,
       Pragma_Normalize_Scalars             => -1,
       Pragma_Obsolescent                   =>  0,
       Pragma_Optimize                      => -1,
-      Pragma_Optional_Overriding           => -1,
       Pragma_Pack                          =>  0,
       Pragma_Page                          => -1,
       Pragma_Passive                       => -1,
@@ -11124,6 +11355,7 @@ package body Sem_Prag is
       Pragma_Source_Reference              => -1,
       Pragma_Storage_Size                  => -1,
       Pragma_Storage_Unit                  => -1,
+      Pragma_Static_Elaboration_Desired    => -1,
       Pragma_Stream_Convert                => -1,
       Pragma_Style_Checks                  => -1,
       Pragma_Subtitle                      => -1,
@@ -11137,11 +11369,11 @@ package body Sem_Prag is
       Pragma_Task_Info                     => -1,
       Pragma_Task_Name                     => -1,
       Pragma_Task_Storage                  =>  0,
-      Pragma_Thread_Body                   => +2,
       Pragma_Time_Slice                    => -1,
       Pragma_Title                         => -1,
       Pragma_Unchecked_Union               =>  0,
       Pragma_Unimplemented_Unit            => -1,
+      Pragma_Universal_Aliasing            => -1,
       Pragma_Universal_Data                => -1,
       Pragma_Unreferenced                  => -1,
       Pragma_Unreferenced_Objects          => -1,
@@ -11297,6 +11529,15 @@ package body Sem_Prag is
       end;
    end Process_Compilation_Unit_Pragmas;
 
+   --------
+   -- rv --
+   --------
+
+   procedure rv is
+   begin
+      null;
+   end rv;
+
    --------------------------------
    -- Set_Encoded_Interface_Name --
    --------------------------------
@@ -11337,11 +11578,12 @@ package body Sem_Prag is
       --  If first character is asterisk, this is a link name, and we
       --  leave it completely unmodified. We also ignore null strings
       --  (the latter case happens only in error cases) and no encoding
-      --  should occur for Java interface names.
+      --  should occur for Java or AAMP interface names.
 
       if Len = 0
         or else Get_String_Char (Str, 1) = Get_Char_Code ('*')
-        or else Java_VM
+        or else VM_Target /= No_VM
+        or else AAMP_On_Target
       then
          Set_Interface_Name (E, S);