Prevent promotion of specific warning to error

When building with the flag -Werror, as we do for our tests on CI, earlier versions of Clang, I allowed preventing certain warnings from being promoted to errors using the following syntax: -W-no-error-${warning-name}

When building without -Werror on the Clang version included in Xcode 13.0 beta (13A5154h), this leads to warnings like the following:

warning: unknown -Werror warning specifier: '-Wno-error-deprecated-declarations' [-Wunknown-warning-option]

So how do I prevent promotion of a specific warning to an error now?

Answered by Developer Tools Engineer in 678037022

The correct spelling of the warning options are: -Werror= and -Wno-error=. You should use -Wno-error=deprecated-declarations.

It was an oversight that the older clang accidentally support -Wno-error- syntax and it was fixed in the latest clang shipped in Xcode 13 beta.

You can see the commit that changes the behavior here: llvm-project git commit. It also has a short explanation for why it is changed that way.

Accepted Answer

The correct spelling of the warning options are: -Werror= and -Wno-error=. You should use -Wno-error=deprecated-declarations.

It was an oversight that the older clang accidentally support -Wno-error- syntax and it was fixed in the latest clang shipped in Xcode 13 beta.

You can see the commit that changes the behavior here: llvm-project git commit. It also has a short explanation for why it is changed that way.

Prevent promotion of specific warning to error
 
 
Q