From 636d6acc7adf8bf7169d38833340161dc42d3484 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 14 Jan 2017 22:13:49 +0000 Subject: Bindings: Fix handling of forward declarations It is not appropriate to decorate each forward declaration with the SIP attribute /External/. That is only needed for forward declarations of types which are defined in a different module. Local forward declarations can be omitted from the sip code. In sip code, a forward declaration followed later by a full class definition is an error. Omit forward declarations unless they are decorated with the external attribute. Introduce a rules database for consumers to decorate them with the attribute as required. --- tests/GenerateSipBindings/testscript.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'tests/GenerateSipBindings/testscript.py') diff --git a/tests/GenerateSipBindings/testscript.py b/tests/GenerateSipBindings/testscript.py index 9faea837..9e12bd17 100644 --- a/tests/GenerateSipBindings/testscript.py +++ b/tests/GenerateSipBindings/testscript.py @@ -26,6 +26,22 @@ 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) +lfd = PyTest.CppLib.LocalFwdDecl(18) + +assert(mo.localFwdDecl(lfd) == 18) + +import PyTest.ExternalLib + +efd = PyTest.ExternalLib.ExternalFwdDecl(18) + +assert(mo.externalFwdDecl(efd) == 18) + +assert(mo.localListDecl([1, 5, 7]) == 13) + +lfdl = [PyTest.CppLib.LocalFwdDecl(3), PyTest.CppLib.LocalFwdDecl(6)] + +assert(mo.localDeclListDecl(lfdl) == 9) + # # Verify that an enum with attributes can be read. # -- cgit v1.2.1