Commit fb2bd3a7 by Robert Dewar Committed by Arnaud Charlet

errout.adb: Minor reformattin (Finalize): Take templates into account for warning suppression.

2011-11-23  Robert Dewar  <dewar@adacore.com>

	* errout.adb: Minor reformattin (Finalize): Take templates into
	account for warning suppression.
	* errout.ads (Set_Specific_Warning_Off): Add Used parameter.
	* erroutc.adb: Minor reformatting (Finalize): Take generic
	templates into account for warning suppress.
	* erroutc.ads (Set_Specific_Warning_Off): Add Used parameter.
	* sem_prag.adb: Minor reformatting (Analyze_Pragma,
	case Warnings): Provide Used parameter in call to
	Set_Specific_Warnings_Off (to deal with generic template case).

From-SVN: r181658
parent a1092b48
2011-11-23 Robert Dewar <dewar@adacore.com>
* errout.adb: Minor reformattin (Finalize): Take templates into
account for warning suppression.
* errout.ads (Set_Specific_Warning_Off): Add Used parameter.
* erroutc.adb: Minor reformatting (Finalize): Take generic
templates into account for warning suppress.
* erroutc.ads (Set_Specific_Warning_Off): Add Used parameter.
* sem_prag.adb: Minor reformatting (Analyze_Pragma,
case Warnings): Provide Used parameter in call to
Set_Specific_Warnings_Off (to deal with generic template case).
2011-11-23 Pascal Obry <obry@adacore.com> 2011-11-23 Pascal Obry <obry@adacore.com>
* sem_prag.adb (Process_Convention): Better error message for * sem_prag.adb (Process_Convention): Better error message for
......
...@@ -1286,9 +1286,15 @@ package body Errout is ...@@ -1286,9 +1286,15 @@ package body Errout is
Cur := First_Error_Msg; Cur := First_Error_Msg;
while Cur /= No_Error_Msg loop while Cur /= No_Error_Msg loop
if not Errors.Table (Cur).Deleted declare
and then Warning_Specifically_Suppressed CE : Error_Msg_Object renames Errors.Table (Cur);
(Errors.Table (Cur).Sptr, Errors.Table (Cur).Text)
begin
if not CE.Deleted
and then
(Warning_Specifically_Suppressed (CE.Sptr, CE.Text)
or else
Warning_Specifically_Suppressed (CE.Optr, CE.Text))
then then
Delete_Warning (Cur); Delete_Warning (Cur);
...@@ -1310,6 +1316,7 @@ package body Errout is ...@@ -1310,6 +1316,7 @@ package body Errout is
Delete_Warning (F); Delete_Warning (F);
end loop; end loop;
end if; end if;
end;
Cur := Errors.Table (Cur).Next; Cur := Errors.Table (Cur).Next;
end loop; end loop;
......
...@@ -771,7 +771,8 @@ package Errout is ...@@ -771,7 +771,8 @@ package Errout is
procedure Set_Specific_Warning_Off procedure Set_Specific_Warning_Off
(Loc : Source_Ptr; (Loc : Source_Ptr;
Msg : String; Msg : String;
Config : Boolean) Config : Boolean;
Used : Boolean := False)
renames Erroutc.Set_Specific_Warning_Off; renames Erroutc.Set_Specific_Warning_Off;
-- This is called in response to the two argument form of pragma Warnings -- This is called in response to the two argument form of pragma Warnings
-- where the first argument is OFF, and the second argument is the prefix -- where the first argument is OFF, and the second argument is the prefix
......
...@@ -1081,7 +1081,8 @@ package body Erroutc is ...@@ -1081,7 +1081,8 @@ package body Erroutc is
procedure Set_Specific_Warning_Off procedure Set_Specific_Warning_Off
(Loc : Source_Ptr; (Loc : Source_Ptr;
Msg : String; Msg : String;
Config : Boolean) Config : Boolean;
Used : Boolean := False)
is is
begin begin
Specific_Warnings.Append Specific_Warnings.Append
...@@ -1089,7 +1090,7 @@ package body Erroutc is ...@@ -1089,7 +1090,7 @@ package body Erroutc is
Msg => new String'(Msg), Msg => new String'(Msg),
Stop => Source_Last (Current_Source_File), Stop => Source_Last (Current_Source_File),
Open => True, Open => True,
Used => False, Used => Used,
Config => Config)); Config => Config));
end Set_Specific_Warning_Off; end Set_Specific_Warning_Off;
...@@ -1135,16 +1136,16 @@ package body Erroutc is ...@@ -1135,16 +1136,16 @@ package body Erroutc is
procedure Set_Warnings_Mode_Off (Loc : Source_Ptr) is procedure Set_Warnings_Mode_Off (Loc : Source_Ptr) is
begin begin
-- Don't bother with entries from instantiation copies, since we -- Don't bother with entries from instantiation copies, since we will
-- will already have a copy in the template, which is what matters -- already have a copy in the template, which is what matters.
if Instantiation (Get_Source_File_Index (Loc)) /= No_Location then if Instantiation (Get_Source_File_Index (Loc)) /= No_Location then
return; return;
end if; end if;
-- If last entry in table already covers us, this is a redundant -- If last entry in table already covers us, this is a redundant pragma
-- pragma Warnings (Off) and can be ignored. This also handles the -- Warnings (Off) and can be ignored. This also handles the case where
-- case where all warnings are suppressed by command line switch. -- all warnings are suppressed by command line switch.
if Warnings.Last >= Warnings.First if Warnings.Last >= Warnings.First
and then Warnings.Table (Warnings.Last).Start <= Loc and then Warnings.Table (Warnings.Last).Start <= Loc
...@@ -1152,9 +1153,9 @@ package body Erroutc is ...@@ -1152,9 +1153,9 @@ package body Erroutc is
then then
return; return;
-- Otherwise establish a new entry, extending from the location of -- Otherwise establish a new entry, extending from the location of the
-- the pragma to the end of the current source file. This ending -- pragma to the end of the current source file. This ending point will
-- point will be adjusted by a subsequent pragma Warnings (On). -- be adjusted by a subsequent pragma Warnings (On).
else else
Warnings.Increment_Last; Warnings.Increment_Last;
...@@ -1170,8 +1171,8 @@ package body Erroutc is ...@@ -1170,8 +1171,8 @@ package body Erroutc is
procedure Set_Warnings_Mode_On (Loc : Source_Ptr) is procedure Set_Warnings_Mode_On (Loc : Source_Ptr) is
begin begin
-- Don't bother with entries from instantiation copies, since we -- Don't bother with entries from instantiation copies, since we will
-- will already have a copy in the template, which is what matters -- already have a copy in the template, which is what matters.
if Instantiation (Get_Source_File_Index (Loc)) /= No_Location then if Instantiation (Get_Source_File_Index (Loc)) /= No_Location then
return; return;
......
...@@ -445,7 +445,8 @@ package Erroutc is ...@@ -445,7 +445,8 @@ package Erroutc is
procedure Set_Specific_Warning_Off procedure Set_Specific_Warning_Off
(Loc : Source_Ptr; (Loc : Source_Ptr;
Msg : String; Msg : String;
Config : Boolean); Config : Boolean;
Used : Boolean := False);
-- This is called in response to the two argument form of pragma Warnings -- This is called in response to the two argument form of pragma Warnings
-- where the first argument is OFF, and the second argument is a string -- where the first argument is OFF, and the second argument is a string
-- which identifies a specific warning to be suppressed. The first argument -- which identifies a specific warning to be suppressed. The first argument
...@@ -453,6 +454,8 @@ package Erroutc is ...@@ -453,6 +454,8 @@ package Erroutc is
-- string from the pragma. Loc is the location of the pragma (which is the -- string from the pragma. Loc is the location of the pragma (which is the
-- start of the range to suppress). Config is True for the configuration -- start of the range to suppress). Config is True for the configuration
-- pragma case (where there is no requirement for a matching OFF pragma). -- pragma case (where there is no requirement for a matching OFF pragma).
-- Used is set True to disable the check that the warning actually has
-- has the effect of suppressing a warning.
procedure Set_Specific_Warning_On procedure Set_Specific_Warning_On
(Loc : Source_Ptr; (Loc : Source_Ptr;
......
...@@ -14547,8 +14547,7 @@ package body Sem_Prag is ...@@ -14547,8 +14547,7 @@ package body Sem_Prag is
-- the formal may be wrapped in a conversion if the -- the formal may be wrapped in a conversion if the
-- actual is a conversion. Retrieve the real entity name. -- actual is a conversion. Retrieve the real entity name.
if (In_Instance_Body if (In_Instance_Body or else In_Inlined_Body)
or else In_Inlined_Body)
and then Nkind (E_Id) = N_Unchecked_Type_Conversion and then Nkind (E_Id) = N_Unchecked_Type_Conversion
then then
E_Id := Expression (E_Id); E_Id := Expression (E_Id);
...@@ -14612,10 +14611,21 @@ package body Sem_Prag is ...@@ -14612,10 +14611,21 @@ package body Sem_Prag is
-- In any other case, an error will be signalled (ON -- In any other case, an error will be signalled (ON
-- with no matching OFF). -- with no matching OFF).
-- Note: We set Used if we are inside a generic to
-- disable the test that the non-config case actually
-- cancels a warning. That's because we can't be sure
-- there isn't an instantiation in some other unit
-- where a warning is suppressed.
-- We could do a little better here by checking if the
-- generic unit we are inside is public, but for now
-- we don't bother with that refinement.
if Chars (Argx) = Name_Off then if Chars (Argx) = Name_Off then
Set_Specific_Warning_Off Set_Specific_Warning_Off
(Loc, Name_Buffer (1 .. Name_Len), (Loc, Name_Buffer (1 .. Name_Len),
Config => Is_Configuration_Pragma); Config => Is_Configuration_Pragma,
Used => Inside_A_Generic or else In_Instance);
elsif Chars (Argx) = Name_On then elsif Chars (Argx) = Name_On then
Set_Specific_Warning_On Set_Specific_Warning_On
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment