Ignore safe compiler warnings in a more reliable way.

This removes the need to use `-Wno-pedantic` on every compiler which swallows a lot of useful warnings and causes build failures on very old GCCs.