20

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

rturrado
  • 7,699
  • 6
  • 42
  • 62
bolov
  • 72,283
  • 15
  • 145
  • 224

1 Answers1

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.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Laser
  • 6,652
  • 8
  • 54
  • 85