"#pragma GCC diagnostic warning" with GCC
c++, warnings
Solution
GCC has these two flags to control warnings regarding pragmas:
-Wunknown-pragmas Warn when a "#pragma" directive is encountered that is not understood by GCC. If this command-line option is used, warnings are even issued for unknown pragmas in system header files. This is not the case if the warnings are only enabled by the -Wall command-line option.
-Wno-pragmas Do not warn about misuses of pragmas, such as incorrect parameters, invalid syntax, or conflicts between pragmas. See also -Wunknown-pragmas.
You can turn them off with `-Wno-unknown-pragmas`.
Problem
I use GCC 4.5.1 and get warnings like: warning: expected [error|warning|ignored] after '#pragma GCC diagnostic' The reason is "#pragma GCC diagnostic push", which doesn't exist for GCC before version 4.6. I can't change the code (it is not my) and the GCC version too. How can I disable these warnings? Some GCC flags may be? P.S.: I saw Why "pragma GCC diagnostic push" pop warning in GCC/C++?, but there isn't answer to my question.