<html>
<head>
<base href="https://bugs.freedesktop.org/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - redundant declarations compiler warnings in protocol headers"
href="https://bugs.freedesktop.org/show_bug.cgi?id=90677">90677</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>redundant declarations compiler warnings in protocol headers
</td>
</tr>
<tr>
<th>Product</th>
<td>Wayland
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Other
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>medium
</td>
</tr>
<tr>
<th>Component</th>
<td>wayland
</td>
</tr>
<tr>
<th>Assignee</th>
<td>wayland-bugs@lists.freedesktop.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>rawoul@gmail.com
</td>
</tr></table>
<p>
<div>
<pre>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.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>