[multiple changes]

2014-05-21  Robert Dewar  <dewar@adacore.com>

	* gnat_ugn.texi: Clearly document -gnatw.g (GNAT warnings).
	Clearly document -gnatyg (GNAT style switches).
	* usage.adb: Add line line for -gnatw.g (GNAT warnings) More
	detail for line for -gnatyg (GNAT style switches) -gnatw.d/D is
	available for VMS after all.
	* warnsw.adb: Reorganize to eliminate duplicated code
	(Restore_Warnings): Add a couple of missing entries
	(Save_Warnings): Add a couple of missing entries.
	* warnsw.ads: Add missing entries to Warning_Record (not clear
	what the impact is).

2014-05-21  Robert Dewar  <dewar@adacore.com>

	* errout.adb (Set_Msg_Insertion_Warning): Handle ?*? (restriction
	warning) case.
	* errout.ads: Document ?*? (restriction warning) insertion.
	* erroutc.adb (Get_Warning_Tag): Deal with ?*? (restriction
	warning) case.
	* erroutc.ads: Document use of * for restriction warning tag.
	* restrict.adb (Restriction_Msg): Tag with ?*? instead of ??.

2014-05-21  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch9.adb (Push_Scope_And_Install_Discriminants): Do not
	make discriminants immediately visible when analyzing an aspect
	of a subtype declaration.
	(Uninstall_Discriminants): Do not apply to the entity in a
	subtype declaration.

From-SVN: r210693
This commit is contained in:
Arnaud Charlet 2014-05-21 13:05:25 +02:00
parent 632f2871ed
commit 17cf9038e1
11 changed files with 245 additions and 223 deletions

View file

@ -1,3 +1,34 @@
2014-05-21 Robert Dewar <dewar@adacore.com>
* gnat_ugn.texi: Clearly document -gnatw.g (GNAT warnings).
Clearly document -gnatyg (GNAT style switches).
* usage.adb: Add line line for -gnatw.g (GNAT warnings) More
detail for line for -gnatyg (GNAT style switches) -gnatw.d/D is
available for VMS after all.
* warnsw.adb: Reorganize to eliminate duplicated code
(Restore_Warnings): Add a couple of missing entries
(Save_Warnings): Add a couple of missing entries.
* warnsw.ads: Add missing entries to Warning_Record (not clear
what the impact is).
2014-05-21 Robert Dewar <dewar@adacore.com>
* errout.adb (Set_Msg_Insertion_Warning): Handle ?*? (restriction
warning) case.
* errout.ads: Document ?*? (restriction warning) insertion.
* erroutc.adb (Get_Warning_Tag): Deal with ?*? (restriction
warning) case.
* erroutc.ads: Document use of * for restriction warning tag.
* restrict.adb (Restriction_Msg): Tag with ?*? instead of ??.
2014-05-21 Ed Schonberg <schonberg@adacore.com>
* sem_ch9.adb (Push_Scope_And_Install_Discriminants): Do not
make discriminants immediately visible when analyzing an aspect
of a subtype declaration.
(Uninstall_Discriminants): Do not apply to the entity in a
subtype declaration.
2014-05-21 Ed Schonberg <schonberg@adacore.com> 2014-05-21 Ed Schonberg <schonberg@adacore.com>
* sem_util.adb: Code clean up. * sem_util.adb: Code clean up.

View file

@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2013, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2014, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
@ -2764,7 +2764,9 @@ package body Errout is
elsif P + 1 <= Text'Last elsif P + 1 <= Text'Last
and then (Text (P) in 'a' .. 'z' and then (Text (P) in 'a' .. 'z'
or else or else
Text (P) in 'A' .. 'Z') Text (P) in 'A' .. 'Z'
or else
Text (P) = '*')
and then Text (P + 1) = C and then Text (P + 1) = C
then then
Warning_Msg_Char := Text (P); Warning_Msg_Char := Text (P);

View file

