diff options
author | Christian Linhart <chris@demorecorder.com> | 2014-09-04 17:50:48 +0200 |
---|---|---|
committer | Christian Linhart <chris@demorecorder.com> | 2014-11-03 11:23:16 +0100 |
commit | 6234225b4be862c5882bf547d066c5a3885906dd (patch) | |
tree | 8fdc310f5ae4ccdea2dface9f05ecdbe86c3aae6 /src | |
parent | 18ff453edd42712ea4d1e7218bbe8829f9f4caba (diff) |
generator: no type-setup for eventcopies anymore
_c_type_setup is not called for eventcopies anymore:
Reasons:
* the type-setup of an eventcopy would overwrite members of the original
event object such as c_type, ...
* it is needed for the next patch, i.e., generating accessors:
type_setup would create sizeof-etc funtions which called
undefined accessor functions.
Sizeof-functions are generated for compatibility:
Reason:
* Type-setup of eventcopies has previously generated
sizeof-functions for eventcopies.
So, we still need to generate these functions.
These new sizeof-functions simply call the sizeof-function
of the defining event of the eventcopy.
Message-ID: <1409845851-38950-1-git-send-email-chris@demorecorder.com>
Patch-Thread-Subject: [Xcb] support popcount of a list and associated xml changes
Patch-Set: PopcountList
Patch-Number: libxcb 1/4
Patch-Version: V1
Signed-off-by: Christian Linhart <chris@DemoRecorder.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/c_client.py | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/c_client.py b/src/c_client.py index 21359b5..9c55b58 100644 --- a/src/c_client.py +++ b/src/c_client.py @@ -3075,7 +3075,14 @@ def c_event(self, name): force_packed = any(f.type.size == 8 and f.type.is_simple for f in self.fields[(idx+1):]) break - _c_type_setup(self, name, ('event',)) + if self.name == name: + _c_type_setup(self, name, ('event',)) + else: + # no type-setup needed for eventcopies + # (the type-setup of an eventcopy would overwrite members of the original + # event, and it would create sizeof-etc funtions which + # called undefined accessor functions) + pass # Opcode define _c_opcode(name, self.opcodes[name]) @@ -3088,6 +3095,22 @@ def c_event(self, name): _h('') _h('typedef %s %s;', _t(self.name + ('event',)), _t(name + ('event',))) + # Create sizeof-function for eventcopies for compatibility reasons + if self.c_need_sizeof: + _h_setlevel(1) + _c_setlevel(1) + _h('') + _h('int') + _h('%s (const void *_buffer /**< */);', _n(name + ('sizeof',))) + _c('') + _c('int') + _c('%s (const void *_buffer /**< */)', _n(name + ('sizeof',))) + _c('{'); + _c(' return %s(_buffer);', _n(self.name + ('sizeof',))) + _c('}'); + _h_setlevel(0) + _c_setlevel(0) + _man_event(self, name) def c_error(self, name): |