]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
2014-01-31 Robert Dewar <dewar@adacore.com>
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 31 Jan 2014 15:46:40 +0000 (15:46 +0000)
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 31 Jan 2014 15:46:40 +0000 (15:46 +0000)
* erroutc.adb (Validate_Specific_Warnings): Warnings are
controlled -gnatw.W.
* gnat_ugn.texi: Document new warnings controlled by -gnatw.w.
* opt.ads (Warn_On_Warnings_Off): Now controls more cases.

2014-01-31  Arnaud Charlet  <charlet@adacore.com>

* exp_disp.adb: Update comments.

2014-01-31  Yannick Moy  <moy@adacore.com>

* sem_ch12.adb (Analyze_Generic_Subprogram_Declaration,
Save_Global_References): Guard access to expression in aspect.

2014-01-31  Yannick Moy  <moy@adacore.com>

* sem_prag.adb (Analyze_Pragma/Pragma_SPARK_Mode):
Issue an error when the pragma is applied to a generic unit,
a generic declaration, or inside a generic.

2014-01-31  Yannick Moy  <moy@adacore.com>

* sem_ch8.adb (Analyze_Subprogram_Renaming): Set SPARK_Mode on renaming
entity.

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

gcc/ada/ChangeLog
gcc/ada/erroutc.adb
gcc/ada/exp_disp.adb
gcc/ada/gnat_ugn.texi
gcc/ada/opt.ads
gcc/ada/sem_ch12.adb
gcc/ada/sem_ch8.adb
gcc/ada/sem_prag.adb

index aa976653f2a37a20c0de7244198a860856d7b81e..12f5d5a70bf4f3f8ef219417cf67ae1316324c5a 100644 (file)
@@ -1,3 +1,30 @@
+2014-01-31  Robert Dewar  <dewar@adacore.com>
+
+       * erroutc.adb (Validate_Specific_Warnings): Warnings are
+       controlled -gnatw.W.
+       * gnat_ugn.texi: Document new warnings controlled by -gnatw.w.
+       * opt.ads (Warn_On_Warnings_Off): Now controls more cases.
+
+2014-01-31  Arnaud Charlet  <charlet@adacore.com>
+
+       * exp_disp.adb: Update comments.
+
+2014-01-31  Yannick Moy  <moy@adacore.com>
+
+       * sem_ch12.adb (Analyze_Generic_Subprogram_Declaration,
+       Save_Global_References): Guard access to expression in aspect.
+
+2014-01-31  Yannick Moy  <moy@adacore.com>
+
+       * sem_prag.adb (Analyze_Pragma/Pragma_SPARK_Mode):
+       Issue an error when the pragma is applied to a generic unit,
+       a generic declaration, or inside a generic.
+
+2014-01-31  Yannick Moy  <moy@adacore.com>
+
+       * sem_ch8.adb (Analyze_Subprogram_Renaming): Set SPARK_Mode on renaming
+       entity.
+
 2014-01-31  Robert Dewar  <dewar@adacore.com>
 
        * exp_ch9.adb, s-tassta.adb, s-tposen.adb, s-tposen.ads: Minor
index f70fc60d926ccfdbabcf62da3477b2c37248ce98..3387623b8ff7da53af95091895e2c95a5623a854 100644 (file)
@@ -1300,6 +1300,10 @@ package body Erroutc is
 
    procedure Validate_Specific_Warnings (Eproc : Error_Msg_Proc) is
    begin
+      if not Warn_On_Warnings_Off then
+         return;
+      end if;
+
       for J in Specific_Warnings.First .. Specific_Warnings.Last loop
          declare
             SWE : Specific_Warning_Entry renames Specific_Warnings.Table (J);
@@ -1311,7 +1315,7 @@ package body Erroutc is
 
                if SWE.Open then
                   Eproc.all
