I am writing a cross-platform OpenGL function loading library. On Windows, the compiler (oddly enough, both VS and GCC) seems fine with implicitly converting one kind of function pointer (the return type from wglGetProcAddress being a void(*)()) into another type of function pointer.
GCC on Linux however is not. glXGetProcAddress will return a void(*)(), but it will always issue a warning about it. And since OpenGL has literally thousands of these things, it adds up to a giant diagnostic spew that’s entirely irrelevant.
Is there some way to disable this particular warning? Either with a #pragma or some way of rearranging the code so GCC shuts up? I tried the whole #pragma diagnostic ignore -Wblahblah, but I couldn’t find a “blahblah” that matched the warning I was getting.
I’m pretty sure you’re supposed to use the provided macros to get the correct types out. For example, taken from the gl3w OpenGL extension loader (you have to run the python script to get it to generate code like this), it has lines that look like:
That weird
PFNGLBINDIMAGETEXTUREPROCin the middle is a macro for the correct function type of theglBindImageTexturefunction (you can see its name is actuallyPointerFunctioNGLBINDIMAGETEXTUREPROC).