OSDN Git Service

2011-10-13 Sergey Rybin <rybin@adacore.com>
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 13 Oct 2011 10:32:13 +0000 (10:32 +0000)
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 13 Oct 2011 10:32:13 +0000 (10:32 +0000)
* gnat_ugn.texi, vms_data.ads: Add an option to control enumeration
literal casing.

2011-10-13  Nicolas Roche  <roche@adacore.com>

* gnatlink.adb: Ensure that -mrtp is passed when
runtime name ends with 'rtp'.

2011-10-13  Ed Schonberg  <schonberg@adacore.com>

* sem_prag.adb (Analyze_Pragma, case Unchecked_Union): an
unchecked union type can be limited.

2011-10-13  Olivier Hainque  <hainque@adacore.com>

* init.c (__gnat_error_handler) <VxWorks version>: Add comments on
the use of the signal trampoline for PPC in the sjlj case as well.
Add legitimate casts, preventing compile time warnings on the
(sighandler *) profile.

2011-10-13  Yannick Moy  <moy@adacore.com>

* sem_aggr.adb (Resolve_Aggr_Expr): Always perform semantic
analysis in Alfa mode.

2011-10-13  Ed Schonberg  <schonberg@adacore.com>

* sem_ch3.adb (OK_For_Limited_Init_In_05): Conditional and case
expressions are legal limited return values if each one of their
dependent expressions are legal.

2011-10-13  Ed Schonberg  <schonberg@adacore.com>

* sem_ch6.adb (Analyze_Procedure_Call_Statement): In Ada 2012 mode,
if the prefix of the call is a qualified expression, rewrite as
a code statement.
* sem_ch13.adb (Analyze_Code_Statement): In Ada 2012 mode, the
code statement is legal if it is a rewriting of a procedure call.

2011-10-13  Ed Schonberg  <schonberg@adacore.com>

* exp_aggr.adb (Flatten): If a component association has a box,
assume that aggregate is not static.
(Safe_Aggregate): If a component association in a non-limited
aggregate has a box, assume that it cannot be expanded in place.

2011-10-13  Vincent Celier  <celier@adacore.com>

* prj-conf.adb (Get_Or_Create_Configuration_File): Call
Process_Project_Tree_Phase_1 with Packages_To_Check.
(Process_Project_And_Apply_Config): Ditto
* prj-part.ads, prj-part.adb, prj-pars.ads, prj-pars.adb (Parse):
Remove default for argument Packages_To_Check.
* prj-proc.adb (Recursive_Process): New argument
Packages_To_Check.
(Process): Ditto.
(Process_Project_Tree_Phase_1): Ditto.
(Recursive_Project.Process_Aggregated_Projects): Call
Prj.Part.Parse and Process_Project_Tree_Phase_1 with
Packages_To_Check.
* prj-proc.ads (Process): New argument Packages_To_Check
(Process_Project_Tree_Phase_1): Ditto

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

gcc/ada/ChangeLog
gcc/ada/exp_aggr.adb
gcc/ada/gnat_ugn.texi
gcc/ada/gnatlink.adb
gcc/ada/init.c
gcc/ada/sem_aggr.adb
gcc/ada/sem_ch13.adb
gcc/ada/sem_ch3.adb
gcc/ada/sem_ch6.adb
gcc/ada/sem_prag.adb
gcc/ada/vms_data.ads

