diff options
Diffstat (limited to 'cffi')
| -rw-r--r-- | cffi/cparser.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/cffi/cparser.py b/cffi/cparser.py index 8ad87db..0456b05 100644 --- a/cffi/cparser.py +++ b/cffi/cparser.py @@ -542,6 +542,10 @@ class Parser(object): if enum.value is not None: nextenumvalue = self._parse_constant(enum.value) enumvalues.append(nextenumvalue) + if enum.name in self._int_constants: + raise api.FFIError( + "multiple declarations of constant %s" % (enum.name,)) + self._int_constants[enum.name] = nextenumvalue nextenumvalue += 1 enumvalues = tuple(enumvalues) @@ -556,3 +560,9 @@ class Parser(object): kind = name.split(' ', 1)[0] if kind in ('typedef', 'struct', 'union', 'enum'): self._declare(name, tp) + for k, v in other._int_constants.items(): + if k not in self._int_constants: + self._int_constants[k] = v + else: + raise api.FFIError( + "multiple declarations of constant %s" % (k,)) |
