* [COMMITTED] ada: Simplify detection of pragmas in the context items
@ 2022-11-07 8:39 Marc Poulhiès
0 siblings, 0 replies; only message in thread
From: Marc Poulhiès @ 2022-11-07 8:39 UTC (permalink / raw)
To: gcc-patches; +Cc: Piotr Trojanek
From: Piotr Trojanek <trojanek@adacore.com>
Code cleanup; semantics is unaffected.
gcc/ada/
* sem_prag.adb (Is_In_Context_Clause): Rewrite without negations
and inequalities.
Tested on x86_64-pc-linux-gnu, committed on master.
---
gcc/ada/sem_prag.adb | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index 471ef870fa7..f33d858062d 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -7315,22 +7315,16 @@ package body Sem_Prag is
Parent_Node : Node_Id;
begin
- if not Is_List_Member (N) then
- return False;
-
- else
+ if Is_List_Member (N) then
Plist := List_Containing (N);
Parent_Node := Parent (Plist);
- if Parent_Node = Empty
- or else Nkind (Parent_Node) /= N_Compilation_Unit
- or else Context_Items (Parent_Node) /= Plist
- then
- return False;
- end if;
+ return Present (Parent_Node)
+ and then Nkind (Parent_Node) = N_Compilation_Unit
+ and then Context_Items (Parent_Node) = Plist;
end if;
- return True;
+ return False;
end Is_In_Context_Clause;
---------------------------------
--
2.34.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-11-07 8:39 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-07 8:39 [COMMITTED] ada: Simplify detection of pragmas in the context items 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).