Bug 73193 - False positive warnings with gcc's -Wundef
Summary: False positive warnings with gcc's -Wundef
Status: RESOLVED MOVED
Alias: None
Product: cairo
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Chris Wilson
QA Contact: cairo-bugs mailing list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-12-31 19:51 UTC by Brendan Long
Modified: 2018-08-25 13:37 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Patch to set disabled feature macros to 0 instead of undefined (963 bytes, text/plain)
2013-12-31 19:51 UTC, Brendan Long
Details

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.