[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Wed, 5 Dec 2012 10:29:59 +0000 (11:29 +0100)
committerArnaud Charlet <charlet@gcc.gnu.org>
Wed, 5 Dec 2012 10:29:59 +0000 (11:29 +0100)
2012-12-05  Ed Schonberg  <schonberg@adacore.com>

* s-rident.ads, restrict.ads: Remove discrepancies between the
documentation on implementation-defined restrictions, and
the internal data structure used for warnings and errors on
implementation-defined restriction violations.

2012-12-05  Ed Schonberg  <schonberg@adacore.com>

* sem_prag.adb (Chain_PPC): Pre- and postcondition aspects
are legal on a subprogram body that acts as a spec.

2012-12-05  Ed Schonberg  <schonberg@adacore.com>

* sem_ch8.adb (Find_Selected_Component): If the selector name is
an overloadable entity but the name is not overloaded, generate
reference to it rather than delaying this until resolution.

2012-12-05  Robert Dewar  <dewar@adacore.com>

* checks.ads, checks.adb (Activate_Overflow_Check): No effect for
MOD/REM/unary +
* exp_ch4.adb (Expand_N_Op_Mod): Remove call to set Do_Overflow_Check.

2012-12-05  Ed Schonberg  <schonberg@adacore.com>

* sem_ch4.adb (Find_Non_Universal_Interpretation): Use the
types of the right operand if the left operand is null.

2012-12-05  Sergey Rybin  <rybin@adacore.com frybin>

* gnat_ugn.texi, vms_data.ads: document gnatpp -nn option.

2012-12-05  Jose Ruiz  <ruiz@adacore.com>

* init.c (__gnat_install_handler): For the LEON VxWorks kernel
run-time library we need to install a trap handler directly in the
trap table (no support by the OS) for the software trap 0.

From-SVN: r194196

12 files changed:
gcc/ada/ChangeLog
gcc/ada/checks.adb
gcc/ada/checks.ads
gcc/ada/exp_ch4.adb
gcc/ada/gnat_ugn.texi
gcc/ada/init.c
gcc/ada/restrict.ads
gcc/ada/s-rident.ads
gcc/ada/sem_ch4.adb
gcc/ada/sem_ch8.adb
gcc/ada/sem_prag.adb
gcc/ada/vms_data.ads

index 7f777670e9e7fe8c9ebfc1c4d8d48228c14b8205..2503ca0b957b3c2df51062eedb7856bf15ce8939 100644 (file)
@@ -1,3 +1,42 @@
+2012-12-05  Ed Schonberg  <schonberg@adacore.com>
+
+       * s-rident.ads, restrict.ads: Remove discrepancies between the
+       documentation on implementation-defined restrictions, and
+       the internal data structure used for warnings and errors on
+       implementation-defined restriction violations.
+
+2012-12-05  Ed Schonberg  <schonberg@adacore.com>
+
+       * sem_prag.adb (Chain_PPC): Pre- and postcondition aspects
+       are legal on a subprogram body that acts as a spec.
+
+2012-12-05  Ed Schonberg  <schonberg@adacore.com>
+
+       * sem_ch8.adb (Find_Selected_Component): If the selector name is
+       an overloadable entity but the name is not overloaded, generate
+       reference to it rather than delaying this until resolution.
+
+2012-12-05  Robert Dewar  <dewar@adacore.com>
+
+       * checks.ads, checks.adb (Activate_Overflow_Check): No effect for
+       MOD/REM/unary +
+       * exp_ch4.adb (Expand_N_Op_Mod): Remove call to set Do_Overflow_Check.
+
+2012-12-05  Ed Schonberg  <schonberg@adacore.com>
+
+       * sem_ch4.adb (Find_Non_Universal_Interpretation): Use the
+       types of the right operand if the left operand is null.
+
+2012-12-05  Sergey Rybin  <rybin@adacore.com frybin>
+
+       * gnat_ugn.texi, vms_data.ads: document gnatpp -nn option.
+
+2012-12-05  Jose Ruiz  <ruiz@adacore.com>
+
+       * init.c (__gnat_install_handler): For the LEON VxWorks kernel
+       run-time library we need to install a trap handler directly in the
+       trap table (no support by the OS) for the software trap 0.
+
 2012-12-05  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gnat_rm.texi (Interfacing to C++): Document new restrictions.
index 841b17861b2c905f78b356404655f4e27c5ea148..8a73e25e6c9b85cc76e179c9105f2b125be88b9f 100644 (file)
@@ -387,8 +387,10 @@ package body Checks is
 
    procedure Activate_Overflow_Check (N : Node_Id) is
    begin
-      Set_Do_Overflow_Check (N, True);
-      Possible_Local_Raise (N, Standard_Constraint_Error);
+      if not Nkind_In (N, N_Op_Rem, N_Op_Mod, N_Op_Plus) then
+         Set_Do_Overflow_Check (N, True);
+         Possible_Local_Raise (N, Standard_Constraint_Error);
+      end if;
    end Activate_Overflow_Check;
 
    --------------------------
index fa1c0555d971575129a2c20a280497ddec4d15a4..2221f0ea292f030e7bf458653c1eb9e11ac8c28a 100644 (file)
@@ -93,6 +93,8 @@ package Checks is
    --  Sets Do_Overflow_Check flag in node N, and handles possible local raise.
    --  Always call this routine rather than calling Set_Do_Overflow_Check to
    --  set an explicit value of True, to ensure handling the local raise case.
+   --  Note that this call has no effect for MOD, REM, and unary "+" for which
+   --  overflow is never possible in any case.
 
    procedure Activate_Range_Check (N : Node_Id);
    pragma Inline (Activate_Range_Check);
index 82af98e43e802df8654f5893cce1e13dee7d4e4f..80c27c4e994a719dc1ec9972cfefee7c8646e95f 100644 (file)
@@ -7910,7 +7910,6 @@ package body Exp_Ch4 is
    procedure Expand_N_Op_Mod (N : Node_Id) is
       Loc   : constant Source_Ptr := Sloc (N);
       Typ   : constant Entity_Id  := Etype (N);
-      DOC   : constant Boolean    := Do_Overflow_Check (N);
       DDC   : constant Boolean    := Do_Division_Check (N);
 
       Left  : Node_Id;
@@ -7975,7 +7974,6 @@ package body Exp_Ch4 is
 
          Set_Entity            (N, Standard_Entity (S_Op_Rem));
          Set_Etype             (N, Typ);
-         Set_Do_Overflow_Check (N, DOC);
          Set_Do_Division_Check (N, DDC);
          Expand_N_Op_Rem (N);
          Set_Analyzed (N);
index 6d47f040e01eab75b8c1374e92111279e9dbaa01..199f920453cb33fc5938dd925fed7bb37c04cd45 100644 (file)
@@ -13384,6 +13384,18 @@ lower case. Overrides ^-n^/NAME_CASING^ casing setting.
 Names introduced by type and subtype declarations are always in
 mixed case. Overrides ^-n^/NAME_CASING^ casing setting.
 
+@item ^-nnU^/NUMBER_CASING=UPPER_CASE^
+Names introduced by number declarations are always in
+upper case. Overrides ^-n^/NAME_CASING^ casing setting.
+
+@item ^-nnL^/NUMBER_CASING=LOWER_CASE^
+Names introduced by number declarations are always in
+lower case. Overrides ^-n^/NAME_CASING^ casing setting.
+
+@item ^-nnM^/NUMBER_CASING=MIXED_CASE^
+Names introduced by number declarations are always 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 e7283a20146890952789adaaaafb19922d99e951..8a28bf68ab54ed256808e7abe5fa75abfe07bd10 100644 (file)
@@ -1759,6 +1759,25 @@ __gnat_error_handler (int sig, void *si, struct sigcontext *sc)
 #endif
 }
 
