]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Wed, 30 Jul 2014 13:40:41 +0000 (15:40 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Wed, 30 Jul 2014 13:40:41 +0000 (15:40 +0200)
2014-07-30  Olivier Hainque  <hainque@adacore.com>

* vxworks-ppc-link.spec: New file. Extra link
instructions for ppc-vxworks.
* vxworks-crtbe-link.spec: Likewise, for ZCX related support.
* system-vxworks-ppc.ads: Adjust linker options to use spec files.
* system-vxworks-arm.ads: Likewise.
* gcc-interface/Makefile.in: Enable .spec files.

2014-07-30  Ed Schonberg  <schonberg@adacore.com>

* sem_aggr.adb: Minor comment reformatting.

2014-07-30  Robert Dewar  <dewar@adacore.com>

* sem_util.ads, sem_util.adb (Is_Junk_Name): Removed.
* sem_warn.adb (Has_Junk_Name): New function
(Check_References): Use Has_Junk_Name to delete junk warnings
(Check_Unset_Reference): ditto.
(Warn_On_Unreferenced_Entity): ditto.
(Warn_On_Useless_Assignment): ditto.
* sem_ch3.adb, lib-xref-spark_specific.adb, s-taprop-vxworks.adb,
exp_ch7.adb, s-asthan-vms-alpha.adb, sem_ch10.adb, osint-c.adb,
prj.adb, g-comlin.adb, makeutl.adb, s-tasdeb.adb, exp_intr.adb,
s-asthan-vms-ia64.adb, prj-env.adb: Ditto.

2014-07-30  Ed Schonberg  <schonberg@adacore.com>

* checks.adb (Insert_Valid_Check): Do not check for the packed
array type of a prefix that is an access type.

2014-07-30  Ed Schonberg  <schonberg@adacore.com>

* sem_attr.adb (Eval_Attribute): Evaluate the GNAT attribute
Unconstrained_Array even if prefix is not frozen yet, as can
occur with a private subtype used as a generic actual.

2014-07-30  Gary Dismukes  <dismukes@adacore.com>

* sem_attr.adb: Minor reformatting.

2014-07-30  Pat Rogers  <rogers@adacore.com>

* gnat_rm.texi: Corrected minor wording error in description
of No_Exception_Registration.

2014-07-30  Yannick Moy  <moy@adacore.com>

* einfo.ads, einfo.adb: New flag Is_Inlined_Always for use in GNATprove
mode. Realphabetize two subprograms.
* inline.adb (Cannot_Inline): Use Is_Inlined_Always in GNATprove mode.
(Can_Be_Inlined_In_GNATprove_Mode): Adapt to possible Empty Body_Id.
(Check_And_Build_Body_To_Inline): Use Is_Inlined_Always in GNATprove
mode.
(Expand_Inline_Call): Use Is_Inlined_Always in GNATprove mode.
* sem_ch6.adb (Analyze_Subprogram_Body_Helper): Do not use
Is_Inline in GNATprove mode.
(Analyze_Subprogram_Specification):
Set Is_Inlined_Always at subprogram entity creation.
* sem_res.adb (Resolve_Call): Do not deal with inlining during
pre-analysis.  Issue warning on call to possibly inlined
subprogram when body not seen.

2014-07-30  Yannick Moy  <moy@adacore.com>

* lib-xref.adb (Generate_Reference): Add special
case for compiler-generated formals in GNATprove mode.

From-SVN: r213264

36 files changed:
gcc/ada/ChangeLog
gcc/ada/checks.adb
gcc/ada/einfo.adb
gcc/ada/einfo.ads
gcc/ada/exp_ch7.adb
gcc/ada/exp_intr.adb
gcc/ada/g-comlin.adb
gcc/ada/gcc-interface/Makefile.in
gcc/ada/gnat_rm.texi
gcc/ada/inline.adb
gcc/ada/inline.ads
gcc/ada/lib-xref-spark_specific.adb
gcc/ada/lib-xref.adb
gcc/ada/makeutl.adb
gcc/ada/osint-c.adb
gcc/ada/prj-env.adb
gcc/ada/prj.adb
gcc/ada/s-asthan-vms-alpha.adb
gcc/ada/s-asthan-vms-ia64.adb
gcc/ada/s-taprop-vxworks.adb
gcc/ada/s-tasdeb.adb
gcc/ada/sem_aggr.adb
gcc/ada/sem_attr.adb
gcc/ada/sem_ch10.adb
gcc/ada/sem_ch3.adb
gcc/ada/sem_ch6.adb
gcc/ada/sem_eval.adb
gcc/ada/sem_eval.ads
gcc/ada/sem_res.adb
gcc/ada/sem_util.adb
gcc/ada/sem_util.ads
gcc/ada/sem_warn.adb
gcc/ada/system-vxworks-arm.ads
gcc/ada/system-vxworks-ppc.ads
gcc/ada/vxworks-crtbe-link.spec [new file with mode: 0644]
gcc/ada/vxworks-ppc-link.spec [new file with mode: 0644]

index 6986a473d293a2abd949fa92357dbc463bc18b99..4c260cac39e2267bb8048eb61b53147e3cf8cceb 100644 (file)
@@ -1,3 +1,67 @@
+2014-07-30  Olivier Hainque  <hainque@adacore.com>
+
+       * vxworks-ppc-link.spec: New file. Extra link
+       instructions for ppc-vxworks.
+       * vxworks-crtbe-link.spec: Likewise, for ZCX related support.
+       * system-vxworks-ppc.ads: Adjust linker options to use spec files.
+       * system-vxworks-arm.ads: Likewise.
+       * gcc-interface/Makefile.in: Enable .spec files.
+
+2014-07-30  Ed Schonberg  <schonberg@adacore.com>
+
+       * sem_aggr.adb: Minor comment reformatting.
+
+2014-07-30  Robert Dewar  <dewar@adacore.com>
+
+       * sem_util.ads, sem_util.adb (Is_Junk_Name): Removed.
+       * sem_warn.adb (Has_Junk_Name): New function
+       (Check_References): Use Has_Junk_Name to delete junk warnings
+       (Check_Unset_Reference): ditto.
+       (Warn_On_Unreferenced_Entity): ditto.
+       (Warn_On_Useless_Assignment): ditto.
+
+2014-07-30  Ed Schonberg  <schonberg@adacore.com>
+
+       * checks.adb (Insert_Valid_Check): Do not check for the packed
+       array type of a prefix that is an access type.
+
+2014-07-30  Ed Schonberg  <schonberg@adacore.com>
+
+       * sem_attr.adb (Eval_Attribute): Evaluate the GNAT attribute
+       Unconstrained_Array even if prefix is not frozen yet, as can
+       occur with a private subtype used as a generic actual.
+
+2014-07-30  Gary Dismukes  <dismukes@adacore.com>
+
+       * sem_attr.adb: Minor reformatting.
+
+2014-07-30  Pat Rogers  <rogers@adacore.com>
+
+       * gnat_rm.texi: Corrected minor wording error in description
+       of No_Exception_Registration.
+
+2014-07-30  Yannick Moy  <moy@adacore.com>
+
+       * einfo.ads, einfo.adb: New flag Is_Inlined_Always for use in GNATprove
+       mode. Realphabetize two subprograms.
+       * inline.adb (Cannot_Inline): Use Is_Inlined_Always in GNATprove mode.
+       (Can_Be_Inlined_In_GNATprove_Mode): Adapt to possible Empty Body_Id.
+       (Check_And_Build_Body_To_Inline): Use Is_Inlined_Always in GNATprove
+       mode.
+       (Expand_Inline_Call): Use Is_Inlined_Always in GNATprove mode.
+       * sem_ch6.adb (Analyze_Subprogram_Body_Helper): Do not use
+       Is_Inline in GNATprove mode.
+       (Analyze_Subprogram_Specification):
+       Set Is_Inlined_Always at subprogram entity creation.
+       * sem_res.adb (Resolve_Call): Do not deal with inlining during
+       pre-analysis.  Issue warning on call to possibly inlined
+       subprogram when body not seen.
+
+2014-07-30  Yannick Moy  <moy@adacore.com>
+
+       * lib-xref.adb (Generate_Reference): Add special
+       case for compiler-generated formals in GNATprove mode.
+
 2014-07-30  Yannick Moy  <moy@adacore.com>
 
        * sem_ch6.adb: Add comments.
index d9a6c9d253729d0732d95327c7f7bfea160de00a..27862d5a5b351ad3dbedff6145550f8ae88bb021 100644 (file)
@@ -6554,7 +6554,8 @@ package body Checks is
          --  A rather specialized test. If PV is an analyzed expression which
          --  is an indexed component of a packed array that has not been
          --  properly expanded, turn off its Analyzed flag to make sure it
-         --  gets properly reexpanded.
+         --  gets properly reexpanded. If the prefix is an access value,
+         --  the dereference will be added later.
 
          --  The reason this arises is that Duplicate_Subexpr_No_Checks did
          --  an analyze with the old parent pointer. This may point e.g. to
@@ -6562,6 +6563,7 @@ package body Checks is
 
          if Analyzed (PV)
            and then Nkind (PV) = N_Indexed_Component
+           and then Is_Array_Type (Etype (Prefix (PV)))
            and then Present (Packed_Array_Impl_Type (Etype (Prefix (PV))))
          then
             Set_Analyzed (PV, False);
@@ -8053,8 +8055,10 @@ package body Checks is
 
          if Vax_Float (E) then
             return True;
+
          elsif Kill_Range_Checks (E) then
             return True;
+
          elsif Checks_May_Be_Suppressed (E) then
             return Is_Check_Suppressed (E, Range_Check);
          end if;
index c815c189c4a0c0260eba2c988fa1bc66a77bdf8a..95d94ecbdd9f206605c571e08cfc2fe80546aab5 100644 (file)
@@ -270,6 +270,7 @@ package body Einfo is
    --  sense for them to be set true for certain subsets of entity kinds. See
    --  the spec of Einfo for further details.
 
+   --    Is_Inlined_Always               Flag1
    --    Is_Frozen                       Flag4
    --    Has_Discriminants               Flag5
    --    Is_Dispatching_Operation        Flag6
@@ -568,7 +569,6 @@ package body Einfo is
    --    (SSO_Set_Low_By_Default)        Flag272
    --    (SSO_Set_Low_By_Default)        Flag273
 
-   --    (unused)                        Flag1
    --    (unused)                        Flag2
    --    (unused)                        Flag3
 
@@ -2107,6 +2107,12 @@ package body Einfo is
       return Flag11 (Id);
    end Is_Inlined;
 
+   function Is_Inlined_Always (Id : E) return B is
+   begin
+      pragma Assert (Ekind (Id) = E_Function or else Ekind (Id) = E_Procedure);
+      return Flag1 (Id);
+   end Is_Inlined_Always;
+
    function Is_Interface (Id : E) return B is
    begin
       return Flag186 (Id);
@@ -3518,6 +3524,13 @@ package body Einfo is
       Set_Flag38 (Id, V);
    end Set_Can_Never_Be_Null;
 
+   procedure Set_Can_Use_Internal_Rep (Id : E; V : B := True) is
+   begin
+      pragma Assert
+        (Is_Access_Subprogram_Type (Id) and then Is_Base_Type (Id));
+      Set_Flag229 (Id, V);
+   end Set_Can_Use_Internal_Rep;
+
    procedure Set_Checks_May_Be_Suppressed (Id : E; V : B := True) is
    begin
       Set_Flag31 (Id, V);
@@ -3559,6 +3572,22 @@ package body Einfo is
       Set_Node20 (Id, V);
    end Set_Component_Type;
 
+   procedure Set_Contract (Id : E; V : N) is
+   begin
+      pragma Assert
+        (Ekind_In (Id, E_Entry,
+         E_Entry_Family,
+         E_Generic_Package,
+         E_Package,
+         E_Package_Body,
+         E_Subprogram_Body,
+         E_Variable,
+         E_Void)
+         or else Is_Generic_Subprogram (Id)
+         or else Is_Subprogram (Id));
+      Set_Node34 (Id, V);
+   end Set_Contract;
+
    procedure Set_Corresponding_Concurrent_Type (Id : E; V : E) is
    begin
       pragma Assert
@@ -3849,22 +3878,6 @@ package body Einfo is
       Set_Node18 (Id, V);
    end Set_Entry_Index_Constant;
 
-   procedure Set_Contract (Id : E; V : N) is
-   begin
-      pragma Assert
-        (Ekind_In (Id, E_Entry,
-                       E_Entry_Family,
-                       E_Generic_Package,
-                       E_Package,
-                       E_Package_Body,
-                       E_Subprogram_Body,
-                       E_Variable,
-                       E_Void)
-          or else Is_Generic_Subprogram (Id)
-          or else Is_Subprogram (Id));
-      Set_Node34 (Id, V);
-   end Set_Contract;
-
    procedure Set_Entry_Parameters_Type (Id : E; V : E) is
    begin
       Set_Node15 (Id, V);
@@ -3951,13 +3964,6 @@ package body Einfo is
       Set_Node28 (Id, V);
    end Set_Extra_Formals;
 
-   procedure Set_Can_Use_Internal_Rep (Id : E; V : B := True) is
-   begin
-      pragma Assert
-        (Is_Access_Subprogram_Type (Id) and then Is_Base_Type (Id));
-      Set_Flag229 (Id, V);
-   end Set_Can_Use_Internal_Rep;
-
    procedure Set_Finalization_Master (Id : E; V : E) is
    begin
       pragma Assert (Is_Access_Type (Id) and then Is_Base_Type (Id));
@@ -4888,6 +4894,12 @@ package body Einfo is
       Set_Flag11 (Id, V);
    end Set_Is_Inlined;
 
+   procedure Set_Is_Inlined_Always (Id : E; V : B := True) is
+   begin
+      pragma Assert (Ekind (Id) = E_Function or else Ekind (Id) = E_Procedure);
+      Set_Flag1 (Id, V);
+   end Set_Is_Inlined_Always;
+
    procedure Set_Is_Interface (Id : E; V : B := True) is
    begin
       pragma Assert (Is_Record_Type (Id));
@@ -8389,6 +8401,7 @@ package body Einfo is
       W ("Is_Imported",                     Flag24  (Id));
       W ("Is_Independent",                  Flag268 (Id));
       W ("Is_Inlined",                      Flag11  (Id));
+      W ("Is_Inlined_Always",               Flag1   (Id));
       W ("Is_Instantiated",                 Flag126 (Id));
       W ("Is_Interface",                    Flag186 (Id));
       W ("Is_Internal",                     Flag17  (Id));
index d6f6beccd57c7edeeb3047b1ce76b545dbd91ede..6969bf816b8a843a3770bd835cfdf39ebc874f4c 100644 (file)
@@ -2476,10 +2476,12 @@ package Einfo is
 --       be compiled. Is_Inlined is also set on generic subprograms and is
 --       inherited by their instances. It is also set on the body entities
 --       of inlined subprograms. See also Has_Pragma_Inline.
---
---       Is_Inlined is also set for subprograms that are always inlined in
---       GNATprove mode. GNATprove uses this flag to know when a body does not
---       need to be analyzed.
+
+--    Is_Inlined_Always (Flag1)
+--       Defined in subprograms. Set for functions and procedures which are
+--       always inlined in GNATprove mode. GNATprove uses this flag to know
+--       when a body does not need to be analyzed. The value of this flag is
+--       only meaningful if Body_To_Inline is not Empty for the subprogram.
 
 --    Is_Instantiated (Flag126)
 --       Defined in generic packages and generic subprograms. Set if the unit
@@ -5673,6 +5675,7 @@ package Einfo is
    --    Is_Discrim_SO_Function              (Flag176)
    --    Is_Discriminant_Check_Function      (Flag264)
    --    Is_Eliminated                       (Flag124)
+   --    Is_Inlined_Always                   (Flag1)    (non-generic case only)
    --    Is_Instantiated                     (Flag126)  (generic case only)
    --    Is_Intrinsic_Subprogram             (Flag64)
    --    Is_Invariant_Procedure              (Flag257)  (non-generic case only)
@@ -5964,6 +5967,7 @@ package Einfo is
    --    Is_Called                           (Flag102)  (non-generic case only)
    --    Is_Constructor                      (Flag76)
    --    Is_Eliminated                       (Flag124)
+   --    Is_Inlined_Always                   (Flag1)    (non-generic case only)
    --    Is_Instantiated                     (Flag126)  (generic case only)
    --    Is_Interrupt_Handler                (Flag89)
    --    Is_Intrinsic_Subprogram             (Flag64)
@@ -6683,6 +6687,7 @@ package Einfo is
    function Is_Imported                         (Id : E) return B;
    function Is_Independent                      (Id : E) return B;
    function Is_Inlined                          (Id : E) return B;
+   function Is_Inlined_Always                   (Id : E) return B;
    function Is_Instantiated                     (Id : E) return B;
    function Is_Interface                        (Id : E) return B;
    function Is_Internal                         (Id : E) return B;
@@ -7320,6 +7325,7 @@ package Einfo is
    procedure Set_Is_Imported                     (Id : E; V : B := True);
    procedure Set_Is_Independent                  (Id : E; V : B := True);
    procedure Set_Is_Inlined                      (Id : E; V : B := True);
+   procedure Set_Is_Inlined_Always               (Id : E; V : B := True);
    procedure Set_Is_Instantiated                 (Id : E; V : B := True);
    procedure Set_Is_Interface                    (Id : E; V : B := True);
    procedure Set_Is_Internal                     (Id : E; V : B := True);
@@ -8090,6 +8096,7 @@ package Einfo is
    pragma Inline (Is_Incomplete_Type);
    pragma Inline (Is_Independent);
    pragma Inline (Is_Inlined);
+   pragma Inline (Is_Inlined_Always);
    pragma Inline (Is_Instantiated);
    pragma Inline (Is_Integer_Type);
    pragma Inline (Is_Interface);
@@ -8545,6 +8552,7 @@ package Einfo is
    pragma Inline (Set_Is_Imported);
    pragma Inline (Set_Is_Independent);
    pragma Inline (Set_Is_Inlined);
+   pragma Inline (Set_Is_Inlined_Always);
    pragma Inline (Set_Is_Instantiated);
    pragma Inline (Set_Is_Interface);
    pragma Inline (Set_Is_Internal);
index 1abda22085d3849405ebb9593dbbbb1ec1aa5428..9649505134ad20bee87bd5de3b0b55d29040eab5 100644 (file)
@@ -3141,7 +3141,6 @@ package body Exp_Ch7 is
       Decl : Node_Id;
 
       Dummy : Entity_Id;
-      pragma Unreferenced (Dummy);
       --  This variable captures an unused dummy internal entity, see the
       --  comment associated with its use.
 
index f0ca3e3afc67ea039048b9ace9cb36772c6ff823..a2d02e8a16f6919c59684097c68e2ec8f9be7d67 100644 (file)
@@ -961,7 +961,6 @@ package body Exp_Intr is
       --  them to the tree, and that can disturb current value settings.
 
       Dummy : Entity_Id;
-      pragma Unreferenced (Dummy);
       --  This variable captures an unused dummy internal entity, see the
       --  comment associated with its use.
 
index 20ee73ce650a3a49f08ed9eed645360a382302dd..440b5d12f3c37a09ea240abdee83fef8e06f905a 100644 (file)
@@ -584,7 +584,6 @@ package body GNAT.Command_Line is
       Parser      : Opt_Parser := Command_Line_Parser) return Character
    is
       Dummy : Boolean;
