diff options
author | Max Belanger <aeromax@gmail.com> | 2015-08-27 17:47:17 -0700 |
---|---|---|
committer | Max Belanger <aeromax@gmail.com> | 2015-08-27 17:47:17 -0700 |
commit | 0a7cd7d2be0883f5cdccb6a6665ab2445785d4ca (patch) | |
tree | a0a507229d31343c91a435dec1359e5b7c09f399 /cffi/cparser.py | |
parent | 7b3377d5b5762ec70c601a316a9fd6655a65d240 (diff) | |
download | cffi-0a7cd7d2be0883f5cdccb6a6665ab2445785d4ca.tar.gz |
Add support for `typedef float... foo_t`.
Diffstat (limited to 'cffi/cparser.py')
-rw-r--r-- | cffi/cparser.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/cffi/cparser.py b/cffi/cparser.py index cba6308..5f24312 100644 --- a/cffi/cparser.py +++ b/cffi/cparser.py @@ -648,10 +648,18 @@ class Parser(object): assert typenames[-1] == '__dotdotdot__' if len(typenames) == 1: return model.unknown_type(decl.name) + + result = None for t in typenames[:-1]: - if t not in ['int', 'short', 'long', 'signed', 'unsigned', 'char']: + if t in ('int', 'short', 'long', 'signed', 'unsigned', 'char'): + result = model.UnknownIntegerType(decl.name) + elif t in ('float', 'double'): + result = model.UnknownFloatType(decl.name) + else: raise api.FFIError(':%d: bad usage of "..."' % decl.coord.line) + if self._uses_new_feature is None: self._uses_new_feature = "'typedef %s... %s'" % ( ' '.join(typenames[:-1]), decl.name) - return model.UnknownIntegerType(decl.name) + + return result |