+#if defined(__leon__) && defined(_WRS_KERNEL)
+/* For LEON VxWorks we need to install a trap handler for stack overflow */
+
+extern void excEnt (void);
+/* VxWorks exception handler entry */
+
+struct trap_entry {
+   unsigned long inst_first;
+   unsigned long inst_second;
+   unsigned long inst_third;
+   unsigned long inst_fourth;
+};
+/* Four instructions representing entries in the trap table */
+
+struct trap_entry *trap_0_entry;
+/* We will set the location of the entry for software trap 0 in the trap
+   table. */
+#endif
+
 void
 __gnat_install_handler (void)
 {
@@ -1779,6 +1798,40 @@ __gnat_install_handler (void)
   sigaction (SIGSEGV, &act, NULL);
   sigaction (SIGBUS,  &act, NULL);
 
+#if defined(__leon__) && defined(_WRS_KERNEL)
+  /* Specific to the LEON VxWorks kernel run-time library */
+
+  /* For stack checking the compiler triggers a software trap 0 (ta 0) in
+     case of overflow (we use the stack limit mechanism). We need to install
+     the trap handler here for this software trap (the OS does not handle
+     it) as if it were a data_access_exception (trap 9). We do the same as
+     if we put in the trap table a VXSPARC_BAD_TRAP(9). Software trap 0 is
+     located at vector 0x80, and each entry takes 4 words. */
+
+  trap_0_entry = (struct trap_entry *)(intVecBaseGet () + 0x80 * 4);
+
+  /* mov 0x9, %l7 */
+
+  trap_0_entry->inst_first = 0xae102000 + 9;
+
+  /* sethi %hi(excEnt), %l6 */
+
+  /* The 22 most significant bits of excEnt are obtained shifting 10 times
+     to the right.  */
+
+  trap_0_entry->inst_second = 0x2d000000 + ((unsigned long)excEnt >> 10);
+
+  /* jmp %l6+%lo(excEnt) */
+
+  /* The 10 least significant bits of excEnt are obtained by masking */
+
+  trap_0_entry->inst_third = 0x81c5a000 + ((unsigned long)excEnt & 0x3ff);
+
+  /* rd %psr, %l0 */
+
+  trap_0_entry->inst_fourth = 0xa1480000;
+#endif
+
   __gnat_handler_installed = 1;
 }
 
