Refactor handling of warnings settings for C and C++