public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [COMMITTED] ada: Remove redundant suppression for non-modified IN OUT parameters
@ 2022-11-07  8:40 Marc Poulhiès
  0 siblings, 0 replies; only message in thread
From: Marc Poulhiès @ 2022-11-07  8:40 UTC (permalink / raw)
  To: gcc-patches; +Cc: Piotr Trojanek

From: Piotr Trojanek <trojanek@adacore.com>

Non-modified IN OUT parameters are first collected and then filtered by
examining uses of their enclosing subprograms. In this filtering we
don't need to look again at properties of the formal parameters
themselves.

Cleanup related to improved detection of references to uninitialized
objects; semantics is unaffected.

gcc/ada/

	* sem_warn.adb
	(No_Warn_On_In_Out): For subprograms we can simply call
	Warnings_Off.
	(Output_Non_Modified_In_Out_Warnings): Remove repeated
	suppression.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/sem_warn.adb | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/gcc/ada/sem_warn.adb b/gcc/ada/sem_warn.adb
index 4552d907bac..1bfa8449ad7 100644
--- a/gcc/ada/sem_warn.adb
+++ b/gcc/ada/sem_warn.adb
@@ -3006,9 +3006,9 @@ package body Sem_Warn is
          then
             return True;
 
-         --  Else test warnings off
+         --  Else test warnings off on the subprogram
 
-         elsif Warnings_Off_Check_Spec (S) then
+         elsif Warnings_Off (S) then
             return True;
 
          --  All tests for suppressing warning failed
@@ -3029,11 +3029,9 @@ package body Sem_Warn is
 
          begin
             --  Suppress warning in specific cases (see details in comments for
-            --  No_Warn_On_In_Out), or if there is a pragma Unmodified.
+            --  No_Warn_On_In_Out).
 
-            if Has_Pragma_Unmodified_Check_Spec (E1)
-              or else No_Warn_On_In_Out (E1)
-            then
+            if No_Warn_On_In_Out (E1) then
                null;
 
             --  Here we generate the warning
-- 
2.34.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-11-07  8:40 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:40 [COMMITTED] ada: Remove redundant suppression for non-modified IN OUT parameters 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).