-      pragma Unreferenced (Dummy);
 
    begin
       <<Restart>>
index 63f9e303f58539da65e51cd084be990e9007dc2a..fb06b6bcca3384a2662e5c16e4e9947e9e056cad 100644 (file)
@@ -623,6 +623,9 @@ ifeq ($(strip $(filter-out powerpc% wrs vxworks,$(target_cpu) $(target_vendor) $
   EXTRA_GNATRTL_TASKING_OBJS += s-vxwork.o s-vxwext.o
 
   EXTRA_LIBGNAT_OBJS+=vx_stack_info.o
+
+  GCC_SPEC_FILES+=vxworks-$(ARCH_STR)-link.spec
+  GCC_SPEC_FILES+=vxworks-crtbe-link.spec
 endif
 
 # PowerPC and e500v2 VxWorks 653
@@ -1024,6 +1027,8 @@ ifeq ($(strip $(filter-out arm% coff wrs vx%,$(target_cpu) $(target_vendor) $(ta
   EXTRA_GNATRTL_TASKING_OBJS=s-vxwork.o s-vxwext.o
 
   EXTRA_LIBGNAT_OBJS+=vx_stack_info.o
+
+  GCC_SPEC_FILES+=vxworks-crtbe-link.spec
 endif
 
 # MIPS VxWorks
index f417d39e657bfdd6e02cdeeaf43ef070d1864a94..36444ec010255ce25746c4889455f36412a39971 100644 (file)
@@ -10586,7 +10586,7 @@ statements (raise with no operand) are not permitted.
 [GNAT] This restriction ensures at compile time that no stream operations for
 types Exception_Id or Exception_Occurrence are used. This also makes it
 impossible to pass exceptions to or from a partition with this restriction
-in a distributed environment. If this exception is active, then the generated
+in a distributed environment. If this restriction is active, the generated
 code is simplified by omitting the otherwise-required global registration
 of exceptions when they are declared.
 
index 86704dc052a4b109e308d6899c810904f96d961a..44cdec48aa496de6d96b79a828c048dbbff4192e 100644 (file)
@@ -1445,11 +1445,11 @@ package body Inline is
             null;
 
          --  In GNATprove mode, issue a warning, and indicate that the
-         --  subprogram is not always inlined by setting flag Is_Inlined
+         --  subprogram is not always inlined by setting flag Is_Inlined_Always
          --  to False.
 
          elsif GNATprove_Mode then
-            Set_Is_Inlined (Subp, False);
+            Set_Is_Inlined_Always (Subp, False);
             Error_Msg_NE (Msg & "p?", N, Subp);
 
          elsif Has_Pragma_Inline_Always (Subp) then
@@ -1474,10 +1474,10 @@ package body Inline is
          Error_Msg_NE (Msg (Msg'First .. Msg'Last - 1), N, Subp);
 
       --  In GNATprove mode, issue a warning, and indicate that the subprogram
-      --  is not always inlined by setting flag Is_Inlined to False.
+      --  is not always inlined by setting flag Is_Inlined_Always to False.
 
       elsif GNATprove_Mode then
-         Set_Is_Inlined (Subp, False);
+         Set_Is_Inlined_Always (Subp, False);
          Error_Msg_NE (Msg & "p?", N, Subp);
 
       --  Do not issue errors/warnings when compiling with optimizations
@@ -1630,6 +1630,8 @@ package body Inline is
    --  Start of Can_Be_Inlined_In_GNATprove_Mode
 
    begin
+      pragma Assert (Present (Spec_Id) or else Present (Body_Id));
+
       if Present (Spec_Id) then
          Id := Spec_Id;
       else
@@ -1663,7 +1665,8 @@ package body Inline is
       --  body. Use the contract(s) instead in GNATprove.
 
       elsif (Present (Spec_Id) and then Has_Some_Contract (Spec_Id))
-        or else Has_Some_Contract (Body_Id)
+               or else
+            (Present (Body_Id) and then Has_Some_Contract (Body_Id))
       then
          return False;
 
@@ -1671,7 +1674,8 @@ package body Inline is
       --  prover level.
 
       elsif (Present (Spec_Id) and then Is_Expression_Function (Spec_Id))
-        or else Is_Expression_Function (Body_Id)
+              or else
+            (Present (Body_Id) and then Is_Expression_Function (Body_Id))
       then
          return False;
 
@@ -1684,8 +1688,10 @@ package body Inline is
       --  Only inline subprograms whose body is marked SPARK_Mode On. Other
       --  subprogram bodies should not be analyzed.
 
-      elsif No (SPARK_Pragma (Body_Id))
-        or else Get_SPARK_Mode_From_Pragma (SPARK_Pragma (Body_Id)) /= On
+      elsif Present (Body_Id)
+        and then (No (SPARK_Pragma (Body_Id))
+                   or else
+                  Get_SPARK_Mode_From_Pragma (SPARK_Pragma (Body_Id)) /= On)
       then
          return False;
 
@@ -2781,8 +2787,16 @@ package body Inline is
                if Is_Subprogram (P_Ent) then
                   Set_Is_Inlined (P_Ent, False);
 
+                  --  In GNATprove mode, issue a warning, and indicate that
+                  --  the subprogram is not always inlined by setting flag
+                  --  Is_Inlined_Always to False.
+
+                  if GNATprove_Mode then
+                     Set_Is_Inlined_Always (P_Ent, False);
+                  end if;
+
                   if Comes_From_Source (P_Ent)
-                    and then Has_Pragma_Inline (P_Ent)
+                    and then (Has_Pragma_Inline (P_Ent) or else GNATprove_Mode)
                   then
                      Cannot_Inline
                        ("cannot inline& (nested subprogram)?", N, P_Ent,
@@ -3519,6 +3533,15 @@ package body Inline is
       if In_Open_Scopes (Subp) then
          Error_Msg_N ("call to recursive subprogram cannot be inlined??", N);
          Set_Is_Inlined (Subp, False);
+
+         --  In GNATprove mode, issue a warning, and indicate that the
+         --  subprogram is not always inlined by setting flag Is_Inlined_Always
+         --  to False.
+
+         if GNATprove_Mode then
+            Set_Is_Inlined_Always (Subp, False);
+         end if;
+
          return;
 
       --  Skip inlining if this is not a true inlining since the attribute
@@ -3724,13 +3747,13 @@ package body Inline is
             --  inlining will not happen, and mark the subprogram as not always
             --  inlined.
 
-            if Expander_Active then
-               Error_Msg_N
-                 ("cannot inline call to recursive subprogram", N);
-            else
+            if GNATprove_Mode then
                Cannot_Inline
                  ("cannot inline call to recursive subprogram?", N, Subp);
-               Set_Is_Inlined (Subp, False);
+               Set_Is_Inlined_Always (Subp, False);
+            else
+               Error_Msg_N
+                 ("cannot inline call to recursive subprogram", N);
             end if;
 
             return;
index a4a95279524dbcc8c2dd85993768324cfb08340b..24ffd6ff58f0f9750a73a6f63bc981226d69d4f6 100644 (file)
@@ -238,8 +238,11 @@ package Inline is
    function Can_Be_Inlined_In_GNATprove_Mode
      (Spec_Id : Entity_Id;
       Body_Id : Entity_Id) return Boolean;
-   --  Returns True if the subprogram identified by Spec_Id (possibly Empty)
-   --  and Body_Id (not Empty) can be inlined in GNATprove mode. GNATprove
-   --  relies on this to adapt its treatment of the subprogram.
+   --  Returns True if the subprogram identified by Spec_Id and Body_Id can
+   --  be inlined in GNATprove mode. One but not both of Spec_Id and Body_Id
+   --  can be Empty. Body_Id is Empty when doing a partial check on a call
+   --  to a subprogram whose body has not been seen yet, to know whether this
+   --  subprogram could possibly be inlined. GNATprove relies on this to adapt
+   --  its treatment of the subprogram.
 
 end Inline;
index 7e7d52bb07bc8fc96ec55a47f14cdeed447ebdce..28677060aae0db44fc6180fc75bab5ddf161627f 100644 (file)
@@ -485,7 +485,6 @@ package body SPARK_Specific is
                   declare
                      Dummy : constant SPARK_Scope_Record :=
                                SPARK_Scope_Table.Table (Index);
-                     pragma Unreferenced (Dummy);
                   begin
                      return True;
                   end;
index 8cc8e2f6b83b42c3508d9dccb325ee0b720d1bab..a913884a6d760420229159c347a1ce189a1bfc25 100644 (file)
@@ -955,6 +955,14 @@ package body Lib.Xref is
          if Comes_From_Source (E) then
             Ent := E;
 
+         --  Because a declaration may be generated for a subprogram body
+         --  without declaration in GNATprove mode, for inlining, some
+         --  parameters may end up being marked as not coming from source
+         --  although they are. Take these into account specially.
+
+         elsif GNATprove_Mode and then Ekind (E) in Formal_Kind then
+            Ent := E;
+
          --  Entity does not come from source, but is a derived subprogram and
          --  the derived subprogram comes from source (after one or more
          --  derivations) in which case the reference is to parent subprogram.
index 7f7d060dcbef5a378b543408ebdbd71f6f67dfcf..3fde64d083ec8c03f65757ae40e654aca05c7935 100644 (file)
@@ -1434,8 +1434,6 @@ package body Makeutl is
          In_Tree : Project_Tree_Ref;
          Dummy   : in out Boolean)
       is
-         pragma Unreferenced (Dummy);
-
          Linker_Package : Package_Id;
          Options        : Variable_Value;
 
@@ -2621,7 +2619,6 @@ package body Makeutl is
          Iter         : Source_Iterator;
 
          Dummy : Boolean;
-         pragma Unreferenced (Dummy);
 
       begin
          if not Insert_No_Roots (Source) then
index 72395f84c6b215896cd52151a4c09108f4a5fad2..d7faeba8057cf0ab3e296c8a2e5dc867954df825 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 2001-2013, Free Software Foundation, Inc.         --
+--          Copyright (C) 2001-2014, 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- --
@@ -197,8 +197,6 @@ package body Osint.C is
 
    procedure Create_Output_Library_Info is
       Dummy : Boolean;
-      pragma Unreferenced (Dummy);
-
    begin
       Set_Library_Info_Name;
       Delete_File (Name_Buffer (1 .. Name_Len), Dummy);
index 0bb0eb192aa87bdfc93c78bd356330a17b62b868..763986084345cb73d9b0eae5285c1069db55f344 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 2001-2013, Free Software Foundation, Inc.         --
+--          Copyright (C) 2001-2014, 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- --
@@ -131,7 +131,6 @@ package body Prj.Env is
          In_Tree : Project_Tree_Ref;
          Dummy   : in out Boolean)
       is
-         pragma Unreferenced (Dummy);
       begin
          Add_To_Path
            (Project.Source_Dirs, In_Tree.Shared, Buffer, Buffer_Last);
@@ -201,7 +200,7 @@ package body Prj.Env is
          In_Tree : Project_Tree_Ref;
          Dummy   : in out Boolean)
       is
-         pragma Unreferenced (Dummy, In_Tree);
+         pragma Unreferenced (In_Tree);
 
          Path : constant Path_Name_Type :=
                   Get_Object_Directory
@@ -1259,7 +1258,7 @@ package body Prj.Env is
          Tree  : Project_Tree_Ref;
          Dummy : in out Integer)
       is
-         pragma Unreferenced (Dummy, Tree);
+         pragma Unreferenced (Tree);
 
       begin
          --  ??? Set_Ada_Paths has a different behavior for library project
@@ -1304,8 +1303,6 @@ package body Prj.Env is
          In_Tree : Project_Tree_Ref;
          Dummy   : in out Integer)
       is
-         pragma Unreferenced (Dummy);
-
          Current    : String_List_Id := Prj.Source_Dirs;
          The_String : String_Element;
 
@@ -1676,7 +1673,7 @@ package body Prj.Env is
          In_Tree : Project_Tree_Ref;
          Dummy   : in out Boolean)
       is
-         pragma Unreferenced (Dummy, In_Tree);
+         pragma Unreferenced (In_Tree);
 
          Path : Path_Name_Type;
 
index e4c7784297bf3514bafdea8cd9597a650f336f4f..0562587c60480a29e499fbc7467b544fe56db1f5 100644 (file)
@@ -1714,7 +1714,7 @@ package body Prj is
             Context : Project_Context;
             Dummy   : in out Boolean)
          is
-            pragma Unreferenced (Dummy, Tree);
+            pragma Unreferenced (Tree);
 
             List : Project_List;
             Prj2 : Project_Id;
index 8ecdd8c11e18d27104775f1f03e41759fc09413d..1f09a71be1f333d3b9e977e880185333116af180 100644 (file)
@@ -320,7 +320,6 @@ package body System.AST_Handling is
 
    procedure Allocate_New_AST_Server is
       Dummy : AST_Server_Task_Ptr;
-      pragma Unreferenced (Dummy);
 
    begin
       if Num_AST_Servers = Max_AST_Servers then
index 5e201235f3659c77639bf29476cbdc256b1c37cd..0fd29b125e96dbe4c20ce60c1d45a933d08af972 100644 (file)
@@ -325,7 +325,6 @@ package body System.AST_Handling is
 
    procedure Allocate_New_AST_Server is
       Dummy : AST_Server_Task_Ptr;
-      pragma Unreferenced (Dummy);
 
    begin
       if Num_AST_Servers = Max_AST_Servers then
index eec3a9da10d9adc17270426d617dcb40e757e968..52d12d5103f30d12fe1512d8c82c4e050a7ed048 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                  B o d y                                 --
 --                                                                          --
---         Copyright (C) 1992-2011, Free Software Foundation, Inc.          --
+--         Copyright (C) 1992-2014, Free Software Foundation, Inc.          --
 --                                                                          --
 -- GNARL is free software; you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -1298,7 +1298,6 @@ package body System.Task_Primitives.Operations is
       C           : Task_Id;
 
       Dummy : int;
-      pragma Unreferenced (Dummy);
 
    begin
       Dummy := Int_Lock;
index 5c084b584bd55b33051f8cc25c9325895aec550c..e2256f781f37d8f1f3bce2022cc00e0794e71a94 100644 (file)
@@ -77,10 +77,8 @@ package body System.Tasking.Debug is
    ------------------------
 
    procedure Continue_All_Tasks is
-      C : Task_Id;
-
+      C     : Task_Id;
       Dummy : Boolean;
-      pragma Unreferenced (Dummy);
 
    begin
       STPO.Lock_RTS;
@@ -218,7 +216,6 @@ package body System.Tasking.Debug is
    procedure Resume_All_Tasks (Thread_Self : OS_Interface.Thread_Id) is
       C     : Task_Id;
       Dummy : Boolean;
-      pragma Unreferenced (Dummy);
 
    begin
       STPO.Lock_RTS;
@@ -267,10 +264,8 @@ package body System.Tasking.Debug is
    --------------------
 
    procedure Stop_All_Tasks is
-      C : Task_Id;
-
+      C     : Task_Id;
       Dummy : Boolean;
-      pragma Unreferenced (Dummy);
 
    begin
       STPO.Lock_RTS;
@@ -300,7 +295,6 @@ package body System.Tasking.Debug is
    procedure Suspend_All_Tasks (Thread_Self : OS_Interface.Thread_Id) is
       C     : Task_Id;
       Dummy : Boolean;
-      pragma Unreferenced (Dummy);
 
    begin
       STPO.Lock_RTS;
index bc0ed547a50b8ba0e108f1a19c6baf515ffa191f..a597f73cee226b95b2b5fb42deb6b843fdb2d56d 100644 (file)
@@ -112,7 +112,7 @@ package body Sem_Aggr is
    --  expressions allowed for a limited component association (namely, an
    --  aggregate, function call, or <> notation). Report error for violations.
    --  Expression is also OK in an instance or inlining context, because we
-   --  have already analyzed and checked it.
+   --  have already pre-analyzed and it is known to be type correct.
 
    procedure Check_Qualified_Aggregate (Level : Nat; Expr : Node_Id);
    --  Given aggregate Expr, check that sub-aggregates of Expr that are nested
index bc4f1e21aacb8f08cf35a3496efa30995d81c7e2..b9a0fa6de39e0a6dc22d38f602a7ab25087da7bf 100644 (file)
@@ -7386,13 +7386,19 @@ package body Sem_Attr is
 
       --  If we are asked to evaluate an attribute where the prefix is a
       --  non-frozen generic actual type whose RM_Size is still set to zero,
-      --  then abandon the effort. It seems wrong that this can ever happen,
-      --  but we see it happen, so this is a defense! ???
+      --  then abandon the effort.
 
       if Is_Type (P_Entity)
         and then (not Is_Frozen (P_Entity)
                    and then Is_Generic_Actual_Type (P_Entity)
                    and then RM_Size (P_Entity) = 0)
+
+        --  However, the attribute Unconstrained_Array must be evaluated,
+        --  since it is documented to be a static attribute (and can for
+        --  example appear in a Compile_Time_Warning pragma). The frozen
+        --  status of the type does not affect its evaluation.
+
+        and then Id /= Attribute_Unconstrained_Array
       then
          return;
       end if;
index cd110c9d1857cbf24622df354739e217f0578a96..189695ce4bd8e3c0ed3b27ae261207bef81225db 100644 (file)
@@ -5694,13 +5694,11 @@ package body Sem_Ch10 is
             -------------------
 
             procedure Process_State (State : Node_Id) is
-               Loc  : constant Source_Ptr := Sloc (State);
-               Elmt : Node_Id;
-               Id   : Entity_Id;
-               Name : Name_Id;
-
+               Loc   : constant Source_Ptr := Sloc (State);
+               Elmt  : Node_Id;
+               Id    : Entity_Id;
+               Name  : Name_Id;
                Dummy : Entity_Id;
-               pragma Unreferenced (Dummy);
 
             begin
                --  Multiple abstract states appear as an aggregate
@@ -5709,9 +5707,9 @@ package body Sem_Ch10 is
                   Elmt := First (Expressions (State));
                   while Present (Elmt) loop
                      Process_State (Elmt);
-
                      Next (Elmt);
                   end loop;
+
                   return;
 
                --  A null state has no abstract view
index ad59f58c8e1a257dff0e6258c094f6830e4838fa..0e47f97f3c1448c4149bfc564bc8439c0dddb4e3 100644 (file)
@@ -2140,7 +2140,6 @@ package body Sem_Ch3 is
          Spec_Id   : Entity_Id;
 
          Dummy : Entity_Id;
-         pragma Unreferenced (Dummy);
          --  A dummy variable used to capture the unused result of subprogram
          --  spec analysis.
 
index c7b01b4b368666c761f99f91b18525d62def0fdc..393d557ad6ae8bbcd77b80cdf3b5ac035bbb7f58 100644 (file)
@@ -3512,7 +3512,6 @@ package body Sem_Ch6 is
            and then Can_Be_Inlined_In_GNATprove_Mode (Spec_Id, Body_Id)
            and then not Body_Has_Contract
          then
-            Set_Is_Inlined (Spec_Id, True);
             Build_Body_To_Inline (N, Spec_Id);
          end if;
 
@@ -3540,7 +3539,6 @@ package body Sem_Ch6 is
         and then Can_Be_Inlined_In_GNATprove_Mode (Spec_Id, Body_Id)
         and then not Body_Has_Contract
       then
-         Set_Is_Inlined (Spec_Id, True);
          Check_And_Build_Body_To_Inline (N, Spec_Id, Body_Id);
       end if;
 
@@ -3675,7 +3673,7 @@ package body Sem_Ch6 is
         and then Nkind (Parent (Parent (Spec_Id))) = N_Subprogram_Declaration
       then
          Set_Body_To_Inline (Parent (Parent (Spec_Id)), Empty);
-         Set_Is_Inlined (Spec_Id, False);
+         Set_Is_Inlined_Always (Spec_Id, False);
       end if;
 
       --  Check completion, and analyze the statements
@@ -4268,6 +4266,14 @@ package body Sem_Ch6 is
          Set_Etype (Designator, Standard_Void_Type);
       end if;
 
+      --  Flag Is_Inlined_Always is True by default, and reversed to False for
+      --  those subprograms which could be inlined in GNATprove mode (because
+      --  Body_To_Inline is non-Empty) but cannot be inlined.
+
+      if GNATprove_Mode then
+         Set_Is_Inlined_Always (Designator);
+      end if;
+
       --  Introduce new scope for analysis of the formals and the return type
 
       Set_Scope (Designator, Current_Scope);
index 6c41a4e5290d19f5c678f40a7d34b8e28a446fe5..9a83ca577efab340f6e6d9e76a8252d2e9c11610 100644 (file)
@@ -2128,7 +2128,7 @@ package body Sem_Eval is
          Alt := First (Alternatives (N));
          Search : loop
 
-            --  We must find a match among the alternatives, If not this must
+            --  We must find a match among the alternatives. If not, this must
             --  be due to other errors, so just ignore, leaving as non-static.
 
             if No (Alt) then
@@ -2381,7 +2381,7 @@ package body Sem_Eval is
          return;
       end if;
 
-      --  If condition raises constraint error then we have already signalled
+      --  If condition raises constraint error then we have already signaled
       --  an error, and we just propagate to the result and do not fold.
 
       if Raises_Constraint_Error (Condition) then
@@ -4980,9 +4980,9 @@ package body Sem_Eval is
       --  non-static or raise Constraint_Error, return Non_Static.
       --
       --  Otherwise check if the selecting expression matches any of the given
-      --  discrete choices. If so the alternative is executed and we return
-      --  Open, otherwise, the alternative can never be executed, and so we
-      --  return Closed.
+      --  discrete choices. If so, the alternative is executed and we return
+      --  Match, otherwise, the alternative can never be executed, and so we
+      --  return No_Match.
 
       ---------------------------------
       -- Check_Case_Expr_Alternative --
@@ -4998,7 +4998,7 @@ package body Sem_Eval is
       begin
          pragma Assert (Nkind (Case_Exp) = N_Case_Expression);
 
-         --  Check selecting expression is static
+         --  Check that selecting expression is static
 
          if not Is_OK_Static_Expression (Expression (Case_Exp)) then
             return Non_Static;
@@ -5014,7 +5014,7 @@ package body Sem_Eval is
          Choice := First (Discrete_Choices (CEA));
          while Present (Choice) loop
 
-            --  Check various possibilities for choice, returning Closed if we
+            --  Check various possibilities for choice, returning Match if we
             --  find the selecting value matches any of the choices. Note that
             --  we know we are the last choice, so we don't have to keep going.
 
@@ -5048,8 +5048,8 @@ package body Sem_Eval is
             Next (Choice);
          end loop;
 
-         --  If we get through that loop then all choices were static, and
-         --  none of them matched the selecting expression. So return Closed.
+         --  If we get through that loop then all choices were static, and none
+         --  of them matched the selecting expression. So return No_Match.
 
          return No_Match;
       end Check_Case_Expr_Alternative;
@@ -5125,11 +5125,11 @@ package body Sem_Eval is
 
          --  This refers to cases like
 
-         --    (if 1 then 1 elsif 1/0=2 then 2 else 3)
+         --    (if True then 1 elsif 1/0=2 then 2 else 3)
 
          --  But we expand elsif's out anyway, so the above looks like:
 
-         --    (if 1 then 1 else (if 1/0=2 then 2 else 3))
+         --    (if True then 1 else (if 1/0=2 then 2 else 3))
 
          --  So for us this is caught by the above check for the 32.3 case.
 
@@ -5287,7 +5287,7 @@ package body Sem_Eval is
         and then not In_Inlined_Body
         and then Ada_Version >= Ada_95
       then
-         --  No message if we are staticallly unevaluated
+         --  No message if we are statically unevaluated
 
          if Is_Statically_Unevaluated (N) then
             null;
index fd9dce0f21b744cea68ea4d0ee63941f74450b21..64d25295fae2595a7096b4bc9aeb703752a08666 100644 (file)
@@ -74,7 +74,7 @@ package Sem_Eval is
    --  definition, they are sometimes folded anyway, but of course in this case
    --  Is_Static_Expression is not set.
 
-   --  When we are analyzing and evaluating static expressions, we proopagate
+   --  When we are analyzing and evaluating static expressions, we propagate
    --  both flags accurately. Usually if a subexpression raises a constraint
    --  error, then so will its parent expression, and Raise_Constraint_Error
    --  will be propagated to this parent. The exception is conditional cases
index e68310b9776dcdb8fa47e286ae77298c76ba059a..88356fd61277ab5538d320be74505ee14ccfea02 100644 (file)
@@ -6210,6 +6210,7 @@ package body Sem_Res is
       if GNATprove_Mode
         and then Is_Overloadable (Nam)
         and then SPARK_Mode = On
+        and then Full_Analysis
       then
          --  Retrieve the body to inline from the ultimate alias of Nam, if
          --  there is one, otherwise calls that should be inlined end up not
@@ -6220,13 +6221,22 @@ package body Sem_Res is
             Decl : constant Node_Id := Unit_Declaration_Node (Nam_Alias);
          begin
             if Nkind (Decl) = N_Subprogram_Declaration
+              and then Can_Be_Inlined_In_GNATprove_Mode (Nam_Alias, Empty)
+              and then No (Corresponding_Body (Decl))
+            then
+               Error_Msg_NE
+                 ("?cannot inline call to & (body not seen yet)", N, Nam);
+               Set_Is_Inlined_Always (Nam_Alias, False);
+
+            elsif Nkind (Decl) = N_Subprogram_Declaration
               and then Present (Body_To_Inline (Decl))
+              and then Is_Inlined (Nam_Alias)
             then
                if Is_Potentially_Unevaluated (N) then
                   Error_Msg_NE ("?cannot inline call to &", N, Nam);
                   Error_Msg_N
                     ("\call appears in potentially unevaluated context", N);
-                  Set_Is_Inlined (Nam, False);
+                  Set_Is_Inlined_Always (Nam_Alias, False);
                else
                   Expand_Inlined_Call (N, Nam_Alias, Nam);
                end if;
index 5aa63a9558596ea441cf242639c3b1c4cdc54f30..487ac3a57fa1242dc4024a7fa04c733123691f9d 100644 (file)
@@ -10493,45 +10493,6 @@ package body Sem_Util is
       end if;
    end Is_Iterator;
 
-   ------------------
-   -- Is_Junk_Name --
-   ------------------
-
-   function Is_Junk_Name (N : Name_Id) return Boolean is
-      function Match (S : String) return Boolean;
-      --  Return true if substring S is found in Name_Buffer (1 .. Name_Len)
-
-      -----------
-      -- Match --
-      -----------
-
-      function Match (S : String) return Boolean is
-         Slen1 : constant Integer := S'Length - 1;
-
-      begin
-         for J in 1 .. Name_Len - S'Length + 1 loop
-            if Name_Buffer (J .. J + Slen1) = S then
-               return True;
-            end if;
-         end loop;
-
-         return False;
-      end Match;
-
-   --  Start of processing for Is_Junk_Name
-
-   begin
-      Get_Unqualified_Decoded_Name_String (N);
-      Set_All_Upper_Case;
-
-      return
-        Match ("DISCARD") or else
-        Match ("DUMMY")   or else
-        Match ("IGNORE")  or else
-        Match ("JUNK")    or else
-        Match ("UNUSED");
-   end Is_Junk_Name;
-
    ------------
    -- Is_LHS --
    ------------
index 68746d65bb05fd30ccd6de53b9eeaef14f414a93..f659b9859a1e9205f000bccbfb2bbf6f38bc22f3 100644 (file)
@@ -1203,16 +1203,6 @@ package Sem_Util is
    --  AI05-0139-2: Check whether Typ is one of the predefined interfaces in
    --  Ada.Iterator_Interfaces, or it is derived from one.
 
-   function Is_Junk_Name (N : Name_Id) return Boolean;
-   --  Returns True if the given name contains any of the following substrings
-   --    discard
-   --    dummy
-   --    ignore
-   --    junk
-   --    unused
-   --  Used to suppress warnings on names matching these patterns. The contents
-   --  of Name_Buffer and Name_Len are destroyed by this call.
-
    type Is_LHS_Result is (Yes, No, Unknown);
    function Is_LHS (N : Node_Id) return Is_LHS_Result;
    --  Returns Yes if N is definitely used as Name in an assignment statement.
index 8b47332be7e4ddb529d003225cd27e7b22cc677f..8db6835149785cdda87a1dc41d83dd6617d0b575 100644 (file)
@@ -128,6 +128,16 @@ package body Sem_Warn is
    --  If E is a parameter entity for a subprogram body, then this function
    --  returns the corresponding spec entity, if not, E is returned unchanged.
 
+   function Has_Junk_Name (E : Entity_Id) return Boolean;
+   --  Return True if the entity name contains any of the following substrings:
+   --    discard
+   --    dummy
+   --    ignore
+   --    junk
+   --    unused
+   --  Used to suppress warnings on names matching these patterns. The contents
+   --  of Name_Buffer and Name_Len are destroyed by this call.
+
    function Has_Pragma_Unmodified_Check_Spec (E : Entity_Id) return Boolean;
    --  Tests Has_Pragma_Unmodified flag for entity E. If E is not a formal,
    --  this is simply the setting of the flag Has_Pragma_Unmodified. If E is
@@ -1060,7 +1070,8 @@ package body Sem_Warn is
 
          --  We are only interested in source entities. We also don't issue
          --  warnings within instances, since the proper place for such
-         --  warnings is on the template when it is compiled.
+         --  warnings is on the template when it is compiled, and we don't
+         --  issue warnings for variables with names like Junk, Discard etc.
 
          if Comes_From_Source (E1)
            and then Instantiation_Location (Sloc (E1)) = No_Location
@@ -1145,7 +1156,9 @@ package body Sem_Warn is
                           and then not Has_Pragma_Unreferenced_Check_Spec (E1)
                           and then not Has_Pragma_Unmodified_Check_Spec (E1)
                         then
-                           if not Warnings_Off_E1 then
+                           if not Warnings_Off_E1
+                             and then not Has_Junk_Name (E1)
+                           then
                               Error_Msg_N -- CODEFIX
                                 ("?k?& is not modified, "
                                  & "could be declared constant!",
@@ -1267,7 +1280,11 @@ package body Sem_Warn is
                      --  the formal is not modified.
 
                      else
-                        In_Out_Warnings.Append (E1);
+                        --  Suppress the warnings for a junk name
+
+                        if not Has_Junk_Name (E1) then
+                           In_Out_Warnings.Append (E1);
+                        end if;
                      end if;
 
                   --  Other cases of formals
@@ -1277,6 +1294,7 @@ package body Sem_Warn is
                         if Referenced_Check_Spec (E1) then
                            if not Has_Pragma_Unmodified_Check_Spec (E1)
                              and then not Warnings_Off_E1
+                             and then not Has_Junk_Name (E1)
                            then
                               Output_Reference_Error
                                 ("?f?formal parameter& is read but "
@@ -1285,6 +1303,7 @@ package body Sem_Warn is
 
                         elsif not Has_Pragma_Unreferenced_Check_Spec (E1)
                           and then not Warnings_Off_E1
+                          and then not Has_Junk_Name (E1)
                         then
                            Output_Reference_Error
                              ("?f?formal parameter& is not referenced!");
@@ -1297,7 +1316,7 @@ package body Sem_Warn is
                      if Referenced (E1) then
                         if not Has_Unmodified (E1)
                           and then not Warnings_Off_E1
-                          and then not Is_Junk_Name (Chars (E1))
+                          and then not Has_Junk_Name (E1)
                         then
                            Output_Reference_Error
                              ("?v?variable& is read but never assigned!");
@@ -1306,7 +1325,7 @@ package body Sem_Warn is
 
                      elsif not Has_Unreferenced (E1)
                        and then not Warnings_Off_E1
-                       and then not Is_Junk_Name (Chars (E1))
+                       and then not Has_Junk_Name (E1)
                      then
                         Output_Reference_Error -- CODEFIX
                           ("?v?variable& is never read and never assigned!");
@@ -1373,7 +1392,9 @@ package body Sem_Warn is
                      if Nkind (UR) = N_Simple_Return_Statement
                        and then not Has_Pragma_Unmodified_Check_Spec (E1)
                      then
-                        if not Warnings_Off_E1 then
+                        if not Warnings_Off_E1
+                          and then not Has_Junk_Name (E1)
+                        then
                            Error_Msg_NE
                              ("?v?OUT parameter& not set before return",
                               UR, E1);
@@ -1593,7 +1614,9 @@ package body Sem_Warn is
                           (E1, Body_Formal (E1, Accept_Statement => Anod));
                      end if;
 
-                  elsif not Warnings_Off_E1 then
+                  elsif not Warnings_Off_E1
+                    and then not Has_Junk_Name (E1)
+                  then
                      Unreferenced_Entities.Append (E1);
                   end if;
                end if;
@@ -1609,7 +1632,7 @@ package body Sem_Warn is
               and then Instantiation_Depth (Sloc (E1)) = 0
               and then Warn_On_Redundant_Constructs
             then
-               if not Warnings_Off_E1 then
+               if not Warnings_Off_E1 and then not Has_Junk_Name (E1) then
                   Unreferenced_Entities.Append (E1);
 
                   --  Force warning on entity
@@ -1755,6 +1778,7 @@ package body Sem_Warn is
                                 (Sloc (N), Sloc (Unset_Reference (E))))
                  and then not Has_Pragma_Unmodified_Check_Spec (E)
                  and then not Warnings_Off_Check_Spec (E)
+                 and then not Has_Junk_Name (E)
                then
                   --  We may have an unset reference. The first test is whether
                   --  this is an access to a discriminant of a record or a
@@ -2660,6 +2684,44 @@ package body Sem_Warn is
       end if;
    end Goto_Spec_Entity;
 
+   -------------------
+   -- Has_Junk_Name --
+   -------------------
+
+   function Has_Junk_Name (E : Entity_Id) return Boolean is
+      function Match (S : String) return Boolean;
+      --  Return true if substring S is found in Name_Buffer (1 .. Name_Len)
+
+      -----------
+      -- Match --
+      -----------
+
+      function Match (S : String) return Boolean is
+         Slen1 : constant Integer := S'Length - 1;
+
+      begin
+         for J in 1 .. Name_Len - S'Length + 1 loop
+            if Name_Buffer (J .. J + Slen1) = S then
+               return True;
+            end if;
+         end loop;
+
+         return False;
+      end Match;
+
+   --  Start of processing for Has_Junk_Name
+
+   begin
+      Get_Unqualified_Decoded_Name_String (Chars (E));
+
+      return
+        Match ("discard") or else
+        Match ("dummy")   or else
+        Match ("ignore")  or else
+        Match ("junk")    or else
+        Match ("unused");
+   end Has_Junk_Name;
+
    --------------------------------------
    -- Has_Pragma_Unmodified_Check_Spec --
    --------------------------------------
@@ -3910,7 +3972,7 @@ package body Sem_Warn is
       if not Referenced_Check_Spec (E)
         and then not Has_Pragma_Unreferenced_Check_Spec (E)
         and then not Warnings_Off_Check_Spec (E)
-        and then not Is_Junk_Name (Chars (Spec_E))
+        and then not Has_Junk_Name (Spec_E)
       then
          case Ekind (E) is
             when E_Variable =>
@@ -4115,7 +4177,7 @@ package body Sem_Warn is
         and then not Is_Exported (Ent)
         and then Safe_To_Capture_Value (N, Ent)
         and then not Has_Pragma_Unreferenced_Check_Spec (Ent)
-        and then not Is_Junk_Name (Chars (Ent))
+        and then not Has_Junk_Name (Ent)
       then
          --  Before we issue the message, check covering exception handlers.
          --  Search up tree for enclosing statement sequences and handlers.
index e7418a8a58a5ab7b2883c1c6dcaa16e157ccb14c..3b455d29ffc00708c96045127d44ae7af33b3108 100644 (file)
@@ -115,6 +115,10 @@ package System is
 
 private
 
+   pragma Linker_Options ("--specs=vxworks-crtbe-link.spec");
+   --  Pull in crtbegin/crtend objects and register exceptions for ZCX.
+   --  This is commented out by our Makefile for SJLJ runtimes.
+
    type Address is mod Memory_Size;
    Null_Address : constant Address := 0;
 
@@ -151,6 +155,6 @@ private
    Always_Compatible_Rep     : constant Boolean := False;
    Suppress_Standard_Library : constant Boolean := False;
    Use_Ada_Main_Program_Name : constant Boolean := True;
-   ZCX_By_Default            : constant Boolean := False;
+   ZCX_By_Default            : constant Boolean := True;
 
 end System;
index 62d604f63192f2c1dbc77d0697a7f3edb822d8fb..94615777a0e19eb6ba0937994778e4f903b7df24 100644 (file)
@@ -7,7 +7,7 @@
 --                                 S p e c                                  --
 --                         (VxWorks 5 Version PPC)                          --
 --                                                                          --
---          Copyright (C) 1992-2012, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, Free Software Foundation, Inc.         --
 --                                                                          --
 -- This specification is derived from the Ada Reference Manual for use with --
 -- GNAT. The copyright notice above, and the license provisions that follow --
@@ -115,14 +115,12 @@ package System is
 
 private
 
-   --  Note: we now more closely rely on the VxWorks mechanisms to register
-   --  exception tables for ZCX support in kernel mode, thanks to crt objects
-   --  featuring dedicated constructors triggered by linker options below.
+   pragma Linker_Options ("--specs=vxworks-crtbe-link.spec");
+   --  Pull in crtbegin/crtend objects and register exceptions for ZCX.
+   --  This is commented out by our Makefile for SJLJ runtimes.
 
-   --  Commenting the pragma for the sjlj runtimes is performed automatically
-   --  by our Makefiles, so this line needs to be manipulated with care.
-
-   pragma Linker_Options ("-crtbe" & ASCII.NUL & "-auto-register");
+   pragma Linker_Options ("--specs=vxworks-ppc-link.spec");
+   --  Setup proper set of -L's for this configuration
 
    type Address is mod Memory_Size;
    Null_Address : constant Address := 0;
diff --git a/gcc/ada/vxworks-crtbe-link.spec b/gcc/ada/vxworks-crtbe-link.spec
new file mode 100644 (file)
index 0000000..8c4398d
--- /dev/null
@@ -0,0 +1,13 @@
+*self_spec:
++ %{!auto-register:%{!noauto-register:-auto-register}} \
+  %{!crtbe:%{!nocrtbe:-crtbe}}
+
+*startfile:
++ %{crtbe:%{!nocrtbe: \
+    %{!noauto-register:crtbegin.o%s} \
+    %{noauto-register:crtbeginT.o%s} \
+   }}
+
+*endfile:
++ %{crtbe:%{!nocrtbe:crtend.o%s}}
+
diff --git a/gcc/ada/vxworks-ppc-link.spec b/gcc/ada/vxworks-ppc-link.spec
new file mode 100644 (file)
index 0000000..8f6263c
--- /dev/null
@@ -0,0 +1,6 @@
+*lib:
++ %{mrtp:%{!shared: \
+     -L%:if-exists-else( \
+         %:getenv(WIND_BASE /target/lib/usr/lib/ppc/PPC32/common) \
+         %:getenv(WIND_BASE /target/usr/lib/ppc/PPC32/common)) \
+   }}