* [COMMITTED] ada: Fix handling of pragma Warnings (Toolname, Off/On)
@ 2023-05-15 9:42 Marc Poulhiès
0 siblings, 0 replies; only message in thread
From: Marc Poulhiès @ 2023-05-15 9:42 UTC (permalink / raw)
To: gcc-patches; +Cc: Yannick Moy
From: Yannick Moy <moy@adacore.com>
Pragma Warnings On/Off with a preceding toolname (which could be GNAT
or GNATprove) was ignored due an error in accessing the expression of
a pragma association in the parser. Now fixed.
gcc/ada/
* par-prag.adb (First_Arg_Is_Matching_Tool_Name): Fix access to
expression in pragma association.
Tested on x86_64-pc-linux-gnu, committed on master.
---
gcc/ada/par-prag.adb | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/gcc/ada/par-prag.adb b/gcc/ada/par-prag.adb
index 3a9764adec3..e78f97d11fb 100644
--- a/gcc/ada/par-prag.adb
+++ b/gcc/ada/par-prag.adb
@@ -1150,13 +1150,14 @@ begin
-------------------------------------
function First_Arg_Is_Matching_Tool_Name return Boolean is
+ Expr : constant Node_Id := Get_Pragma_Arg (Arg1);
begin
- return Nkind (Arg1) = N_Identifier
+ return Nkind (Expr) = N_Identifier
-- Return True if the tool name is GNAT, and we're not in
-- GNATprove or CodePeer mode...
- and then ((Chars (Arg1) = Name_Gnat
+ and then ((Chars (Expr) = Name_Gnat
and then not
(CodePeer_Mode or GNATprove_Mode))
@@ -1164,7 +1165,7 @@ begin
-- mode.
or else
- (Chars (Arg1) = Name_Gnatprove
+ (Chars (Expr) = Name_Gnatprove
and then GNATprove_Mode));
end First_Arg_Is_Matching_Tool_Name;
@@ -1189,7 +1190,7 @@ begin
--------------
function Last_Arg return Node_Id is
- Last_Arg : Node_Id;
+ Last_Arg : Node_Id;
begin
if Arg_Count = 1 then
--
2.40.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-05-15 9:42 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-15 9:42 [COMMITTED] ada: Fix handling of pragma Warnings (Toolname, Off/On) Marc Poulhiès
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).