@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 1992-2013, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2014, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
@ -60,10 +60,12 @@ package Errout is
-- Exception raised if Raise_Exception_On_Error is true -- Exception raised if Raise_Exception_On_Error is true
Warning_Doc_Switch : Boolean renames Err_Vars.Warning_Doc_Switch; Warning_Doc_Switch : Boolean renames Err_Vars.Warning_Doc_Switch;
-- If this is set True, then the ??/?x?/?X? sequences in error messages -- If this is set True, then the ??/?*?/?x?/?X? sequences in error messages
-- are active (see errout.ads for details). If this switch is False, then -- generate appropriate tags for the output error messages. If this switch
-- these sequences are ignored (i.e. simply equivalent to a single ?). The -- is False, then these sequences are still recognized (for the purposes
-- -gnatw.d switch sets this flag True, -gnatw.D sets this flag False. -- of implementing pragmas Warnings (Off,..) and Warning_As_Pragma(...) but
-- do not result in adding the error message tag. The -gnatw.d switch sets
-- this flag True, -gnatw.D sets this flag False.
----------------------------------- -----------------------------------
-- Suppression of Error Messages -- -- Suppression of Error Messages --
@ -281,7 +283,7 @@ package Errout is
-- messages, and the usual style is to include it, since it makes it -- messages, and the usual style is to include it, since it makes it
-- clear that the continuation is part of a warning message. -- clear that the continuation is part of a warning message.
-- --
-- Note: this usage is obsolete, use ??, ?x? or ?X? instead to specify -- Note: this usage is obsolete, use ?? ?*? ?x? ?X? instead to specify
-- the string to be added when Warn_Doc_Switch is set to True. If this -- the string to be added when Warn_Doc_Switch is set to True. If this
-- switch is True, then for simple ? messages it has no effect. This -- switch is True, then for simple ? messages it has no effect. This
-- simple form is to ease transition and will be removed later. -- simple form is to ease transition and will be removed later.
@ -302,6 +304,11 @@ package Errout is
-- letter corresponding to the lower case letter x in the message. -- letter corresponding to the lower case letter x in the message.
-- For continuations, use this on each continuation message. -- For continuations, use this on each continuation message.
-- Insertion character ?*? (restriction warning)
-- Like ?, but if the flag Warn_Doc_Switch is True, adds the string
-- "[restriction warning]" at the end of the warning message. For
-- continuations, use this on each continuation message.
-- Insertion character < (Less Than: conditional warning message) -- Insertion character < (Less Than: conditional warning message)
-- The character < appearing anywhere in a message is used for a -- The character < appearing anywhere in a message is used for a
-- conditional error message. If Error_Msg_Warn is True, then the -- conditional error message. If Error_Msg_Warn is True, then the

View file

@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2013, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2014, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
@ -310,6 +310,8 @@ package body Erroutc is
if Warn and then Warn_Chr /= ' ' then if Warn and then Warn_Chr /= ' ' then
if Warn_Chr = '?' then if Warn_Chr = '?' then
return "[enabled by default]"; return "[enabled by default]";
elsif Warn_Chr = '*' then
return "[restriction warning]";
elsif Warn_Chr in 'a' .. 'z' then elsif Warn_Chr in 'a' .. 'z' then
return "[-gnatw" & Warn_Chr & ']'; return "[-gnatw" & Warn_Chr & ']';
else pragma Assert (Warn_Chr in 'A' .. 'Z'); else pragma Assert (Warn_Chr in 'A' .. 'Z');

View file

@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 1992-2013, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2014, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
@ -64,10 +64,11 @@ package Erroutc is
Warning_Msg_Char : Character; Warning_Msg_Char : Character;
-- Warning character, valid only if Is_Warning_Msg is True -- Warning character, valid only if Is_Warning_Msg is True
-- ' ' -- ? appeared on its own in message -- ' ' -- ? appeared on its own in message
-- '?' -- ?? appeared in message -- '?' -- ?? appeared in message
-- 'x' -- ?x? appeared in message -- 'x' -- ?x? appeared in message (x = a .. z)
-- 'X' -- ?x? appeared in message (X is upper case of x) -- 'X' -- ?X? appeared in message (X = A .. Z)
-- '*' -- ?*? appeared in message
Is_Style_Msg : Boolean := False; Is_Style_Msg : Boolean := False;
-- Set True to indicate if the current message is a style message -- Set True to indicate if the current message is a style message
@ -201,10 +202,11 @@ package Erroutc is
Warn_Chr : Character; Warn_Chr : Character;
-- Warning character (note: set even if Warning_Doc_Switch is False) -- Warning character (note: set even if Warning_Doc_Switch is False)
-- ' ' -- ? appeared on its own in message or no ? in message -- ' ' -- ? appeared on its own in message
-- '?' -- ?? appeared in message -- '?' -- ?? appeared in message
-- 'x' -- ?x? appeared in message -- 'x' -- ?x? appeared in message (x = a .. z)
-- 'X' -- ?x? appeared in message (X is upper case of x) -- 'X' -- ?X? appeared in message (X = A .. Z)
-- '*' -- ?*? appeared in message
Style : Boolean; Style : Boolean;
-- True if style message (starts with "(style)") -- True if style message (starts with "(style)")

View file

@ -4018,7 +4018,7 @@ Internal GNAT implementation mode. This should not be used for
applications programs, it is intended only for use by the compiler applications programs, it is intended only for use by the compiler
and its run-time library. For documentation, see the GNAT sources. and its run-time library. For documentation, see the GNAT sources.
Note that @option{^-gnatg^/GNAT_INTERNAL^} implies Note that @option{^-gnatg^/GNAT_INTERNAL^} implies
@option{^-gnatwae^/WARNINGS=ALL,ERRORS^} and @option{^-gnatw.ge^/WARNINGS=GNAT,ERRORS^} and
@option{^-gnatyg^/STYLE_CHECKS=GNAT^} @option{^-gnatyg^/STYLE_CHECKS=GNAT^}
so that all standard warnings and all standard style options are turned on. so that all standard warnings and all standard style options are turned on.
All warnings and style messages are treated as errors. All warnings and style messages are treated as errors.
@ -5167,6 +5167,14 @@ Manual requirement that such warnings appear).
@cindex @option{-gnatwG} (@command{gcc}) @cindex @option{-gnatwG} (@command{gcc})
This switch suppresses warnings for unrecognized pragmas. This switch suppresses warnings for unrecognized pragmas.
@item -gnatw.g
@emph{Warnings used for GNAT sources}
@cindex @option{-gnatw.g} (@command{gcc})
This switch sets the warning categories that are used by the standard
GNAT style. Currently this is equivalent to
@option{-gnatwAao.sI.C.V.X}
but more warnings may be added in the future without advanced notice.
@item -gnatwh @item -gnatwh
@emph{Activate warnings on hiding.} @emph{Activate warnings on hiding.}
@cindex @option{-gnatwh} (@command{gcc}) @cindex @option{-gnatwh} (@command{gcc})
@ -6381,7 +6389,9 @@ in the source text.
@emph{GNAT style mode.} @emph{GNAT style mode.}
The set of style check switches is set to match that used by the GNAT sources. The set of style check switches is set to match that used by the GNAT sources.
This may be useful when developing code that is eventually intended to be This may be useful when developing code that is eventually intended to be
incorporated into GNAT. For further details, see GNAT sources. incorporated into GNAT. Currently this is equivalent to @option{-gnatwydISux})
but additional style switches may be added to this set in the future without
advance notice.
@item ^h^HTABS^ @item ^h^HTABS^
@emph{No horizontal tabs.} @emph{No horizontal tabs.}

