Prevent using warning options OSX does not regognize while on OSX, allowing compilation

Updated part 2 of #3405 bugfix.