How to suppress specific warnings in g++

后端 未结 4 1428
小鲜肉
小鲜肉 2020-12-06 04:03

I want to suppress specific warnings from g++. I\'m aware of the -Wno-XXX flag, but I\'m looking for something more specific. I want some of th

4条回答
  •  既然无缘
    2020-12-06 04:36

    You could just use grep -v on the output.

    Depending on the warning you wish to disable, you can sometimes correct in code. E.g.:

    int main()
    {
      int i;
    }
    

    Generates: foo.cc:4: warning: unused variable 'i'

    Whereas this does not:

    #define MARKUSED(X)  ((void)(&(X)))
    
    int main()
    {
      int i;
      MARKUSED(i);
    }
    

提交回复
热议问题