Prevent using warning options OSX does not recognize while on OSX…

…allowing compilation.

Updated part 2 of #3405 bugfix.