]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Suppress warning about Subprogram_Variant failing at run time
authorPiotr Trojanek <trojanek@adacore.com>
Wed, 15 Feb 2023 20:20:42 +0000 (21:20 +0100)
committerMarc Poulhiès <poulhies@adacore.com>
Tue, 23 May 2023 07:50:58 +0000 (09:50 +0200)
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.

gcc/ada/exp_prag.adb

index ceb27848dad8a07da2c426d5cde418fd2b7a07ed..c6b3bed5425275185063f2496d99b5aa0ebdb1ab 100644 (file)
@@ -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