index 80c2c7a..003158f 100644 (file)
@@ -1,3 +1,68 @@
+2011-10-13  Sergey Rybin  <rybin@adacore.com>
+
+       * gnat_ugn.texi, vms_data.ads: Add an option to control enumeration
+       literal casing.
+
+2011-10-13  Nicolas Roche  <roche@adacore.com>
+
+       * gnatlink.adb: Ensure that -mrtp is passed when
+       runtime name ends with 'rtp'.
+
+2011-10-13  Ed Schonberg  <schonberg@adacore.com>
+
+       * sem_prag.adb (Analyze_Pragma, case Unchecked_Union): an
+       unchecked union type can be limited.
+
+2011-10-13  Olivier Hainque  <hainque@adacore.com>
+
+       * init.c (__gnat_error_handler) <VxWorks version>: Add comments on
+       the use of the signal trampoline for PPC in the sjlj case as well.
+       Add legitimate casts, preventing compile time warnings on the
+       (sighandler *) profile.
+
+2011-10-13  Yannick Moy  <moy@adacore.com>
+
+       * sem_aggr.adb (Resolve_Aggr_Expr): Always perform semantic
+       analysis in Alfa mode.
+
+2011-10-13  Ed Schonberg  <schonberg@adacore.com>
+
+       * sem_ch3.adb (OK_For_Limited_Init_In_05): Conditional and case
+       expressions are legal limited return values if each one of their
+       dependent expressions are legal.
+
+2011-10-13  Ed Schonberg  <schonberg@adacore.com>
+
+       * sem_ch6.adb (Analyze_Procedure_Call_Statement): In Ada 2012 mode,
+       if the prefix of the call is a qualified expression, rewrite as
+       a code statement.
+       * sem_ch13.adb (Analyze_Code_Statement): In Ada 2012 mode, the
+       code statement is legal if it is a rewriting of a procedure call.
+
+2011-10-13  Ed Schonberg  <schonberg@adacore.com>
+
+       * exp_aggr.adb (Flatten): If a component association has a box,
+       assume that aggregate is not static.
+       (Safe_Aggregate): If a component association in a non-limited
+       aggregate has a box, assume that it cannot be expanded in place.
+
+2011-10-13  Vincent Celier  <celier@adacore.com>
+
+       * prj-conf.adb (Get_Or_Create_Configuration_File): Call
+       Process_Project_Tree_Phase_1 with Packages_To_Check.
+       (Process_Project_And_Apply_Config): Ditto
+       * prj-part.ads, prj-part.adb, prj-pars.ads, prj-pars.adb (Parse):
+       Remove default for argument Packages_To_Check.
+       * prj-proc.adb (Recursive_Process): New argument
+       Packages_To_Check.
+       (Process): Ditto.
+       (Process_Project_Tree_Phase_1): Ditto.
+       (Recursive_Project.Process_Aggregated_Projects): Call
+       Prj.Part.Parse and Process_Project_Tree_Phase_1 with
+       Packages_To_Check.
+       * prj-proc.ads (Process): New argument Packages_To_Check
+       (Process_Project_Tree_Phase_1): Ditto
+
 2011-10-13  Arnaud Charlet  <charlet@adacore.com>
 
        * gcc-interface/Makefile.in: Fix typo.
index d06d8b9..b48b228 100644 (file)
@@ -3398,6 +3398,15 @@ package body Exp_Aggr is
             begin
                Assoc := First (Component_Associations (N));
                while Present (Assoc) loop
+
+                  --  If this is a box association, flattening is in general
+                  --  not possible because at this point we cannot tell if the
+                  --  default is static or even exists.
+
+                  if Box_Present (Assoc) then
+                     return False;
+                  end if;
+
                   Choice := First (Choices (Assoc));
 
                   while Present (Choice) loop
@@ -4148,6 +4157,12 @@ package body Exp_Aggr is
                         return False;
                      end if;
 
+                  --  If association has a box, no way to determine yet
+                  --  whether default can be assigned in place.
+
+                  elsif Box_Present (Expr) then
+                     return False;
+
                   elsif not Safe_Component (Expression (Expr)) then
                      return False;
                   end if;
index 6d9138c..d7e7a7d 100644 (file)
@@ -13002,6 +13002,23 @@ Names are in lower case
 @item ^-nM^/NAME_CASING=MIXED_CASE^
 Names are in mixed case
 
