How to put a warning disable pragma inside a macro gcc

旧巷老猫 提交于 2019-12-10 10:38:48

问题


I need to disable a warning that originates inside the macro '__LOG_W' in following code. To do that, I wrapped this macro inside another macro 'LOG_W' and disabled the warning '-Wold-style-cast' with in that. Then in the code I used the LOG_W instead. However I still get the warning and unable to find out why. Any pointers appreciated.

#define LOG_W(expr)\
  _Pragma("GCC diagnostic push")\
  _Pragma("GCC diagnostic ignored \"-Wold-style-cast\"")\
  __LOG_W(DEF, UNKNOWN, expr);\
  _Pragma("GCC diagnostic pop")

来源:https://stackoverflow.com/questions/24681881/how-to-put-a-warning-disable-pragma-inside-a-macro-gcc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!