disable specific warnings in gcc

混江龙づ霸主 提交于 2019-11-27 01:31:31

This can be done with gcc's diagnostic pragmas.

From the gcc manual:

   Many options have long names starting with -f or with -W---for example,
   -fforce-mem, -fstrength-reduce, -Wformat and so on.  Most of these have
   both positive and negative forms; the negative form of -ffoo would be
   -fno-foo.  This manual documents only one of these two forms, whichever
   one is not the default.

But if you're asking whether there is a source-level warning disable, I'm not aware if that feature exists in gcc.

-Wno-multichar:

Do not warn if a multicharacter constant ('FOOF') is used. Usually they indicate a typo in the user's code, as they have implementation-defined values, and should not be used in portable code.

More information.

Inside source code write :

#pragma GCC diagnostic ignored "-Wno-multichar"

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