GCC -Wall and -Wextra diagnostic overlap and prioritization
0 reputation · 08 Apr 2024, 18:31 UTC
The GNU Compiler Collection (GCC) utilizes a tiered system of warning flags, primarily -Wall and -Wextra, to alert developers to potentially problematic code. While these flags enable a broad set of diagnostics, there is often overlap in the types of issues they detect, and the internal categorization of these diagnostics into warning, error, or note levels can vary between compiler releases.
When implementing strict coding standards using -Werror, the lack of a granular, documented mapping between specific diagnostic triggers and their parent flag groups can lead to inconsistent build failures across different GCC versions (e.g., GCC 11 vs GCC 13).
- How does GCC determine the priority of a diagnostic when it is triggered by both
-Walland-Wextra? - Is there a documented mechanism to identify which specific warning flag is responsible for a diagnostic without manually testing
-Wno-suppressions?