https://gcc.gnu.org/g:afd5181e95696086b44bd3ad6beb3ccc5c3c27c1
commit r17-940-gafd5181e95696086b44bd3ad6beb3ccc5c3c27c1 Author: Piotr Trojanek <[email protected]> Date: Fri Mar 13 12:54:06 2026 +0100 ada: Suppress warning about unused variable in trivial quantification When condition of a quantification expression is written as True or False, then the user has likely done this on purpose and there is no need for a warning. gcc/ada/ChangeLog: * sem_ch4.adb (Analyze_Quantified_Expression): Suppress warning for trivial conditions. Diff: --- gcc/ada/sem_ch4.adb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb index bd919e2bac7f..7eeac98baf81 100644 --- a/gcc/ada/sem_ch4.adb +++ b/gcc/ada/sem_ch4.adb @@ -4817,10 +4817,10 @@ package body Sem_Ch4 is 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); - else + if Referenced (Loop_Id, Cond) then Check_Subexpr (Cond, Kind => Full); + elsif not Is_Trivial_Boolean (Cond) then + Error_Msg_N ("?.t?unused variable &", Loop_Id); end if; end if; end;