View file

@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2013, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2014, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
@ -1047,7 +1047,7 @@ package body Restrict is
-- Set warning message if warning -- Set warning message if warning
if Restriction_Warnings (R) then if Restriction_Warnings (R) then
Add_Str ("??"); Add_Str ("?*?");
-- If real violation (not warning), then mark it as non-serious unless -- If real violation (not warning), then mark it as non-serious unless
-- it is a violation of No_Finalization in which case we leave it as a -- it is a violation of No_Finalization in which case we leave it as a

View file

@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2013, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2014, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
@ -3447,7 +3447,13 @@ package body Sem_Ch9 is
begin begin
if Has_Discriminants (E) then if Has_Discriminants (E) then
Push_Scope (E); Push_Scope (E);
Install_Discriminants (E);
-- Make discriminants visible for type declarations and protected
-- type declarations, not for subtype declarations (RM 13.1.1 (12/3))
if Nkind (Parent (E)) /= N_Subtype_Declaration then
Install_Discriminants (E);
end if;
end if; end if;
end Push_Scope_And_Install_Discriminants; end Push_Scope_And_Install_Discriminants;
@ -3461,40 +3467,45 @@ package body Sem_Ch9 is
Outer : Entity_Id; Outer : Entity_Id;
begin begin
Disc := First_Discriminant (E); -- Discriminants have been made visible for type declarations and
while Present (Disc) loop -- protected type declarations, not for subtype declarations.
if Disc /= Current_Entity (Disc) then
Prev := Current_Entity (Disc); if Nkind (Parent (E)) /= N_Subtype_Declaration then
while Present (Prev) Disc := First_Discriminant (E);
and then Present (Homonym (Prev)) while Present (Disc) loop
and then Homonym (Prev) /= Disc if Disc /= Current_Entity (Disc) then
loop Prev := Current_Entity (Disc);
Prev := Homonym (Prev); while Present (Prev)
and then Present (Homonym (Prev))
and then Homonym (Prev) /= Disc
loop
Prev := Homonym (Prev);
end loop;
else
Prev := Empty;
end if;
Set_Is_Immediately_Visible (Disc, False);
Outer := Homonym (Disc);
while Present (Outer) and then Scope (Outer) = E loop
Outer := Homonym (Outer);
end loop; end loop;
else
Prev := Empty;
end if;
Set_Is_Immediately_Visible (Disc, False); -- Reset homonym link of other entities, but do not modify link
-- between entities in current scope, so that the back-end can
-- have a proper count of local overloadings.
Outer := Homonym (Disc); if No (Prev) then
while Present (Outer) and then Scope (Outer) = E loop Set_Name_Entity_Id (Chars (Disc), Outer);
Outer := Homonym (Outer);
elsif Scope (Prev) /= Scope (Disc) then
Set_Homonym (Prev, Outer);
end if;
Next_Discriminant (Disc);
end loop; end loop;
end if;
-- Reset homonym link of other entities, but do not modify link
-- between entities in current scope, so that the back-end can have
-- a proper count of local overloadings.
if No (Prev) then
Set_Name_Entity_Id (Chars (Disc), Outer);
elsif Scope (Prev) /= Scope (Disc) then
Set_Homonym (Prev, Outer);
end if;
Next_Discriminant (Disc);
end loop;
end Uninstall_Discriminants; end Uninstall_Discriminants;
------------------------------------------- -------------------------------------------

