mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-15 14:01:04 +08:00
sem_prag.adb, [...]: Minor code clean up.
2015-02-05 Yannick Moy <moy@adacore.com> * sem_prag.adb, par-prag.adb: Minor code clean up. From-SVN: r220448
This commit is contained in:
parent
6d13d38e28
commit
b21d8148ff
@ -1,3 +1,7 @@
|
||||
2015-02-05 Yannick Moy <moy@adacore.com>
|
||||
|
||||
* sem_prag.adb, par-prag.adb: Minor code clean up.
|
||||
|
||||
2015-02-05 Yannick Moy <moy@adacore.com>
|
||||
|
||||
* par-prag.adb (Pragma_Warnings): Update for extended form
|
||||
|
@ -1047,14 +1047,21 @@ begin
|
||||
-- Warnings (GNAT) --
|
||||
---------------------
|
||||
|
||||
-- pragma Warnings ([TOOL_NAME,] On | Off [,REASON]);
|
||||
-- pragma Warnings ([TOOL_NAME,] On | Off, LOCAL_NAME [,REASON]);
|
||||
-- pragma Warnings ([TOOL_NAME,] static_string_EXPRESSION [,REASON]);
|
||||
-- pragma Warnings ([TOOL_NAME,] On | Off,
|
||||
-- static_string_EXPRESSION [,REASON]);
|
||||
-- pragma Warnings ([TOOL_NAME,] DETAILS [, REASON]);
|
||||
|
||||
-- DETAILS ::= On | Off
|
||||
-- DETAILS ::= On | Off, local_NAME
|
||||
-- DETAILS ::= static_string_EXPRESSION
|
||||
-- DETAILS ::= On | Off, static_string_EXPRESSION
|
||||
|
||||
-- TOOL_NAME ::= GNAT | GNATProve
|
||||
|
||||
-- REASON ::= Reason => STRING_LITERAL {& STRING_LITERAL}
|
||||
|
||||
-- Note: If the first argument matches an allowed tool name, it is
|
||||
-- always considered to be a tool name, even if there is a string
|
||||
-- variable of that name.
|
||||
|
||||
-- The one argument ON/OFF case is processed by the parser, since it may
|
||||
-- control parser warnings as well as semantic warnings, and in any case
|
||||
-- we want to be absolutely sure that the range in the warnings table is
|
||||
@ -1065,8 +1072,6 @@ begin
|
||||
-- arguments if the first one is a tool name, and/or the last one is a
|
||||
-- reason argument.
|
||||
|
||||
-- Need documentation and syntax for TOOL_NAME ???
|
||||
|
||||
when Pragma_Warnings => Warnings : declare
|
||||
function First_Arg_Is_Matching_Tool_Name return Boolean;
|
||||
-- Returns True if the first argument is a tool name matching the
|
||||
@ -1087,14 +1092,20 @@ begin
|
||||
-- First_Arg_Is_Matching_Tool_Name --
|
||||
-------------------------------------
|
||||
|
||||
-- Comments needed for these complex conditionals ???
|
||||
|
||||
function First_Arg_Is_Matching_Tool_Name return Boolean is
|
||||
begin
|
||||
return Nkind (Arg1) = N_Identifier
|
||||
|
||||
-- Return True if the tool name is GNAT, and we're not in
|
||||
-- GNATprove or CodePeer or ASIS mode...
|
||||
|
||||
and then ((Chars (Arg1) = Name_Gnat
|
||||
and then not
|
||||
(CodePeer_Mode or GNATprove_Mode or ASIS_Mode))
|
||||
|
||||
-- or if the tool name is GNATprove, and we're in GNATprove
|
||||
-- mode.
|
||||
|
||||
or else
|
||||
(Chars (Arg1) = Name_Gnatprove
|
||||
and then GNATprove_Mode));
|
||||
|
@ -3109,7 +3109,9 @@ package body Sem_Prag is
|
||||
-- Analyzes the argument, and determines if it is a static string
|
||||
-- expression, returns True if so, False if non-static or not String.
|
||||
-- A special case is that a string literal returns True in Ada 83 mode
|
||||
-- (which has no such thing as static string expressions).
|
||||
-- (which has no such thing as static string expressions). Note that
|
||||
-- the call analyzes its argument, so this cannot be used for the case
|
||||
-- where an identifier might not be declared.
|
||||
|
||||
procedure Pragma_Misplaced;
|
||||
pragma No_Return (Pragma_Misplaced);
|
||||
@ -21323,18 +21325,20 @@ package body Sem_Prag is
|
||||
-- Warnings --
|
||||
--------------
|
||||
|
||||
-- pragma Warnings ([TOOL_NAME,] On | Off [,REASON]);
|
||||
-- pragma Warnings ([TOOL_NAME,] On | Off, LOCAL_NAME [,REASON]);
|
||||
-- pragma Warnings ([TOOL_NAME,] static_string_EXPRESSION [,REASON]);
|
||||
-- pragma Warnings ([TOOL_NAME,] On | Off,
|
||||
-- static_string_EXPRESSION [,REASON]);
|
||||
-- pragma Warnings ([TOOL_NAME,] DETAILS [, REASON]);
|
||||
|
||||
-- DETAILS ::= On | Off
|
||||
-- DETAILS ::= On | Off, local_NAME
|
||||
-- DETAILS ::= static_string_EXPRESSION
|
||||
-- DETAILS ::= On | Off, static_string_EXPRESSION
|
||||
|
||||
-- TOOL_NAME ::= GNAT | GNATProve
|
||||
|
||||
-- REASON ::= Reason => STRING_LITERAL {& STRING_LITERAL}
|
||||
|
||||
-- If present, TOOL_NAME refers to a tool, currently either GNAT
|
||||
-- or GNATprove. If an identifier is a static string expression,
|
||||
-- the form of pragma Warnings that starts with a static string
|
||||
-- expression is used.
|
||||
-- Note: If the first argument matches an allowed tool name, it is
|
||||
-- always considered to be a tool name, even if there is a string
|
||||
-- variable of that name.
|
||||
|
||||
when Pragma_Warnings => Warnings : declare
|
||||
Reason : String_Id;
|
||||
@ -21396,9 +21400,7 @@ package body Sem_Prag is
|
||||
-- was given otherwise, by shifting the arguments.
|
||||
|
||||
if Nkind (Argx) = N_Identifier
|
||||
and then not Nam_In (Chars (Argx), Name_On, Name_Off)
|
||||
and then not Is_Static_String_Expression (Arg1)
|
||||
-- How can this possibly work e.g. for GNATprove???
|
||||
and then Nam_In (Chars (Argx), Name_Gnat, Name_Gnatprove)
|
||||
then
|
||||
if Chars (Argx) = Name_Gnat then
|
||||
if CodePeer_Mode or GNATprove_Mode or ASIS_Mode then
|
||||
@ -21415,9 +21417,7 @@ package body Sem_Prag is
|
||||
end if;
|
||||
|
||||
else
|
||||
Error_Pragma_Arg
|
||||
("argument of pragma% must be On/Off or tool name "
|
||||
& "or static string expression", Arg1);
|
||||
raise Program_Error;
|
||||
end if;
|
||||
|
||||
-- At this point, the pragma Warnings applies to the tool,
|
||||
|
Loading…
x
Reference in New Issue
Block a user