Gcc with -Werror and -Wno-error = unused

I always compile with -Wall -Wextra -Werror .

How many times when I do fast compilations I need to ignore -Wunused distortions. For various reasons, I want to see them as warnings, not errors, leaving all other warnings as errors.

  • -Wno-unused , of course, does not display any warnings, so this is not what I need.

  • I thought the solution -Wno-error=unused unfortunately does not seem to work (they are still reported as errors),

  • Individual -Wno-error=unused-variable (for example, -Wno-error=unused-variable ) works as expected (reported only as a warning).

So, is there a way to warn them by leaving -Werror without specifying all the -Wno-error=unsused-... separately?
Is the behavior -Werro -Wno-error=unused error?

+6
source share
1 answer

No, there is no way to disable them immediately. -Wunused to include a list of options, for example:
-Wunused-function
-Wunused-label
-Wunused-value
-Wunused-variable

And you must disable them one by one using the Wno option.

+2
source

Source: https://habr.com/ru/post/981870/


All Articles