View file

@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2013, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2014, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
@ -121,8 +121,8 @@ begin
Write_Eol; Write_Eol;
-- Individual lines for switches. Write_Switch_Char outputs fourteen -- Individual lines for switches. Write_Switch_Char outputs fourteen
-- characters, so the remaining message is allowed to be a maximum -- characters, so the remaining message is allowed to be a maximum of
-- of 65 characters to be comfortable in an 80 character window. -- 65 characters to be comfortable in an 80 character window.
-- Line for -gnata switch -- Line for -gnata switch
@ -494,16 +494,8 @@ begin
Write_Line (" .C* turn off warnings for unrepped components"); Write_Line (" .C* turn off warnings for unrepped components");
Write_Line (" d turn on warnings for implicit dereference"); Write_Line (" d turn on warnings for implicit dereference");
Write_Line (" D* turn off warnings for implicit dereference"); Write_Line (" D* turn off warnings for implicit dereference");
Write_Line (" .d turn on tagging of warnings with -gnatw switch");
-- Switches -gnatw.d/w.D not available on VMS Write_Line (" .D* turn off tagging of warnings with -gnatw switch");
if not OpenVMS_On_Target then
Write_Line
(" .d turn on tagging of warnings with -gnatw switch");
Write_Line
(" .D* turn off tagging of warnings with -gnatw switch");
end if;
Write_Line (" e treat all warnings (but not info) as errors"); Write_Line (" e treat all warnings (but not info) as errors");
Write_Line (" .e turn on every optional info/warning " & Write_Line (" .e turn on every optional info/warning " &
"(no exceptions)"); "(no exceptions)");
@ -511,6 +503,7 @@ begin
Write_Line (" F* turn off warnings for unreferenced formal"); Write_Line (" F* turn off warnings for unreferenced formal");
Write_Line (" g*+ turn on warnings for unrecognized pragma"); Write_Line (" g*+ turn on warnings for unrecognized pragma");
Write_Line (" G turn off warnings for unrecognized pragma"); Write_Line (" G turn off warnings for unrecognized pragma");
Write_Line (" .g turn on GNAT warnings, same as Aao.sI.C.V.X");
Write_Line (" h turn on warnings for hiding declarations"); Write_Line (" h turn on warnings for hiding declarations");
Write_Line (" H* turn off warnings for hiding declarations"); Write_Line (" H* turn off warnings for hiding declarations");
Write_Line (" .h turn on warnings for holes in records"); Write_Line (" .h turn on warnings for holes in records");
@ -640,7 +633,7 @@ begin
Write_Line (" d check no DOS line terminators"); Write_Line (" d check no DOS line terminators");
Write_Line (" e check end/exit labels present"); Write_Line (" e check end/exit labels present");
Write_Line (" f check no form feeds/vertical tabs in source"); Write_Line (" f check no form feeds/vertical tabs in source");
Write_Line (" g check standard GNAT style rules"); Write_Line (" g check standard GNAT style rules, same as ydISux");
Write_Line (" h check no horizontal tabs in source"); Write_Line (" h check no horizontal tabs in source");
Write_Line (" i check if-then layout"); Write_Line (" i check if-then layout");
Write_Line (" I check mode in"); Write_Line (" I check mode in");

