configure: Check for GCC diagnostic pragma support inside of functions

The actual usage of the pragma is within functions and older versions
of gcc only support the pragma outside of functions.