Bug 63485

Summary: "private" member variable in weston_surface struct is a reserved keyword in C++
Product: Wayland Reporter: U. Artie Eoff <ullysses.a.eoff>
Component: westonAssignee: Wayland bug list <wayland-bugs>
Status: VERIFIED INVALID QA Contact:
Severity: blocker    
Priority: medium    
Version: 1.0.x   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description U. Artie Eoff 2013-04-12 18:48:36 UTC
"private" is a reserved keyword in C++...

"weston/compositor.h" cannot be included in a C++ program because "struct weston_surface" has a member variable named "private"... thus preventing the C++ program from compiling:

install/include/weston/compositor.h:503:8: error: expected unqualified-id before 'private'
install/include/weston/compositor.h:503:7: error: expected ';' at end of member declaration
install/include/weston/compositor.h:503:15: error: expected ':' before ';' token

This was fixed on "master" with the following patch and needs to be backported to the "1.0" branch:

commit 7fe01b18d89ad8d59d0c6285d37e70004606b76f
Author: Giulio Camuffo <giuliocamuffo@gmail.com>
Date:   Thu Mar 28 18:02:42 2013 +0100

    sdk: be C++ friendly
    
    This renames the weston_surface's private member to configure_private
    and externs "C" the headers of the SDK.
Comment 1 Kristian Høgsberg 2013-04-12 19:44:13 UTC
We can't fix this in a stable release series, it breaks the module API.  What you can do is say

#define private configure_private
#include "compositor.h"
#undef private

to work around the problem.

Kristian
Comment 2 U. Artie Eoff 2013-04-12 19:52:48 UTC
(In reply to comment #1)
> We can't fix this in a stable release series, it breaks the module API. 
> What you can do is say
> 
> #define private configure_private
> #include "compositor.h"
> #undef private
> 
> to work around the problem.
> 
> Kristian

We can live with this workaround. Thanks!
Comment 3 U. Artie Eoff 2013-04-12 21:39:03 UTC
(In reply to comment #1)
> We can't fix this in a stable release series, it breaks the module API. 
> What you can do is say
> 
> #define private configure_private
> #include "compositor.h"
> #undef private
> 
> to work around the problem.
> 
> Kristian

extern "C" {
#define private configure_private
#include <weston/compositor.h>
#undef private
}

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.