GCC Newspaper
JUNE 15, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
ada

Suppress Warning About Unused Variable in Trivial Quantification

The Ada compiler now suppresses warnings about unused variables in trivial quantification expressions (e.g., `for all X in ... => True`).

The Ada compiler will no longer warn about unused variables in trivial quantified expressions where the condition is simply True or False. This avoids spurious warnings when the user has likely written such an expression intentionally.

In Details

This commit modifies sem_ch4.adb to conditionally suppress the unused variable warning within quantified expressions. Specifically, if the condition of the quantification is a literal True or False, the warning is suppressed, assuming the user's intent.

For Context

The Ada compiler tries to help programmers by warning them about potential mistakes, like declaring a variable but never using it. However, sometimes these warnings are not helpful, especially in specific, uncommon situations. This commit tells the Ada compiler to skip the unused variable warning when the programmer writes a quantified expression (a type of logical statement) with a condition that is always true or always false, because in these cases the programmer likely knows what they are doing.

Filed Under: adawarningquantification