index 1d9d67f910e5f1f4d74c924478f1fa5b3d8c7fc0..54702abd10cf9c0bfb5fccd99eab28ad328271cf 100644 (file)
@@ -107,8 +107,9 @@ package Restrict is
 
    Implementation_Restriction : array (All_Restrictions) of Boolean :=
      (Simple_Barriers                    => True,
-      No_Asynchronous_Control            => True,
       No_Calendar                        => True,
+      No_Default_Initialization          => True,
+      No_Direct_Boolean_Operators        => True,
       No_Dispatching_Calls               => True,
       No_Dynamic_Attachment              => True,
       No_Elaboration_Code                => True,
@@ -116,12 +117,16 @@ package Restrict is
       No_Entry_Calls_In_Elaboration_Code => True,
       No_Entry_Queue                     => True,
       No_Exception_Handlers              => True,
+      No_Exception_Propagation           => True,
       No_Exception_Registration          => True,
+      No_Finalization                    => True,
       No_Implementation_Attributes       => True,
       No_Implementation_Pragmas          => True,
       No_Implicit_Conditionals           => True,
+      No_Implicit_Aliasing               => True,
       No_Implicit_Dynamic_Code           => True,
       No_Implicit_Loops                  => True,
+      No_Initialize_Scalars              => True,
       No_Local_Protected_Objects         => True,
       No_Protected_Type_Allocators       => True,
       No_Relative_Delay                  => True,
@@ -129,14 +134,15 @@ package Restrict is
       No_Secondary_Stack                 => True,
       No_Select_Statements               => True,
       No_Standard_Storage_Pools          => True,
+      No_Stream_Optimizations            => True,
       No_Streams                         => True,
       No_Task_Attributes_Package         => True,
       No_Task_Termination                => True,
-      No_Unchecked_Conversion            => True,
-      No_Unchecked_Deallocation          => True,
+      No_Tasking                         => True,
       No_Wide_Characters                 => True,
       Static_Priorities                  => True,
       Static_Storage_Size                => True,
+      SPARK                              => True,
       others                             => False);
 
    --  The following table records entries made by Restrictions pragmas
index 880a72915051788e17856e96c4794c5d9021e8ce..d0bc1066c0cc3437e1480393ff39989e8681ccc7 100644 (file)
@@ -94,7 +94,7 @@ package System.Rident is
       No_Allocators,                           -- (RM H.4(7))
       No_Allocators_After_Elaboration,         -- Ada 2012 (RM D.7(19.1/2))
       No_Anonymous_Allocators,                 -- Ada 2012 (RM H.4(8/1))
