Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Clang: Promoting all Warnings to Errors Except for …

Tags:

People also ask

What is clang diagnostic?

clang::Diagnostic Class Reference. A little helper class (which is basically a smart pointer that forwards info from DiagnosticsEngine) that allows clients to enquire about the currently in-flight diagnostic.

How does clang work?

Clang Design: Like many other compilers design, Clang compiler has three phase: The front end that parses source code, checking it for errors, and builds a language-specific Abstract Syntax Tree (AST) to represent the input code. The optimizer: its goal is to do some optimization on the AST generated by the front end.

What is clang option?

The Clang Compiler is an open-source compiler for the C family of programming languages, aiming to be the best in class implementation of these languages. Clang builds on the LLVM optimizer and code generator, allowing it to provide high-quality optimization and code generation support for many targets.


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.