+@cindex @option{^-ne@var{x}^/ENUM_CASING^} (@command{gnatpp})
+@item ^-neD^/ENUM_CASING=AS_DECLARED^
+Enumeration literal casing for defining occurrences are as they appear in the
+source file. Overrides ^-n^/NAME_CASING^ casing setting.
+
+@item ^-neU^/ENUM_CASING=UPPER_CASE^
+Enumeration literals are in upper case.  Overrides ^-n^/NAME_CASING^ casing
+setting.
+
+@item ^-neL^/ENUM_CASING=LOWER_CASE^
+Enumeration literals are in lower case. Overrides ^-n^/NAME_CASING^ casing
+setting.
+
+@item ^-neM^/ENUM_CASING=MIXED_CASE^
+Enumeration literals are in mixed case. Overrides ^-n^/NAME_CASING^ casing
+setting.
+
 @cindex @option{^-p@var{x}^/PRAGMA_CASING^} (@command{gnatpp})
 @item ^-pL^/PRAGMA_CASING=LOWER_CASE^
 Pragma names are lower case
index 61d3db3..de9d491 100644 (file)
@@ -1614,7 +1614,9 @@ begin
                      --  Pass -mrtp to the linker if --RTS=rtp was passed
 
                      if Arg'Length > 8
-                       and then Arg (Arg'First + 6 .. Arg'First + 8) = "rtp"
+                       and then
+                         (Arg (Arg'First + 6 .. Arg'First + 8) = "rtp"
+                          or else Arg (Arg'Last - 2 .. Arg'Last) = "rtp")
                      then
                         Linker_Options.Increment_Last;
                         Linker_Options.Table (Linker_Options.Last) :=
index 9b24395..7eee3bf 100644 (file)
@@ -2015,12 +2015,17 @@ __gnat_error_handler (int sig, void *si, struct sigcontext *sc)
   sigprocmask (SIG_SETMASK, &mask, NULL);
 
 #if defined (__PPC__)
-  /* We process signals through a Call Frame Info trampoline, voiding
-     the need for myriads of fallback_frame_state variants.  */
+  /* On PowerPC, we process signals through a Call Frame Info trampoline,
+     voiding the need for myriads of fallback_frame_state variants in the
+     ZCX runtime.  We have no simple way to distinguish ZCX from SJLJ here,
+     so we do this for SJLJ as well even though this is not necessary.
+     This only incurs a few extra instructions and a tiny amount of extra
+     stack usage.  */
 
   #include "sigtramp.h"
 
-  __gnat_sigtramp (sig, si, sc, &__gnat_map_signal);
+  __gnat_sigtramp (sig, (void *)si, (void *)sc,
+                  (sighandler_t *)&__gnat_map_signal);
 
 #else
   __gnat_map_signal (sig, si, sc);
index 82c7547..011a444 100644 (file)
@@ -1675,8 +1675,12 @@ package body Sem_Aggr is
             --  unless the expression covers a single component, or the
             --  expander is inactive.
 
+            --  In Alfa mode, expressions that can perform side-effects will be
+            --  recognized by the gnat2why back-end, and the whole subprogram
+            --  will be ignored. So semantic analysis can be performed safely.
+
             if Single_Elmt
-              or else not Expander_Active
+              or else not Full_Expander_Active
               or else In_Spec_Expression
             then
                Analyze_And_Resolve (Expr, Component_Typ);
index 0895eb6..02c9325 100644 (file)
@@ -3364,11 +3364,19 @@ package body Sem_Ch13 is
 
          --  No statements other than code statements, pragmas, and labels.
          --  Again we allow certain internally generated statements.
+         --  In Ada 2012, qualified expressions are names, and the code
+         --  statement is initially parsed as a procedure call.
 
          Stmt := First (Statements (HSS));
          while Present (Stmt) loop
             StmtO := Original_Node (Stmt);
-            if Comes_From_Source (StmtO)
+
+            if Ada_Version >= Ada_2012
+              and then Nkind (StmtO) = N_Procedure_Call_Statement
+            then
+               null;
+
+            elsif Comes_From_Source (StmtO)
               and then not Nkind_In (StmtO, N_Pragma,
                                             N_Label,
                                             N_Code_Statement)
