diff options
| -rw-r--r-- | find-modules/sip_generator.py | 7 | ||||
| -rw-r--r-- | tests/GenerateSipBindings/cpplib.h | 5 | ||||
| -rw-r--r-- | tests/GenerateSipBindings/testscript.py | 6 | 
3 files changed, 16 insertions, 2 deletions
| diff --git a/find-modules/sip_generator.py b/find-modules/sip_generator.py index 10be1477..e3101fb1 100644 --- a/find-modules/sip_generator.py +++ b/find-modules/sip_generator.py @@ -344,8 +344,11 @@ class SipGenerator(object):          decl = pad + "enum {} {{\n".format(enum.displayname)          enumerations = []          for enum in enum.get_children(): -            enumerations.append(pad + "    {}".format(enum.displayname)) -            assert enum.kind == CursorKind.ENUM_CONSTANT_DECL +            # +            # Skip visibility attributes and the like. +            # +            if enum.kind == CursorKind.ENUM_CONSTANT_DECL: +                enumerations.append(pad + "    {}".format(enum.displayname))          decl += ",\n".join(enumerations) + "\n"          decl += pad + "}"          return decl diff --git a/tests/GenerateSipBindings/cpplib.h b/tests/GenerateSipBindings/cpplib.h index 0d63c30e..932b3b67 100644 --- a/tests/GenerateSipBindings/cpplib.h +++ b/tests/GenerateSipBindings/cpplib.h @@ -113,3 +113,8 @@ private:  };  } + +enum __attribute__((visibility("default"))) EnumWithAttributes { +    Foo, +    Bar = 2 +}; diff --git a/tests/GenerateSipBindings/testscript.py b/tests/GenerateSipBindings/testscript.py index 6f2132a2..973d428c 100644 --- a/tests/GenerateSipBindings/testscript.py +++ b/tests/GenerateSipBindings/testscript.py @@ -26,6 +26,12 @@ assert(mo.const_parameters(30, mo) == 10)  assert(mo.qtEnumTest(QtCore.Qt.MatchContains | QtCore.Qt.MatchStartsWith) == 3)  assert(mo.localEnumTest(PyTest.CppLib.MyObject.Val2) == 2) +# +# Verify that an enum with attributes can be read. +# +assert(PyTest.CppLib.Foo == 0) +assert(PyTest.CppLib.Bar == 2) +  class Reactor(QtCore.QObject):      def __init__(self, obj):          QtCore.QObject.__init__(self) | 
