Suppress -Wunknown-pragmas warning in GCC

后端 未结 1 1004
遥遥无期
遥遥无期 2020-12-10 10:28

I try to ignore warnings coming from some 3rd party header files like this:

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored \"-Wunknown-pragmas\"
         


        
相关标签:
1条回答
  • 2020-12-10 11:24

    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
    0 讨论(0)
提交回复
热议问题