]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Suppress warning about unused quantified variables with junk names
authorPiotr Trojanek <trojanek@adacore.com>
Wed, 11 Mar 2026 21:00:46 +0000 (22:00 +0100)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Fri, 29 May 2026 08:49:47 +0000 (10:49 +0200)
For quantified expressions like "for all Dummy in ... => True" we don't want
to warn about unused variable when it has a junk name.

gcc/ada/ChangeLog:

* sem_ch4.adb (Analyze_Quantified_Expression): Suppress warning for
variables with junk names.

gcc/ada/sem_ch4.adb

index 3d84a57490b47cd285e3b5c7906299ce6989af65..bd919e2bac7ffd3c01f24469967a2616ac41997b 100644 (file)
@@ -4815,6 +4815,7 @@ package body Sem_Ch4 is
       begin
          if Warn_On_Suspicious_Contract
            and then not Is_Internal_Name (Chars (Loop_Id))
+           and then not Has_Junk_Name (Loop_Id)
          then
             if not Referenced (Loop_Id, Cond) then
                Error_Msg_N ("?.t?unused variable &", Loop_Id);