Bug 73193

Summary: False positive warnings with gcc's -Wundef
Product: cairo Reporter: Brendan Long <self>
Component: generalAssignee: Chris Wilson <chris>
Status: RESOLVED MOVED QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: Patch to set disabled feature macros to 0 instead of undefined

Description Brendan Long 2013-12-31 19:51:58 UTC
Created attachment 91377 [details]
Patch to set disabled feature macros to 0 instead of undefined

I'm trying to clean out gcc warnings in WebKitGTK, and running into this one:

In file included from ../../Source/WebCore/platform/graphics/cairo/CairoUtilities.cpp:42:0:
/usr/include/cairo/cairo-gl.h:113:5: error: "CAIRO_HAS_WGL_FUNCTIONS" is not defined [-Werror=undef]
 #if CAIRO_HAS_WGL_FUNCTIONS

Theoretically, gcc shouldn't be complaining about this because Cairo is a system library, but it does, and I can't figure out why (the -I lines are from pkg-config so I can't easily fix them). The easiest solution seems to be to fix this in Cairo.

The attached patch defines all undefined feature flags to 0. I tried to keep the semantics exactly the same, and as similar as possible to the original output, so if that's not necessarily I could simply if it more:

  * The current version has lines like this:

        /*#undef CAIRO_HAS_WGL_FUNCTIONS */

    I assume this so users can `#define CAIRO_HAS_WGL_FUNCTIONS 1` and override the default. To have the same semantics, I wrapped by definitions in `#ifndef` checks.

  * There's a fairly complex `for` loop to keep the disabled features list sorted (since sorting the entire output would put the #defines first, then the #endifs, then the #ifndefs..).
Comment 1 GitLab Migration User 2018-08-25 13:37:20 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/cairo/cairo/issues/103.

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.