summaryrefslogtreecommitdiff
path: root/cffi/cparser.py
diff options
context:
space:
mode:
authorArmin Rigo <arigo@tunes.org>2015-11-02 16:17:45 +0100
committerArmin Rigo <arigo@tunes.org>2015-11-02 16:17:45 +0100
commit20620bc23047ac7881c6bc1405d09372e2a2a694 (patch)
tree5a807e792732e1b9fa2f2e08c58cc64ecdddad0a /cffi/cparser.py
parent8fd00f3065c0421c38017e4b61197f85d71a9995 (diff)
downloadcffi-20620bc23047ac7881c6bc1405d09372e2a2a694.tar.gz
Fix the error we get for 'int f(unknown_type);'
Diffstat (limited to 'cffi/cparser.py')
-rw-r--r--cffi/cparser.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/cffi/cparser.py b/cffi/cparser.py
index 78bd01a..eb7d383 100644
--- a/cffi/cparser.py
+++ b/cffi/cparser.py
@@ -456,6 +456,13 @@ class Parser(object):
def _parse_function_type(self, typenode, funcname=None):
params = list(getattr(typenode.args, 'params', []))
+ for i, arg in enumerate(params):
+ if not hasattr(arg, 'type'):
+ raise api.CDefError("%s arg %d: unknown type '%s'"
+ " (if you meant to use the old C syntax of giving"
+ " untyped arguments, it is not supported)"
+ % (funcname or 'in expression', i + 1,
+ getattr(arg, 'name', '?')))
ellipsis = (
len(params) > 0 and
isinstance(params[-1].type, pycparser.c_ast.TypeDecl) and