26

In the project I currently am — and probably will for some time be — working on, we have decided to use the -Werror flag, as our previous “No warnings!” policy did not work out as intended.

This, however, imposes a certain problem:

API can no longer be marked as deprecated in a way that a) is flagged by the normal build toolchain, and b) doesn’t break the build.

So I guess the question boils down to:

Is there a flag like -Werror-no-${something_I_dont_want_to_promote_to_an_error}?

I found #pragma clang diagnostic error to almost achieve what I want — except that I fail to catch all the warnings that are enabled implicitly by the compiler…

Thanks in advance.

danyowdee
  • 4,658
  • 2
  • 20
  • 35

1 Answers1

40

From the manual:

-Wno-error=foo: Turn warning "foo" into a warning even if -Werror is specified.

Dr. Gut
  • 2,053
  • 7
  • 26
  • Sometimes I have trouble finding the correct clang docs in a reasonable amount of time. The manual link you provided is perfect for viewing all options regarding warning/error diagnostics, thank you for that. – SO_fix_the_vote_sorting_bug Aug 04 '21 at 16:38