[Wayland-bugs] [Bug 90677] redundant declarations compiler warnings in protocol headers
bugzilla-daemon at freedesktop.org
bugzilla-daemon at freedesktop.org
Wed May 27 06:16:19 PDT 2015
https://bugs.freedesktop.org/show_bug.cgi?id=90677
Bug ID: 90677
Summary: redundant declarations compiler warnings in protocol
headers
Product: Wayland
Version: unspecified
Hardware: Other
OS: All
Status: NEW
Severity: normal
Priority: medium
Component: wayland
Assignee: wayland-bugs at lists.freedesktop.org
Reporter: rawoul at gmail.com
Since commit e799b1fa9c (scanner: add a new --include-core-only option), the
compiler outputs warnings in some cases when using the -Wredundant-decls flag.
Generated protocol headers include forward declarations for the protocol
interfaces type, and extern declarations for the interfaces implementation. The
new code also adds those declarations for interfaces that are defined by
another extension. This can lead to redundant declarations.
For example, if we have an extension protocol with the following interface:
<interface name="foo" version="1">
<request name="bar">
<arg name="a" type="object" interface="wl_surface"/>
</request>
</interface>
The foo-client-protocol.h file will declare:
struct wl_surface;
extern const struct wl_interface wl_surface_interface;
which are already declared in wayland-client-protocol.h. So the compiler will
output a warning if both headers are included.
Here are solutions thought of on IRC:
1/ only add the extern declarations in the protocol header for interfaces
declared in the xml file, not for interfaces that are from a different
extension. This is the old behaviour and only breaks client code that uses
requests which create an object from a different extension. This is bad design,
and can be easily fixed by including the other extension protocol header first.
2/ guard each extern declaration with an #ifndef. This will not work when
mixing with old headers which do not have the guards.
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/wayland-bugs/attachments/20150527/3a431272/attachment.html>
More information about the wayland-bugs
mailing list