View file

@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1999-2013, Free Software Foundation, Inc. -- -- Copyright (C) 1999-2014, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
@ -29,6 +29,65 @@ with Output; use Output;
package body Warnsw is package body Warnsw is
-- Local Subprograms
procedure All_Warnings (Setting : Boolean);
-- Sets all warnings off if Setting = False, and on if Setting = True
procedure WA_Warnings;
-- Turn on all warnings set by -gnatwa (also used by -gnatw.g)
------------------
-- All_Warnings --
------------------
procedure All_Warnings (Setting : Boolean) is
begin
Address_Clause_Overlay_Warnings := Setting;
Check_Unreferenced := Setting;
Check_Unreferenced_Formals := Setting;
Check_Withs := Setting;
Constant_Condition_Warnings := Setting;
Elab_Warnings := Setting;
Implementation_Unit_Warnings := Setting;
Ineffective_Inline_Warnings := Setting;
List_Body_Required_Info := Setting;
List_Inherited_Aspects := Setting;
Warn_On_Ada_2005_Compatibility := Setting;
Warn_On_Ada_2012_Compatibility := Setting;
Warn_On_All_Unread_Out_Parameters := Setting;
Warn_On_Assertion_Failure := Setting;
Warn_On_Assumed_Low_Bound := Setting;
Warn_On_Atomic_Synchronization := Setting;
Warn_On_Bad_Fixed_Value := Setting;
Warn_On_Biased_Representation := Setting;
Warn_On_Constant := Setting;
Warn_On_Deleted_Code := Setting;
Warn_On_Dereference := Setting;
Warn_On_Export_Import := Setting;
Warn_On_Hiding := Setting;
Warn_On_Modified_Unread := Setting;
Warn_On_No_Value_Assigned := Setting;
Warn_On_Non_Local_Exception := Setting;
Warn_On_Object_Renames_Function := Setting;
Warn_On_Obsolescent_Feature := Setting;
Warn_On_Overlap := Setting;
Warn_On_Overridden_Size := Setting;
Warn_On_Parameter_Order := Setting;
Warn_On_Questionable_Missing_Parens := Setting;
Warn_On_Record_Holes := Setting;
Warn_On_Redundant_Constructs := Setting;
Warn_On_Reverse_Bit_Order := Setting;
Warn_On_Standard_Redefinition := Setting;
Warn_On_Suspicious_Contract := Setting;
Warn_On_Suspicious_Modulus_Value := Setting;
Warn_On_Unchecked_Conversion := Setting;
Warn_On_Unordered_Enumeration_Type := Setting;
Warn_On_Unrecognized_Pragma := Setting;
Warn_On_Unrepped_Components := Setting;
Warn_On_Warnings_Off := Setting;
end All_Warnings;
---------------------- ----------------------
-- Restore_Warnings -- -- Restore_Warnings --
---------------------- ----------------------
@ -57,6 +116,8 @@ package body Warnsw is
W.List_Body_Required_Info; W.List_Body_Required_Info;
List_Inherited_Aspects := List_Inherited_Aspects :=
W.List_Inherited_Aspects; W.List_Inherited_Aspects;
No_Warn_On_Non_Local_Exception :=
W.No_Warn_On_Non_Local_Exception;
Warning_Doc_Switch := Warning_Doc_Switch :=
W.Warning_Doc_Switch; W.Warning_Doc_Switch;
Warn_On_Ada_2005_Compatibility := Warn_On_Ada_2005_Compatibility :=
@ -155,6 +216,8 @@ package body Warnsw is
List_Body_Required_Info; List_Body_Required_Info;
W.List_Inherited_Aspects := W.List_Inherited_Aspects :=
List_Inherited_Aspects; List_Inherited_Aspects;
W.No_Warn_On_Non_Local_Exception :=
No_Warn_On_Non_Local_Exception;
W.Warning_Doc_Switch := W.Warning_Doc_Switch :=
Warning_Doc_Switch; Warning_Doc_Switch;
W.Warn_On_Ada_2005_Compatibility := W.Warn_On_Ada_2005_Compatibility :=
@ -221,7 +284,6 @@ package body Warnsw is
Warn_On_Unrepped_Components; Warn_On_Unrepped_Components;
W.Warn_On_Warnings_Off := W.Warn_On_Warnings_Off :=
Warn_On_Warnings_Off; Warn_On_Warnings_Off;
return W; return W;
end Save_Warnings; end Save_Warnings;
@ -257,48 +319,7 @@ package body Warnsw is
Warning_Doc_Switch := False; Warning_Doc_Switch := False;
when 'e' => when 'e' =>
Address_Clause_Overlay_Warnings := True; All_Warnings (True);
Check_Unreferenced := True;
Check_Unreferenced_Formals := True;
Check_Withs := True;
Constant_Condition_Warnings := True;
Elab_Warnings := True;
Implementation_Unit_Warnings := True;
Ineffective_Inline_Warnings := True;
List_Body_Required_Info := True;
List_Inherited_Aspects := True;
Warn_On_Ada_2005_Compatibility := True;
Warn_On_Ada_2012_Compatibility := True;
Warn_On_All_Unread_Out_Parameters := True;
Warn_On_Assertion_Failure := True;
Warn_On_Assumed_Low_Bound := True;
Warn_On_Atomic_Synchronization := True;
Warn_On_Bad_Fixed_Value := True;
Warn_On_Biased_Representation := True;
Warn_On_Constant := True;
Warn_On_Deleted_Code := True;
Warn_On_Dereference := True;
Warn_On_Export_Import := True;
Warn_On_Hiding := True;
Warn_On_Modified_Unread := True;
Warn_On_No_Value_Assigned := True;
Warn_On_Non_Local_Exception := True;
Warn_On_Object_Renames_Function := True;
Warn_On_Obsolescent_Feature := True;
Warn_On_Overlap := True;
Warn_On_Overridden_Size := True;
Warn_On_Parameter_Order := True;
Warn_On_Questionable_Missing_Parens := True;
Warn_On_Record_Holes := True;
Warn_On_Redundant_Constructs := True;
Warn_On_Reverse_Bit_Order := True;
Warn_On_Standard_Redefinition := True;
Warn_On_Suspicious_Contract := True;
Warn_On_Unchecked_Conversion := True;
Warn_On_Unordered_Enumeration_Type := True;
Warn_On_Unrecognized_Pragma := True;
Warn_On_Unrepped_Components := True;
Warn_On_Warnings_Off := True;
when 'g' => when 'g' =>
Set_GNAT_Mode_Warnings; Set_GNAT_Mode_Warnings;
@ -417,48 +438,23 @@ package body Warnsw is
procedure Set_GNAT_Mode_Warnings is procedure Set_GNAT_Mode_Warnings is
begin begin
-- Set -gnatwa warnings and no others
All_Warnings (False);
WA_Warnings;
-- These warnings are added to the -gnatwa set
Address_Clause_Overlay_Warnings := True; Address_Clause_Overlay_Warnings := True;
Check_Unreferenced := True;
Check_Unreferenced_Formals := True;
Check_Withs := True;
Constant_Condition_Warnings := True;
Elab_Warnings := False;
Implementation_Unit_Warnings := False;
Ineffective_Inline_Warnings := True;
List_Body_Required_Info := False;
List_Inherited_Aspects := False;
Warning_Doc_Switch := False;
Warn_On_Ada_2005_Compatibility := True;
Warn_On_Ada_2012_Compatibility := True;
Warn_On_All_Unread_Out_Parameters := False;
Warn_On_Assertion_Failure := True;
Warn_On_Assumed_Low_Bound := True;
Warn_On_Atomic_Synchronization := False;
Warn_On_Bad_Fixed_Value := True;
Warn_On_Biased_Representation := True;
Warn_On_Constant := True;
Warn_On_Deleted_Code := False;
Warn_On_Dereference := False;
Warn_On_Export_Import := True;
Warn_On_Hiding := False;
Warn_On_Modified_Unread := True;
Warn_On_No_Value_Assigned := True;
Warn_On_Non_Local_Exception := False;
Warn_On_Object_Renames_Function := True;
Warn_On_Obsolescent_Feature := True;
Warn_On_Overlap := True;
Warn_On_Overridden_Size := True; Warn_On_Overridden_Size := True;
Warn_On_Parameter_Order := True;
Warn_On_Questionable_Missing_Parens := True; -- These warnings are removed from the -gnatwa set
Warn_On_Record_Holes := False;
Warn_On_Redundant_Constructs := True; Implementation_Unit_Warnings := False;
Warn_On_Non_Local_Exception := False;
No_Warn_On_Non_Local_Exception := True;
Warn_On_Reverse_Bit_Order := False; Warn_On_Reverse_Bit_Order := False;
Warn_On_Suspicious_Contract := True;
Warn_On_Unchecked_Conversion := True;
Warn_On_Unordered_Enumeration_Type := False;
Warn_On_Unrecognized_Pragma := True;
Warn_On_Unrepped_Components := False; Warn_On_Unrepped_Components := False;
Warn_On_Warnings_Off := False;
end Set_GNAT_Mode_Warnings; end Set_GNAT_Mode_Warnings;
------------------------ ------------------------
@ -469,80 +465,10 @@ package body Warnsw is
begin begin
case C is case C is
when 'a' => when 'a' =>
Check_Unreferenced := True; WA_Warnings;
Check_Unreferenced_Formals := True;
Check_Withs := True;
Constant_Condition_Warnings := True;
Implementation_Unit_Warnings := True;
Ineffective_Inline_Warnings := True;
Warn_On_Ada_2005_Compatibility := True;
Warn_On_Ada_2012_Compatibility := True;
Warn_On_Assertion_Failure := True;
Warn_On_Assumed_Low_Bound := True;
Warn_On_Bad_Fixed_Value := True;
Warn_On_Biased_Representation := True;
Warn_On_Constant := True;
Warn_On_Export_Import := True;
Warn_On_Modified_Unread := True;
Warn_On_No_Value_Assigned := True;
Warn_On_Non_Local_Exception := True;
Warn_On_Object_Renames_Function := True;
Warn_On_Obsolescent_Feature := True;
Warn_On_Overlap := True;
Warn_On_Parameter_Order := True;
Warn_On_Questionable_Missing_Parens := True;
Warn_On_Redundant_Constructs := True;
Warn_On_Reverse_Bit_Order := True;
Warn_On_Suspicious_Contract := True;
Warn_On_Unchecked_Conversion := True;
Warn_On_Unrecognized_Pragma := True;
Warn_On_Unrepped_Components := True;
when 'A' => when 'A' =>
Address_Clause_Overlay_Warnings := False; All_Warnings (False);
Check_Unreferenced := False;
Check_Unreferenced_Formals := False;
Check_Withs := False;
Constant_Condition_Warnings := False;
Elab_Warnings := False;
Implementation_Unit_Warnings := False;
Ineffective_Inline_Warnings := False;
List_Body_Required_Info := False;
List_Inherited_Aspects := False;
Warning_Doc_Switch := False;
Warn_On_Ada_2005_Compatibility := False;
Warn_On_Ada_2012_Compatibility := False;
Warn_On_All_Unread_Out_Parameters := False;
Warn_On_Assertion_Failure := False;
Warn_On_Assumed_Low_Bound := False;
Warn_On_Bad_Fixed_Value := False;
Warn_On_Biased_Representation := False;
Warn_On_Constant := False;
Warn_On_Deleted_Code := False;
Warn_On_Dereference := False;
Warn_On_Export_Import := False;
Warn_On_Hiding := False;
Warn_On_Modified_Unread := False;
Warn_On_No_Value_Assigned := False;
Warn_On_Non_Local_Exception := False;
Warn_On_Object_Renames_Function := False;
Warn_On_Obsolescent_Feature := False;
Warn_On_Overlap := False;
Warn_On_Overridden_Size := False;
Warn_On_Parameter_Order := False;
Warn_On_Record_Holes := False;
Warn_On_Questionable_Missing_Parens := False;
Warn_On_Redundant_Constructs := False;
Warn_On_Reverse_Bit_Order := False;
Warn_On_Standard_Redefinition := False;
Warn_On_Suspicious_Contract := False;
Warn_On_Suspicious_Modulus_Value := False;
Warn_On_Unchecked_Conversion := False;
Warn_On_Unordered_Enumeration_Type := False;
Warn_On_Unrecognized_Pragma := False;
Warn_On_Unrepped_Components := False;
Warn_On_Warnings_Off := False;
No_Warn_On_Non_Local_Exception := True; No_Warn_On_Non_Local_Exception := True;
when 'b' => when 'b' =>
@ -704,4 +630,40 @@ package body Warnsw is
return True; return True;
end Set_Warning_Switch; end Set_Warning_Switch;
-----------------
-- WA_Warnings --
-----------------
procedure WA_Warnings is
begin
Check_Unreferenced := True;
Check_Unreferenced_Formals := True;
Check_Withs := True;
Constant_Condition_Warnings := True;
Implementation_Unit_Warnings := True;
Ineffective_Inline_Warnings := True;
Warn_On_Ada_2005_Compatibility := True;
Warn_On_Ada_2012_Compatibility := True;
Warn_On_Assertion_Failure := True;
Warn_On_Assumed_Low_Bound := True;
Warn_On_Bad_Fixed_Value := True;
Warn_On_Biased_Representation := True;
Warn_On_Constant := True;
Warn_On_Export_Import := True;
Warn_On_Modified_Unread := True;
Warn_On_No_Value_Assigned := True;
Warn_On_Non_Local_Exception := True;
Warn_On_Object_Renames_Function := True;
Warn_On_Obsolescent_Feature := True;
Warn_On_Overlap := True;
Warn_On_Parameter_Order := True;
Warn_On_Questionable_Missing_Parens := True;
Warn_On_Redundant_Constructs := True;
Warn_On_Reverse_Bit_Order := True;
Warn_On_Suspicious_Contract := True;
Warn_On_Unchecked_Conversion := True;
Warn_On_Unrecognized_Pragma := True;
Warn_On_Unrepped_Components := True;
end WA_Warnings;
end Warnsw; end Warnsw;

