How can I disable all warnings for a single file with Clang 3.8?

If you need your compiler flags to be consistent between GCC and Clang, they both have the -w flag:

$ clang --help | grep -i suppress
  -w                      Suppress all warnings

Indeed, the "-Weverything" is not a group of warnings, but just a special option passed to the compiler. Here is code that handles this case: lib/Basic/Warnings.cpp:118

You still can compile your problematic source file using slightly different rules/flags as you use for others sources:

clang -Wno-everything foo.c

However, I'd recommend to disable each warning explicitly using #pragma.

In case you disable all warnings, and then upgrade your compiler, then you may miss some new warnings, which could be important (e.g. undefined behaviour checks, security checks, etc).

Also, imagine what happens if the file is not gone after three months, but stays in the project forever.

Tags:

Clang