-      No_Asynchronous_Control,                 -- (RM D.7(10))
+      No_Asynchronous_Control,                 -- (RM J.13(3/2)
       No_Calendar,                             -- GNAT
       No_Default_Stream_Attributes,            -- Ada 2012 (RM 13.12.1(4/2))
       No_Delay,                                -- (RM H.4(21))
@@ -142,8 +142,8 @@ package System.Rident is
       No_Tasking,                              -- GNAT
       No_Terminate_Alternatives,               -- (RM D.7(6))
       No_Unchecked_Access,                     -- (RM H.4(18))
-      No_Unchecked_Conversion,                 -- (RM H.4(16))
-      No_Unchecked_Deallocation,               -- (RM H.4(9))
+      No_Unchecked_Conversion,                 -- (RM J.13(4/2))
+      No_Unchecked_Deallocation,               -- (RM J.13(5/2))
       Static_Priorities,                       -- GNAT
       Static_Storage_Size,                     -- GNAT
 
index 10fd3863af2b14a1003766972827333655c8cb34..2c54fcdc5c8882996b930484e7dceca41f761da9 100644 (file)
@@ -192,7 +192,9 @@ package body Sem_Ch4 is
    --  of the operand types. If one of the operands has a universal interpre-
    --  tation,  the legality check uses some compatible non-universal
    --  interpretation of the other operand. N can be an operator node, or
-   --  a function call whose name is an operator designator.
+   --  a function call whose name is an operator designator. Any_Access, which
+   --  is the initial type of the literal NULL, is a universal type for the
+   --  purpose of this routine.
 
    function Find_Primitive_Operation (N : Node_Id) return Boolean;
    --  Find candidate interpretations for the name Obj.Proc when it appears
@@ -5504,6 +5506,7 @@ package body Sem_Ch4 is
    begin
       if T1 = Universal_Integer
         or else T1 = Universal_Real
+        or else T1 = Any_Access
       then
          if not Is_Overloaded (R) then
             Add_One_Interp
index 7b937a67ac5e54e477845af2cd1d2b46270278e7..fb5c3c807de89cbee151fca248d4b2a622268660 100644 (file)
@@ -5521,6 +5521,13 @@ package body Sem_Ch8 is
             null;
          end if;
       end if;
+
+      --  If there is a single interpretation for N we can generate a
+      --  reference to the unique entity found.
+
+      if Is_Overloadable (Id) and then not Is_Overloaded (N) then
+         Generate_Reference (Id, N);
+      end if;
    end Find_Expanded_Name;
 
    -------------------------
index 2765f10ee09a2bd2fa4e49b1d0fd8fe7ace5eb0f..fa3e066641c8b0f6bbdc29c9536ed9692544e8c8 100644 (file)
@@ -2068,6 +2068,14 @@ package body Sem_Prag is
                Error_Pragma
                  ("aspect % requires ''Class for null procedure");
 
+            --  Pre/postconditions are legal on a subprogram body if it is not
+            --  a completion of a declaration.
+
+            elsif Nkind (PO) = N_Subprogram_Body
+              and then Acts_As_Spec (PO)
+            then
+               null;
+
             elsif not Nkind_In (PO, N_Subprogram_Declaration,
                                     N_Expression_Function,
                                     N_Generic_Subprogram_Declaration,
index e4b04b7835130a0e825a85548048953f36285c12..69fe509b3e25e7ca25cd8a485e18d2f14295caf7 100644 (file)
@@ -6343,6 +6343,30 @@ package VMS_Data is
    --
    --   Replace all tabulations in comments with spaces.
 
+   S_Pretty_Numbers     : aliased constant S := "/NUMBER_CASING="          &
+                                              "AS_DECLARED "               &
+                                                 "-ntD "                   &
+                                              "LOWER_CASE "                &
+                                                 "-ntL "                   &
+                                              "UPPER_CASE "                &
+                                                 "-ntU "                   &
+                                              "MIXED_CASE "                &
+                                                 "-ntM";
+   --        /NUMBER_CASING=name-option
+   --
+   --   Specify the casing of named number names. If not specified, the casing
+   --   of these names is defined by the NAME_CASING option. 'name-option'
+   --   is one of:
+   --
+   --      AS_DECLARED       Names are cased as they appear in the declaration
+   --                        in the source file.
+   --
+   --      LOWER_CASE        Names are in lower case.
+   --
+   --      UPPER_CASE        Names are in upper case.
+   --
+   --      MIXED_CASE        Names are in mixed case.
+
    S_Pretty_Output    : aliased constant S := "/OUTPUT=@"                  &
                                               "-o@";
    --        /OUTPUT=file
@@ -6498,6 +6522,7 @@ package VMS_Data is
                         S_Pretty_Names            'Access,
                         S_Pretty_No_Labels        'Access,
                         S_Pretty_Notabs           'Access,
+                        S_Pretty_Numbers          'Access,
                         S_Pretty_Output           'Access,
                         S_Pretty_Override         'Access,
                         S_Pretty_Pragma           'Access,