View file

@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 1999-2013, Free Software Foundation, Inc. -- -- Copyright (C) 1999-2014, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
@ -71,6 +71,7 @@ package Warnsw is
Ineffective_Inline_Warnings : Boolean; Ineffective_Inline_Warnings : Boolean;
List_Body_Required_Info : Boolean; List_Body_Required_Info : Boolean;
List_Inherited_Aspects : Boolean; List_Inherited_Aspects : Boolean;
No_Warn_On_Non_Local_Exception : Boolean;
Warning_Doc_Switch : Boolean; Warning_Doc_Switch : Boolean;
Warn_On_Ada_2005_Compatibility : Boolean; Warn_On_Ada_2005_Compatibility : Boolean;
Warn_On_Ada_2012_Compatibility : Boolean; Warn_On_Ada_2012_Compatibility : Boolean;
@ -99,6 +100,7 @@ package Warnsw is
Warn_On_Reverse_Bit_Order : Boolean; Warn_On_Reverse_Bit_Order : Boolean;
Warn_On_Standard_Redefinition : Boolean; Warn_On_Standard_Redefinition : Boolean;
Warn_On_Suspicious_Contract : Boolean; Warn_On_Suspicious_Contract : Boolean;
Warn_On_Suspicious_Modulus_Value : Boolean;
Warn_On_Unchecked_Conversion : Boolean; Warn_On_Unchecked_Conversion : Boolean;
Warn_On_Unordered_Enumeration_Type : Boolean; Warn_On_Unordered_Enumeration_Type : Boolean;
Warn_On_Unrecognized_Pragma : Boolean; Warn_On_Unrecognized_Pragma : Boolean;