Selectively remove warning message GCC

前端 未结 4 1711
走了就别回头了
走了就别回头了 2020-11-30 04:45

This piece of code:

Int32 status;
printf(\"status : %x\", status)

gives me the following warning:

jpegthread.c:157: warning         


        
4条回答
  •  既然无缘
    2020-11-30 05:11

    It looks like the GCC manual does provide a way to do this with a #pragma, actually. (contrary to what Aiden Bell says in another answer here)

    http://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html

    e.g. for the -Wuninitialized warning, you can do...

    #pragma GCC diagnostic ignored "-Wuninitialized"
    

    ... to suppress the warning, or...

    #pragma GCC diagnostic warning "-Wuninitialized"
    

    ... to treat it as a warning (not an error) even if you're building with -Werror.

提交回复
热议问题