public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [COMMITTED] ada: Suppress warning about Subprogram_Variant failing at run time
@ 2023-05-23  8:07 Marc Poulhiès
  0 siblings, 0 replies; only message in thread
From: Marc Poulhiès @ 2023-05-23  8:07 UTC (permalink / raw)
  To: gcc-patches; +Cc: Piotr Trojanek

From: Piotr Trojanek <trojanek@adacore.com>

Warning about check failing at run time is likely spurious for mutually
recursive subprograms with multiple variant clauses. These will be
non-trivial to detect, so we simply suppress the warning altogether for
all subprogram variants.

gcc/ada/

	* exp_prag.adb (Expand_Pragma_Check): Suppress warning for checks of
	subprogram variants.

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

---
 gcc/ada/exp_prag.adb | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/gcc/ada/exp_prag.adb b/gcc/ada/exp_prag.adb
index ceb27848dad..c6b3bed5425 100644
--- a/gcc/ada/exp_prag.adb
+++ b/gcc/ada/exp_prag.adb
@@ -564,6 +564,13 @@ package body Exp_Prag is
          then
             null;
 
+         --  For Subprogram_Variant suppress the warning altogether, because
+         --  for mutually recursive subprograms with multiple variant clauses
+         --  some of the clauses might have expressions that are only meant for
+         --  verification and would always fail when executed.
+
+         elsif Nam = Name_Subprogram_Variant then
+            null;
          elsif Nam = Name_Assert then
             Error_Msg_N ("?.a?assertion will fail at run time", N);
          else
-- 
2.40.0


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

only message in thread, other threads:[~2023-05-23  8:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-23  8:07 [COMMITTED] ada: Suppress warning about Subprogram_Variant failing at run time 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).