aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRonan Lamy <ronan.lamy@gmail.com>2020-10-22 21:10:51 +0100
committerRonan Lamy <ronan.lamy@gmail.com>2020-10-22 21:10:51 +0100
commit500ccc21f1ca20337538530e0e1c596d1a22f64f (patch)
tree6b1b400af9cbb462265accee518e4399e6a9a47d /rpython/tool/cparser/cts.py
parentMove cpyext-specific test back to cpyext (diff)
downloadpypy-500ccc21f1ca20337538530e0e1c596d1a22f64f.tar.gz
pypy-500ccc21f1ca20337538530e0e1c596d1a22f64f.tar.bz2
pypy-500ccc21f1ca20337538530e0e1c596d1a22f64f.zip
Configure named structs, without requiring a spurious typedef
Diffstat (limited to 'rpython/tool/cparser/cts.py')
-rw-r--r--rpython/tool/cparser/cts.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/rpython/tool/cparser/cts.py b/rpython/tool/cparser/cts.py
index da66064332..ab9b781bd3 100644
--- a/rpython/tool/cparser/cts.py
+++ b/rpython/tool/cparser/cts.py
@@ -106,6 +106,12 @@ class CTypeSpace(object):
assert name not in self.macros
self.macros[name] = value
+ def add_struct(self, name, obj, quals):
+ tp = self.convert_type(obj, quals)
+ if isinstance(tp, DelayedStruct):
+ tp = self.realize_struct(tp)
+ self.structs[obj] = tp
+
def new_struct(self, obj):
if obj.name == '_IO_FILE': # cffi weirdness
return cname_to_lltype('FILE')
@@ -161,6 +167,9 @@ class CTypeSpace(object):
elif name.startswith('macro '):
name = name[6:]
self.add_macro(name, obj)
+ elif name.startswith('struct '):
+ name = name[7:]
+ self.add_struct(name, obj, quals)
if not self._config_entries:
return
eci = self.build_eci()