0

I am using OpenNI on OS X, and for some reason its .h files are spitting out a lot of warnings all over the place, which is annoying.

Is there a way to turn off all warnings for the OpenNI include files?

houbysoft
  • 32,532
  • 24
  • 103
  • 156
  • This is a good reference: http://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html – chris Jun 29 '12 at 21:36
  • @chris: if at all possible, it'd be great to find a solution that would not require me to modify the headers themselves, since I won't always have write access... – houbysoft Jun 29 '12 at 21:39
  • You could probably make use of [this answer](http://stackoverflow.com/a/3394268/962089) around the include directives. – chris Jun 29 '12 at 21:42
  • 2
    Write your own header that pushes the diagnostic state, sets it to whatever you want, includes the third party or system headers, then pops the diagnostic state back to what it was. – James McNellis Jun 29 '12 at 21:42
  • You could send the compiler output through a filter... – Beta Jun 29 '12 at 22:00
  • Don't you think you should find out where the warnings are coming from? – stark Jun 30 '12 at 03:09
  • @stark: I know where they are coming from, as I said in the question, it's from OpenNI, a 3rd party library. – houbysoft Jun 30 '12 at 03:33
  • @JamesMcNellis: that is still a bit invasive, as it requires me to modify code. I originally wanted to do it using command line switches only, and now I found a solution, `-isystem`, posted below. – houbysoft Jun 30 '12 at 21:52

1 Answers1

1

I found out that I can specify the include directories for OpenNI using the -isystem switch instead of -I.

-isystem makes gcc treat the include directories as system directories, and as such it won't generate any warnings for them.

houbysoft
  • 32,532
  • 24
  • 103
  • 156