Created attachment 111763 [details]
Wrap the CAIRO_HAS_*_FUNCTIONS of the #if checks in a defined()
When building a program that uses the cairo-gl.h from cairo 1.14.0 with clang 3.5. The compiler prints out the following warnings:
/usr/local/include/cairo/cairo-gl.h:95:5: warning: 'CAIRO_HAS_GLX_FUNCTIONS' is not defined, evaluates to 0 [-Wundef]
/usr/local/include/cairo/cairo-gl.h:113:5: warning: 'CAIRO_HAS_WGL_FUNCTIONS' is not defined, evaluates to 0 [-Wundef]
/usr/local/include/cairo/cairo-gl.h:129:5: warning: 'CAIRO_HAS_EGL_FUNCTIONS' is not defined, evaluates to 0 [-Wundef]
Potentially any of those could be defined as 0, so we still should check the actual value of the macro in these tests. But otherwise LGTM.
776dd20..c8b6c60 master -> master
Author: Koop Mast <firstname.lastname@example.org>
Date: Mon Jan 5 12:49:25 2015 +0100
cairo-gl: Fix compiler warning if CAIRO_HAS_*_FUNCTIONS is not defined.
[Updated to also still check the value of the macros]
Signed-off-by: Bryce Harrington <email@example.com>
This is not a bug, but correct cpp behaviour.
An undefined macro is evaluated as 0.
The preference is to use #if MACRO_NAME rather than #ifdef.
Koop, if you installed a cairo with GL enabled, then installed cairo without GL over the top, or else if you were using headers from /usr/local/include/cairo but linking a cairo lib from /usr/lib/, then you might get warnings like those. But unfortunately those are not issues we can help with in Cairo, you'll just have to fix your system.
Feel free to reopen if you're reproducing those warnings some other way, that we do need to take into consideration.