<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, May 28, 2015 at 6:30 PM, Giulio Camuffo <span dir="ltr"><<a href="mailto:giuliocamuffo@gmail.com" target="_blank">giuliocamuffo@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">We were emitting the extern declarations of all types used in the protocol,<br>
even if not defined in it. This caused warnings to be produced when using<br>
the -Wredundant-decls compiler flag when building an extension that uses<br>
e.g. wl_surface. However we only need the extern declarations if the<br>
protocol defines a factory for those external interfaces. That is a<br>
bad design and can be however done by including the dependent protocol<br>
header first.<br>
So only emit the extern declarations for the types that the protocol<br>
actually defines, this restoring the behavior we were using in 1.7.<br>
<br>
Fixes <a href="https://bugs.freedesktop.org/show_bug.cgi?id=90677" target="_blank">https://bugs.freedesktop.org/show_bug.cgi?id=90677</a><br>
---<br>
src/scanner.c | 10 +++-------<br>
1 file changed, 3 insertions(+), 7 deletions(-)<br>
<br>
diff --git a/src/scanner.c b/src/scanner.c<br>
index 11efffc..4ab7d85 100644<br>
--- a/src/scanner.c<br>
+++ b/src/scanner.c<br>
@@ -1089,18 +1089,14 @@ emit_header(struct protocol *protocol, enum side side)<br>
printf("struct %s;\n", *p);<br>
prev = *p;<br>
}<br>
+ wl_array_release(&types);<br>
printf("\n");<br>
<br>
- prev = NULL;<br>
- wl_array_for_each(p, &types) {<br>
- if (prev && strcmp(*p, prev) == 0)<br>
- continue;<br>
+ wl_list_for_each(i, &protocol->interface_list, link) {<br>
printf("extern const struct wl_interface "<br>
- "%s_interface;\n", *p);<br>
- prev = *p;<br>
+ "%s_interface;\n", i->name);<br>
}<br>
<br>
- wl_array_release(&types);<br>
printf("\n");<br>
<br>
wl_list_for_each(i, &protocol->interface_list, link) {</blockquote><div><br></div><div>Tested-by: Arnaud Vrac <<a href="mailto:rawoul@gmail.com">rawoul@gmail.com</a>></div></div><div><br></div>-- <br><div class="gmail_signature">Arnaud Vrac</div>
</div></div>