aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2014-01-31 16:46:40 +0100
committerArnaud Charlet <charlet@gcc.gnu.org>2014-01-31 16:46:40 +0100
commit74c101097fb411445f543989120d83f53de5e4b0 (patch)
tree4fda15b7420fcb4e776f65c08c1e8528e66d9d78
parentbdfb8ec4aaf389281c221776f8d2cfd965557cda (diff)
downloadgcc-74c101097fb411445f543989120d83f53de5e4b0.zip
gcc-74c101097fb411445f543989120d83f53de5e4b0.tar.gz
gcc-74c101097fb411445f543989120d83f53de5e4b0.tar.bz2
[multiple changes]
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. From-SVN: r207352
-rw-r--r--gcc/ada/ChangeLog27
-rw-r--r--gcc/ada/erroutc.adb8
-rw-r--r--gcc/ada/exp_disp.adb5
-rw-r--r--gcc/ada/gnat_ugn.texi8
-rw-r--r--gcc/ada/opt.ads5
-rw-r--r--gcc/ada/sem_ch12.adb18
-rw-r--r--gcc/ada/sem_ch8.adb5
-rw-r--r--gcc/ada/sem_prag.adb25
8 files changed, 82 insertions, 19 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index aa97665..12f5d5a 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,5 +1,32 @@
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
reformatting.
diff --git a/gcc/ada/erroutc.adb b/gcc/ada/erroutc.adb
index f70fc60..3387623 100644
--- a/gcc/ada/erroutc.adb
+++ b/gcc/ada/erroutc.adb
@@ -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;
diff --git a/gcc/ada/exp_disp.adb b/gcc/ada/exp_disp.adb
index 33275d5..dca778c 100644
--- a/gcc/ada/exp_disp.adb
+++ b/gcc/ada/exp_disp.adb
@@ -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 =>
diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi
index c5632d7..b6d05cd 100644
--- a/gcc/ada/gnat_ugn.texi
+++ b/gcc/ada/gnat_ugn.texi
@@ -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.}
diff --git a/gcc/ada/opt.ads b/gcc/ada/opt.ads
index f5349f5..95f87e8 100644
--- a/gcc/ada/opt.ads
+++ b/gcc/ada/opt.ads
@@ -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;
diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb
index 4ddfdc5..78881a9 100644
--- a/gcc/ada/sem_ch12.adb
+++ b/gcc/ada/sem_ch12.adb
@@ -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;
diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb
index 0868e01..773929d 100644
--- a/gcc/ada/sem_ch8.adb
+++ b/gcc/ada/sem_ch8.adb
@@ -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
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index a3711c8..6e29b8b 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -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