-                    ("?pragma Warnings Off with no matching Warnings On",
+                    ("?W?pragma Warnings Off with no matching Warnings On",
                      SWE.Start);
 
                --  Warn for ineffective Warnings (Off, ..)
@@ -1332,7 +1336,7 @@ package body Erroutc is
                    (SWE.Msg'Length > 2 and then SWE.Msg (1 .. 2) = "-W")
                then
                   Eproc.all
-                    ("?no warning suppressed by this pragma", SWE.Start);
+                    ("?W?no warning suppressed by this pragma", SWE.Start);
                end if;
             end if;
          end;
index 33275d506d7d2f5aebe3176580a5b041f75a6145..dca778cc64f9ea20c18e87b748ae7b9c1ebd360a 100644 (file)
@@ -3526,8 +3526,9 @@ package body Exp_Disp is
             --  entry protected types (in s-tposen). However, it was removed
             --  by also testing for no No_Select_Statements restriction in
             --  Exp_Utils.Corresponding_Runtime_Package. This simplified the
-            --  implementation of s-tposen, which was initially created for
-            --  the Ravenscar profile.
+            --  implementation of s-tposen.adb and provided consistency between
+            --  all versions of System.Tasking.Protected_Objects.Single_Entry
+            --  (s-tposen*.adb).
 
             case Corresponding_Runtime_Package (Conc_Typ) is
                when System_Tasking_Protected_Objects_Entries =>
index c5632d7844956e9aa10de28b27105b1e7de0e2df..b6d05cdb7af462d26800e35a0d3fe5efca19c2c7 100644 (file)
@@ -5690,7 +5690,7 @@ as shown in the following example.
 @end smallexample
 
 @item -gnatw.w
-@emph{Activate warnings on unnecessary Warnings Off pragmas}
+@emph{Activate warnings on Warnings Off pragmas}
 @cindex @option{-gnatw.w} (@command{gcc})
 @cindex Warnings Off control
 This switch activates warnings for use of @code{pragma Warnings (Off, entity)}
@@ -5698,12 +5698,14 @@ where either the pragma is entirely useless (because it suppresses no
 warnings), or it could be replaced by @code{pragma Unreferenced} or
 @code{pragma Unmodified}. The default is that these warnings are not given.
 Note that this warning is not included in -gnatwa, it must be
-activated explicitly.
+activated explicitly. Also activates warnings for the case of
+Warnings (Off, String), where either there is no matching
+Warnings (On, String), or the Warnings (Off) did not suppress any warning.
 
 @item -gnatw.W
 @emph{Suppress warnings on unnecessary Warnings Off pragmas}
 @cindex @option{-gnatw.W} (@command{gcc})
-This switch suppresses warnings for use of @code{pragma Warnings (Off, entity)}.
+This switch suppresses warnings for use of @code{pragma Warnings (Off, ...)}.
 
 @item -gnatwx
 @emph{Activate warnings on Export/Import pragmas.}
index f5349f55b2d3d6a0ad9d61b20c48b232010e6415..95f87e81629a46ef49725953a3052f7bf8963638 100644 (file)
@@ -1729,7 +1729,10 @@ package Opt is
    --  GNAT
    --  Set to True to generate warnings for use of Pragma Warnings (Off, ent),
    --  where either the pragma is never used, or it could be replaced by a
-   --  pragma Unmodified or Unreferenced. Modified by use of -gnatw.w/.W.
+   --  pragma Unmodified or Unreferenced. Also generates warnings for pragma
+   --  Warning (Off, string) which either has no matching pragma Warning On,
+   --  or where no warning has been suppressed by the use of the pragma.
+   --  Modified by use of -gnatw.w/.W.
 
    type Warning_Mode_Type is (Suppress, Normal, Treat_As_Error);
    Warning_Mode : Warning_Mode_Type := Normal;
index 4ddfdc56220a0def6860a17803727f79789be740..78881a9033477426499d51fd5527395c613eb575 100644 (file)
@@ -3251,7 +3251,9 @@ package body Sem_Ch12 is
          begin
             Aspect := First (Aspect_Specifications (N));
             while Present (Aspect) loop
-               if Get_Aspect_Id (Aspect) /= Aspect_Warnings then
+               if Get_Aspect_Id (Aspect) /= Aspect_Warnings
+                 and then Present (Expression (Aspect))
+               then
                   Analyze (Expression (Aspect));
                end if;
 
@@ -3260,7 +3262,10 @@ package body Sem_Ch12 is
 
             Aspect := First (Aspect_Specifications (Original_Node (N)));
             while Present (Aspect) loop
-               Save_Global_References (Expression (Aspect));
+               if Present (Expression (Aspect)) then
+                  Save_Global_References (Expression (Aspect));
+               end if;
+
                Next (Aspect);
             end loop;
          end;
@@ -13729,16 +13734,19 @@ package body Sem_Ch12 is
          end if;
 
          --  If a node has aspects, references within their expressions must
-         --  be saved separately, given that they are not directly in the
-         --  tree.
+         --  be saved separately, given they are not directly in the tree.
 
          if Has_Aspects (N) then
             declare
                Aspect : Node_Id;
+
             begin
                Aspect := First (Aspect_Specifications (N));
                while Present (Aspect) loop
-                  Save_Global_References (Expression (Aspect));
+                  if Present (Expression (Aspect)) then
+                     Save_Global_References (Expression (Aspect));
+                  end if;
+
                   Next (Aspect);
                end loop;
             end;
index 0868e01ab7968e2a42fb14acf18f3787c0f8d195..773929dcf3ab61e1e6b9d180211e7b67da02b695 100644 (file)
@@ -2386,6 +2386,11 @@ package body Sem_Ch8 is
          Set_Is_Pure (New_S, Is_Pure (Current_Scope));
       end if;
 
+      --  Set SPARK mode from current context
+
+      Set_SPARK_Pragma (New_S, SPARK_Mode_Pragma);
+      Set_SPARK_Pragma_Inherited (New_S, True);
+
       Rename_Spec := Find_Corresponding_Spec (N);
 
       --  Case of Renaming_As_Body
index a3711c8353ddbbbe208bc79a2035e6e7c0d36354..6e29b8b5fcdff1944b12df262fa74f8468c043fb 100644 (file)
@@ -19160,6 +19160,10 @@ package body Sem_Prag is
             Check_No_Identifiers;
             Check_At_Most_N_Arguments (1);
 
+            if Inside_A_Generic then
+               Error_Pragma ("incorrect placement of pragma% in a generic");
+            end if;
+
             --  Check the legality of the mode (no argument = ON)
 
             if Arg_Count = 1 then
@@ -19192,6 +19196,15 @@ package body Sem_Prag is
             elsif Nkind (Context) = N_Compilation_Unit then
                Check_Valid_Configuration_Pragma;
 
+               if Nkind (Unit (Context)) in N_Generic_Declaration
+                 or else (Present (Library_Unit (Context))
+                           and then Nkind (Unit (Library_Unit (Context))) in
+                                                        N_Generic_Declaration)
+               then
+                  Error_Pragma
+                    ("incorrect placement of pragma% in a generic unit");
+               end if;
+
                SPARK_Mode_Pragma := N;
                SPARK_Mode := Mode_Id;
 
@@ -19219,11 +19232,13 @@ package body Sem_Prag is
                   elsif not Comes_From_Source (Stmt) then
                      null;
 
+                  elsif Nkind (Stmt) in N_Generic_Declaration then
+                     Error_Pragma
+                       ("incorrect placement of pragma% on a generic");
+
                   --  The pragma applies to a package declaration
 
-                  elsif Nkind_In (Stmt, N_Generic_Package_Declaration,
-                                        N_Package_Declaration)
-                  then
+                  elsif Nkind (Stmt) = N_Package_Declaration then
                      Spec_Id := Defining_Entity (Stmt);
                      Check_Library_Level_Entity (Spec_Id);
                      Check_Pragma_Conformance
@@ -19239,9 +19254,7 @@ package body Sem_Prag is
 
                   --  The pragma applies to a subprogram declaration
 
-                  elsif Nkind_In (Stmt, N_Generic_Subprogram_Declaration,
-                                        N_Subprogram_Declaration)
-                  then
+                  elsif Nkind (Stmt) = N_Subprogram_Declaration then
                      Spec_Id := Defining_Entity (Stmt);
                      Check_Library_Level_Entity (Spec_Id);
                      Check_Pragma_Conformance