Bug 51740

Summary: [PATCH] wayland-scanner client-header generates code that needs to include wayland-client.h
Product: Wayland Reporter: Robert Ancell <robert.ancell>
Component: waylandAssignee: Wayland bug list <wayland-bugs>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: Include weston-client.h as the inline functions require it

Description Robert Ancell 2012-07-04 21:35:41 UTC
Created attachment 63843 [details] [review]
Include weston-client.h as the inline functions  require it

The code generated using wayland-scanner doesn't include wayland-client.h but uses functions from that header, e.g.:

  CC     lightdm-seat-weston.o
In file included from seat-weston.c:20:0:
weston-protocol.h: In function ‘wl_system_client_add_listener’:
weston-protocol.h:42:2: warning: implicit declaration of function ‘wl_proxy_add_listener’ [-Wimplicit-function-declaration]
weston-protocol.h:42:2: warning: nested extern declaration of ‘wl_proxy_add_listener’ [-Wnested-externs]
weston-protocol.h: In function ‘wl_system_client_set_user_data’:
weston-protocol.h:51:2: warning: implicit declaration of function ‘wl_proxy_set_user_data’ [-Wimplicit-function-declaration]
weston-protocol.h:51:2: warning: nested extern declaration of ‘wl_proxy_set_user_data’ [-Wnested-externs]
weston-protocol.h: In function ‘wl_system_client_get_user_data’:
weston-protocol.h:57:2: warning: implicit declaration of function ‘wl_proxy_get_user_data’ [-Wimplicit-function-declaration]
weston-protocol.h:57:2: warning: nested extern declaration of ‘wl_proxy_get_user_data’ [-Wnested-externs]
weston-protocol.h:57:2: warning: return makes pointer from integer without a cast [enabled by default]
weston-protocol.h: In function ‘wl_system_client_terminate’:
weston-protocol.h:63:2: warning: implicit declaration of function ‘wl_proxy_marshal’ [-Wimplicit-function-declaration]
weston-protocol.h:63:2: warning: nested extern declaration of ‘wl_proxy_marshal’ [-Wnested-externs]
weston-protocol.h:66:2: warning: implicit declaration of function ‘wl_proxy_destroy’ [-Wimplicit-function-declaration]
weston-protocol.h:66:2: warning: nested extern declaration of ‘wl_proxy_destroy’ [-Wnested-externs]
weston-protocol.h: In function ‘wl_display_manager_get_user_data’:
weston-protocol.h:81:2: warning: return makes pointer from integer without a cast [enabled by default]
weston-protocol.h: In function ‘wl_display_manager_add_client’:
weston-protocol.h:95:2: warning: implicit declaration of function ‘wl_proxy_create’ [-Wimplicit-function-declaration]
weston-protocol.h:95:2: warning: nested extern declaration of ‘wl_proxy_create’ [-Wnested-externs]
weston-protocol.h:95:5: warning: assignment makes pointer from integer without a cast [enabled by default]
Comment 1 Kristian Høgsberg 2012-07-10 02:01:54 UTC
Thanks.  I committed your patch with a slight change:

diff --git a/src/scanner.c b/src/scanner.c
index 0076d92..50e26c1 100644
--- a/src/scanner.c
+++ b/src/scanner.c
@@ -868,11 +868,12 @@ emit_header(struct protocol *protocol, int server)
               "\n"
               "#include <stdint.h>\n"
               "#include <stddef.h>\n"
-              "#include \"wayland-util.h\"\n\n"
+              "#include \"%s\"\n\n"
               "struct wl_client;\n"
               "struct wl_resource;\n\n",
               protocol->uppercase_name, s,
-              protocol->uppercase_name, s);
+              protocol->uppercase_name, s,
+              server ? "wayland-util.h" : "wayland-client.h");
 
        wl_list_for_each(i, &protocol->interface_list, link)
                printf("struct %s;\n", i->name);

since we can't include wayland-client.h in the server side protocol header.

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.