I need to push/pop several gcc diagnostics in my code. If that was needed in a single file I would do the following:
#pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wformat"
#pragma GCC diagnostic error "-Wuninitialized"
...some code...
#pragma GCC diagnostic push
But I need this in multiple locations. So I want to have a #define or something similar. I thought about the following but c preprocessor does not allow #pragmas in #define.
#define PushWarnings \
#pragma GCC diagnostic push \
#pragma GCC diagnostic error "-Wformat" \
#pragma GCC diagnostic error "-Wuninitialized"
Is there a way of achieving this?