I’ve run into this annoyance, too. According to the GCC manpage -Wall turns on -Wunknown-pragmas for you, so just manually disable it using -Wno-unknown-pragmas after -Wall.
There is a GCC feature request to make this work using #pragma GCC diagnostic:
- C++ preprocessor ignores #pragma GCC diagnostic