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] #if CAIRO_HAS_GLX_FUNCTIONS ^ /usr/local/include/cairo/cairo-gl.h:113:5: warning: 'CAIRO_HAS_WGL_FUNCTIONS' is not defined, evaluates to 0 [-Wundef] #if CAIRO_HAS_WGL_FUNCTIONS ^ /usr/local/include/cairo/cairo-gl.h:129:5: warning: 'CAIRO_HAS_EGL_FUNCTIONS' is not defined, evaluates to 0 [-Wundef] #if CAIRO_HAS_EGL_FUNCTIONS ^
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. To ssh://git.cairographics.org/git/cairo 776dd20..c8b6c60 master -> master commit c8b6c6066a238cf4cb04679e1149e956b1556a0c Author: Koop Mast <kwm@rainbow-runner.nl> Date: Mon Jan 5 12:49:25 2015 +0100 cairo-gl: Fix compiler warning if CAIRO_HAS_*_FUNCTIONS is not defined. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=88050 [Updated to also still check the value of the macros] Signed-off-by: Bryce Harrington <bryce@osg.samsung.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.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.