c_client.py: avoid field name clash with C++ 'explicit' keyword

Submitted by Klemens Baum on Dec. 25, 2015, 6:28 p.m.

Details

Message ID 1451068100-3042-1-git-send-email-klemens.baum@gmail.com
State New
Headers show
Series "c_client.py: avoid field name clash with C++ 'explicit' keyword" ( rev: 1 ) in XCB

Not browsing as part of any series.

Commit Message

Klemens Baum Dec. 25, 2015, 6:28 p.m.
This was causing compilation errors when xcb/xkb.h is included
in a C++ code base.
---
 src/c_client.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/c_client.py b/src/c_client.py
index c38b434..e4c3f89 100644
--- a/src/c_client.py
+++ b/src/c_client.py
@@ -17,9 +17,10 @@  _cname_special_cases = {'DECnet':'decnet'}
 
 _extension_special_cases = ['XPrint', 'XCMisc', 'BigRequests']
 
-_cplusplus_annoyances = {'class' : '_class',
-                         'new'   : '_new',
-                         'delete': '_delete'}
+_cplusplus_annoyances = {'class'   : '_class',
+                         'new'     : '_new',
+                         'delete'  : '_delete',
+                         'explicit': '_explicit'}
 _c_keywords = {'default' : '_default'}
 
 _hlines = []

Comments

On Fri, Dec 25, 2015 at 07:28:20PM +0100, Klemens Baum wrote:
> This was causing compilation errors when xcb/xkb.h is included
> in a C++ code base.

This change would cause an API break for xcb-xkb, wouldn't it?  The ABI
would remain compatible, but code written for the previous API wouldn't
compile.

> --- a/src/c_client.py
> +++ b/src/c_client.py
> @@ -17,9 +17,10 @@ _cname_special_cases = {'DECnet':'decnet'}
>  
>  _extension_special_cases = ['XPrint', 'XCMisc', 'BigRequests']
>  
> -_cplusplus_annoyances = {'class' : '_class',
> -                         'new'   : '_new',
> -                         'delete': '_delete'}
> +_cplusplus_annoyances = {'class'   : '_class',
> +                         'new'     : '_new',
> +                         'delete'  : '_delete',
> +                         'explicit': '_explicit'}
>  _c_keywords = {'default' : '_default'}
>  
>  _hlines = []
> -- 
> 2.4.6
> 
> _______________________________________________
> Xcb mailing list
> Xcb@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/xcb
Alright, I wasn't sure of this project's stance on API compatibility.
So, that does make it a little more complicated, but we can have both
names in C mode with an anonymous union. See follow-up patch.

Klemens Baum (1):
  c_client.py: avoid field name clash with C++ 'explicit' keyword

 src/c_client.py | 74 ++++++++++++++++++++++++++++++++++++++-------------------
 1 file changed, 50 insertions(+), 24 deletions(-)

--
2.6.4