GCC with -Werror and -Wno-error=unused does not work as expected
Asked Answered
C

1

21

I always compile with -Wall -Wextra -Werror.

However, many times as I do quick compile tests I need to ignore the -Wunused suite of errors. For various reasons, I want to see them as warnings and not errors while leaving all other warnings as errors.

  • -Wno-unused of course doesn't display any warning, so it is not what I need.

  • The one I thought is the solution -Wno-error=unused unfortunately doesn't seem to work (they are still reported as errors),

  • Individually setting the flags (e.g., -Wno-error=unused-variable) works as expected (reported as warning only).

So is there a way to make them warnings while leaving -Werror without to specify all the suit of options -Wno-error=unused-... individually?
Is the behavior of -Werro -Wno-error=unused a bug?

GCC with -Werror and -Wno-error=unused

Computerize answered 2/2, 2015 at 13:7 Comment(0)
S
10

No, there isn’t any way to turn them off at once.

-Wunused enables a list of options like:

And you should disable them one by one with the Wno option.

Schlieren answered 2/2, 2015 at 14:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.