index 5cc4cb5..918763d 100644 (file)
@@ -16889,6 +16889,38 @@ package body Sem_Ch3 is
          when N_Attribute_Reference =>
             return Attribute_Name (Original_Node (Exp)) = Name_Input;
 
+         --  For a conditional expression, all dependent expressions must be
+         --  legal constructs.
+
+         when N_Conditional_Expression =>
+            declare
+               Then_Expr : constant Node_Id :=
+                 Next
+                   (First (Expressions (Original_Node (Exp))));
+               Else_Expr : constant Node_Id := Next (Then_Expr);
+
+            begin
+               return OK_For_Limited_Init_In_05 (Typ, Then_Expr)
+                 and then OK_For_Limited_Init_In_05 (Typ, Else_Expr);
+            end;
+
+         when N_Case_Expression =>
+            declare
+               Alt : Node_Id;
+
+            begin
+               Alt := First (Alternatives (Original_Node (Exp)));
+               while Present (Alt) loop
+                  if not OK_For_Limited_Init_In_05 (Typ, Expression (Alt)) then
+                     return False;
+                  end if;
+
+                  Next (Alt);
+               end loop;
+
+               return True;
+            end;
+
          when others =>
             return False;
       end case;
index 2fc3b96..3c5e3f8 100644 (file)
@@ -1340,6 +1340,15 @@ package body Sem_Ch6 is
          Analyze (P);
          Analyze_Call_And_Resolve;
 
+      --  In Ada 2012. a qualified expression is a name, but it cannot be a
+      --  procedure name, so the construct can only be a qualified expression.
+
+      elsif Nkind (P) = N_Qualified_Expression
+        and then Ada_Version >= Ada_2012
+      then
+         Rewrite (N, Make_Code_Statement (Loc, Expression => P));
+         Analyze (N);
+
       --  Anything else is an error
 
       else
index 4690694..9a55bf8 100644 (file)
@@ -13762,12 +13762,6 @@ package body Sem_Prag is
                Error_Msg_N ("Unchecked_Union must not be tagged", Typ);
                return;
 
-            elsif Is_Limited_Type (Typ) then
-               Error_Msg_N
-                 ("Unchecked_Union must not be limited record type", Typ);
-               Explain_Limited_Type (Typ, Typ);
-               return;
-
             else
                if not Has_Discriminants (Typ) then
                   Error_Msg_N
index 1da9855..bfda0a7 100644 (file)
@@ -6119,6 +6119,30 @@ package VMS_Data is
    --   See 'HELP GNAT COMPILE /WIDE_CHARACTER_ENCODING' for an explanation
    --   about the different character encoding methods.
 
+   S_Pretty_Enums     : aliased constant S := "/ENUM_CASING="              &
+                                              "AS_DECLARED "               &
+                                                 "-neD "                   &
+                                              "LOWER_CASE "                &
+                                                 "-neL "                   &
+                                              "UPPER_CASE "                &
+                                                 "-neU "                   &
+                                              "MIXED_CASE "                &
+                                                 "-neM";
+   --        /ENUM_CASING=name-option
+   --
+   --   Specify the casing of enumeration literals. If not specified, the
+   --   casing of enumeration literals is defined by the NAME_CASING option.
+   --   'name-option' may be one of:
+   --
+   --      AS_DECLARED       Literals casing for defining occurrences are
+   --                        as they appear in the source file.
+   --
+   --      LOWER_CASE        Literals are in lower case.
+   --
+   --      UPPER_CASE        Literals are in upper case.
+   --
+   --      MIXED_CASE        Literals are in mixed case.
+
    S_Pretty_Files     : aliased constant S := "/FILES=@"                   &
                                                  "-files=@";
    --      /FILES=filename
@@ -6369,6 +6393,7 @@ package VMS_Data is
                         S_Pretty_Eol              'Access,
                         S_Pretty_Ext              'Access,
                         S_Pretty_Encoding         'Access,
+                        S_Pretty_Enums            'Access,
                         S_Pretty_Files            'Access,
                         S_Pretty_Follow           'Access,
                         S_Pretty_Forced           'Access,