Wnoerror
Wnoerror, typically expressed on the command line as -Wno-error, is a compiler option used by GCC and Clang to prevent warnings from being treated as errors. It serves as the counterpart to -Werror, which elevates warnings to error status. When invoked without a specific diagnostic, -Wno-error reverts all warnings to their default behavior, allowing compilation to continue despite warnings. It can also be applied selectively with -Wno-error=warning-name to disable the error-escalation for particular warnings.
- General form: -Wno-error disables the conversion of warnings into errors for all warnings.
- Selective form: -Wno-error=warning-name disables the escalation for a specific warning, even if -Werror is in effect.
- Interaction: If multiple such options are present, the most recent relevant option on the command line
- -Wno-error does not turn warnings into errors; it simply prevents warnings from stopping compilation when -Werror
- It does not affect actual compilation errors or other diagnostic severities that are not warnings.
- The exact semantics may vary slightly by toolchain version, so consult your compiler’s documentation for specifics.
- This option is commonly used to allow legacy code or problematic sections to compile with warnings
-Werror (treat all warnings as errors)
--Werror=warning-name (treat only that warning as an error)
-Wpedantic and other language-mode flags may interact with warning behavior differently across compilers.