mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-19 06:40:31 +08:00
opt.ads (Treat_Restrictions_As_Warnings): New switch
2008-05-20 Robert Dewar <dewar@adacore.com> * opt.ads (Treat_Restrictions_As_Warnings): New switch * sem_prag.adb, par-prag.adb, restrict.ads: Implement flag Treat_Restrictions_As_Warnings. * switch-c.adb: Recognize new switch -gnatr * usage.adb: Add line for -gnatr From-SVN: r135632
This commit is contained in:
parent
604b5bcb17
commit
23e6615e0f
@ -1108,6 +1108,11 @@ package Opt is
|
||||
-- Tolerate time stamp and other consistency errors. If this flag is set to
|
||||
-- True (-t), then inconsistencies result in warnings rather than errors.
|
||||
|
||||
Treat_Restrictions_As_Warnings : Boolean := False;
|
||||
-- GNAT
|
||||
-- Set True to treat pragma Restrictions as Restriction_Warnings. Set by
|
||||
-- -gnatr switch.
|
||||
|
||||
Tree_Output : Boolean := False;
|
||||
-- GNAT
|
||||
-- Set to True (-gnatt) to generate output tree file
|
||||
|
@ -234,7 +234,8 @@ function Prag (Pragma_Node : Node_Id; Semi : Source_Ptr) return Node_Id is
|
||||
elsif Id = Name_No_Dependence then
|
||||
Set_Restriction_No_Dependence
|
||||
(Unit => Expr,
|
||||
Warn => Prag_Id = Pragma_Restriction_Warnings);
|
||||
Warn => Prag_Id = Pragma_Restriction_Warnings
|
||||
or else Treat_Restrictions_As_Warnings);
|
||||
end if;
|
||||
|
||||
Next (Arg);
|
||||
|
@ -6,7 +6,7 @@
|
||||
-- --
|
||||
-- S p e c --
|
||||
-- --
|
||||
-- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
|
||||
-- Copyright (C) 1992-2008, 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- --
|
||||
@ -277,11 +277,12 @@ package Restrict is
|
||||
(P : Profile_Name;
|
||||
N : Node_Id;
|
||||
Warn : Boolean);
|
||||
-- Sets the set of restrictions associated with the given profile
|
||||
-- name. N is the node of the construct to which error messages
|
||||
-- are to be attached as required. Warn is set True for the case
|
||||
-- of Profile_Warnings where the restrictions are set as warnings
|
||||
-- rather than legality requirements.
|
||||
-- Sets the set of restrictions associated with the given profile name. N
|
||||
-- is the node of the construct to which error messages are to be attached
|
||||
-- as required. Warn is set True for the case of Profile_Warnings where the
|
||||
-- restrictions are set as warnings rather than legality requirements, and
|
||||
-- is also True for Profile if the Treat_Restrictions_As_Warnings flag is
|
||||
-- set. It is false for Profile if this flag is not set.
|
||||
|
||||
procedure Set_Restriction
|
||||
(R : All_Boolean_Restrictions;
|
||||
@ -301,7 +302,9 @@ package Restrict is
|
||||
(Unit : Node_Id;
|
||||
Warn : Boolean);
|
||||
-- Sets given No_Dependence restriction in table if not there already.
|
||||
-- Warn is True if from Restriction_Warnings, False if from Restrictions.
|
||||
-- Warn is True if from Restriction_Warnings, or for Restrictions if flag
|
||||
-- Treat_Restrictions_As_Warnings is set. False if from Restrictions and
|
||||
-- this flag is not set.
|
||||
|
||||
function Tasking_Allowed return Boolean;
|
||||
pragma Inline (Tasking_Allowed);
|
||||
|
@ -671,7 +671,9 @@ package body Sem_Prag is
|
||||
|
||||
procedure Process_Restrictions_Or_Restriction_Warnings (Warn : Boolean);
|
||||
-- Common processing for Restrictions and Restriction_Warnings pragmas.
|
||||
-- Warn is False for Restrictions, True for Restriction_Warnings.
|
||||
-- Warn is True for Restriction_Warnings, or for Restrictions if the
|
||||
-- flag Treat_Restrictions_As_Warnings is set, and False if this flag
|
||||
-- is not set in the Restrictions case.
|
||||
|
||||
procedure Process_Suppress_Unsuppress (Suppress_Case : Boolean);
|
||||
-- Common processing for Suppress and Unsuppress. The boolean parameter
|
||||
@ -4770,7 +4772,8 @@ package body Sem_Prag is
|
||||
|
||||
-- Set the corresponding restrictions
|
||||
|
||||
Set_Profile_Restrictions (Ravenscar, N, Warn => False);
|
||||
Set_Profile_Restrictions
|
||||
(Ravenscar, N, Warn => Treat_Restrictions_As_Warnings);
|
||||
end Set_Ravenscar_Profile;
|
||||
|
||||
-- Start of processing for Analyze_Pragma
|
||||
@ -9790,7 +9793,8 @@ package body Sem_Prag is
|
||||
if Chars (Argx) = Name_Ravenscar then
|
||||
Set_Ravenscar_Profile (N);
|
||||
elsif Chars (Argx) = Name_Restricted then
|
||||
Set_Profile_Restrictions (Restricted, N, Warn => False);
|
||||
Set_Profile_Restrictions
|
||||
(Restricted, N, Warn => Treat_Restrictions_As_Warnings);
|
||||
else
|
||||
Error_Pragma_Arg ("& is not a valid profile", Argx);
|
||||
end if;
|
||||
@ -10285,7 +10289,8 @@ package body Sem_Prag is
|
||||
GNAT_Pragma;
|
||||
Check_Arg_Count (0);
|
||||
Check_Valid_Configuration_Pragma;
|
||||
Set_Profile_Restrictions (Restricted, N, Warn => False);
|
||||
Set_Profile_Restrictions
|
||||
(Restricted, N, Warn => Treat_Restrictions_As_Warnings);
|
||||
|
||||
if Warn_On_Obsolescent_Feature then
|
||||
Error_Msg_N
|
||||
@ -10305,7 +10310,8 @@ package body Sem_Prag is
|
||||
-- | restriction_parameter_IDENTIFIER => EXPRESSION
|
||||
|
||||
when Pragma_Restrictions =>
|
||||
Process_Restrictions_Or_Restriction_Warnings (Warn => False);
|
||||
Process_Restrictions_Or_Restriction_Warnings
|
||||
(Warn => Treat_Restrictions_As_Warnings);
|
||||
|
||||
--------------------------
|
||||
-- Restriction_Warnings --
|
||||
|
@ -6,7 +6,7 @@
|
||||
-- --
|
||||
-- B o d y --
|
||||
-- --
|
||||
-- Copyright (C) 2001-2007, Free Software Foundation, Inc. --
|
||||
-- Copyright (C) 2001-2008, 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- --
|
||||
@ -660,13 +660,19 @@ package body Switch.C is
|
||||
Ptr := Ptr + 1;
|
||||
Try_Semantics := True;
|
||||
|
||||
-- Processing for q switch
|
||||
-- Processing for Q switch
|
||||
|
||||
when 'Q' =>
|
||||
Ptr := Ptr + 1;
|
||||
Force_ALI_Tree_File := True;
|
||||
Try_Semantics := True;
|
||||
|
||||
-- Processing for r switch
|
||||
|
||||
when 'r' =>
|
||||
Ptr := Ptr + 1;
|
||||
Treat_Restrictions_As_Warnings := True;
|
||||
|
||||
-- Processing for R switch
|
||||
|
||||
when 'R' =>
|
||||
|
@ -289,6 +289,11 @@ begin
|
||||
Write_Switch_Char ("Q");
|
||||
Write_Line ("Don't quit, write ali/tree file even if compile errors");
|
||||
|
||||
-- Line for -gnatr switch
|
||||
|
||||
Write_Switch_Char ("r");
|
||||
Write_Line ("Treat pragma Restrictions as Restriction_Warnings");
|
||||
|
||||
-- Lines for -gnatR switch
|
||||
|
||||
Write_Switch_Char ("R?");
|
||||
|
Loading…
x
Reference in New Issue
Block a user