I would like to disable specific known warnings in C++ code coming from a library header when compiling my own code. There are clang and gcc specific methods for disabling the warnings. The way this is done is almost identical.
For clang:
#pragma clang diagnostic push#pragma clang diagnostic ignored "-Wunused-local-typedefs"#include <library.h> #pragma clang diagnostic pop
For gcc:
#pragma GCC diagnostic push#pragma GCC diagnostic ignored "-Wunused-local-typedefs"#include <library.h>#pragma GCC diagnostic pop
Is there a clean way to suppress these warnings that is portable across clang and GCC?