Bug 63485 - "private" member variable in weston_surface struct is a reserved keyword in C++
Summary: "private" member variable in weston_surface struct is a reserved keyword in C++
Status: VERIFIED INVALID
Alias: None
Product: Wayland
Classification: Unclassified
Component: weston (show other bugs)
Version: 1.0.x
Hardware: Other All
: medium blocker
Assignee: Wayland bug list
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-12 18:48 UTC by U. Artie Eoff
Modified: 2013-04-12 21:39 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

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.