diff --git a/CHANGES.current b/CHANGES.current index f3976c5f4..bf8c4d644 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -6,7 +6,13 @@ Version 3.0.9 (in progress) =========================== 2016-03-31: wsfulton - [Java] unsigned long long marshalling improvements when a negative number + Fixes #594. Fix assertion for some languages when wrapping a C++11 enum class that + is private in a class. + + Also don't wrap private enums for a few languages that attempted to do so. + +2016-03-31: wsfulton + [Java] unsigned long long marshalling improvements when a negative number is passed from Java to C. A cast to signed long long in the C layer will now result in the expected value. No change for positive numbers passed to C. Fixes #623. diff --git a/Examples/test-suite/cpp11_strongly_typed_enumerations.i b/Examples/test-suite/cpp11_strongly_typed_enumerations.i index 3a4ee107a..64fdd2b6f 100644 --- a/Examples/test-suite/cpp11_strongly_typed_enumerations.i +++ b/Examples/test-suite/cpp11_strongly_typed_enumerations.i @@ -214,5 +214,12 @@ Enum1 globalTest1(Enum1 e) { return e; } Class1::Enum12 globalTest2(Class1::Enum12 e) { return e; } Class1::Struct1::Enum12 globalTest3(Class1::Struct1::Enum12 e) { return e; } +class PrivateEnumClass { +private: + enum class Enum { + PrivateEnum1, + PrivateEnum2 + }; +}; %} diff --git a/Source/Modules/allegrocl.cxx b/Source/Modules/allegrocl.cxx index fae255b7f..1585180bd 100644 --- a/Source/Modules/allegrocl.cxx +++ b/Source/Modules/allegrocl.cxx @@ -3166,6 +3166,9 @@ int ALLEGROCL::enumDeclaration(Node *n) { Printf(stderr, "enumDeclaration %s\n", Getattr(n, "name")); #endif + if (getCurrentClass() && (cplus_mode != PUBLIC)) + return SWIG_NOWRAP; + if (Getattr(n, "sym:name")) { add_defined_foreign_type(n); } diff --git a/Source/Modules/cffi.cxx b/Source/Modules/cffi.cxx index 35efaed70..c355e452a 100644 --- a/Source/Modules/cffi.cxx +++ b/Source/Modules/cffi.cxx @@ -688,6 +688,9 @@ int CFFI::typedefHandler(Node *n) { } int CFFI::enumDeclaration(Node *n) { + if (getCurrentClass() && (cplus_mode != PUBLIC)) + return SWIG_NOWRAP; + String *name = Getattr(n, "sym:name"); bool slot_name_keywords; String *lisp_name = 0; diff --git a/Source/Modules/clisp.cxx b/Source/Modules/clisp.cxx index 7d7c69a50..d7f197197 100644 --- a/Source/Modules/clisp.cxx +++ b/Source/Modules/clisp.cxx @@ -242,6 +242,9 @@ int CLISP::typedefHandler(Node *n) { } int CLISP::enumDeclaration(Node *n) { + if (getCurrentClass() && (cplus_mode != PUBLIC)) + return SWIG_NOWRAP; + is_function = 0; String *name = Getattr(n, "sym:name"); diff --git a/Source/Modules/go.cxx b/Source/Modules/go.cxx index f2661f1b6..c34d423ba 100644 --- a/Source/Modules/go.cxx +++ b/Source/Modules/go.cxx @@ -2712,6 +2712,9 @@ private: * ---------------------------------------------------------------------- */ virtual int enumDeclaration(Node *n) { + if (getCurrentClass() && (cplus_mode != PUBLIC)) + return SWIG_NOWRAP; + String *name = goEnumName(n); if (Strcmp(name, "int") != 0) { if (!ImportMode || !imported_package) { diff --git a/Source/Modules/lang.cxx b/Source/Modules/lang.cxx index e23eefb8f..9b1173443 100644 --- a/Source/Modules/lang.cxx +++ b/Source/Modules/lang.cxx @@ -1649,6 +1649,9 @@ int Language::externDeclaration(Node *n) { * ---------------------------------------------------------------------- */ int Language::enumDeclaration(Node *n) { + if (CurrentClass && (cplus_mode != PUBLIC)) + return SWIG_NOWRAP; + String *oldNSpace = NSpace; NSpace = Getattr(n, "sym:nspace"); diff --git a/Source/Modules/lua.cxx b/Source/Modules/lua.cxx index 12e8d10ba..1b4c8f617 100644 --- a/Source/Modules/lua.cxx +++ b/Source/Modules/lua.cxx @@ -1157,6 +1157,9 @@ public: * ------------------------------------------------------------ */ virtual int enumDeclaration(Node *n) { + if (getCurrentClass() && (cplus_mode != PUBLIC)) + return SWIG_NOWRAP; + current[STATIC_CONST] = true; current[ENUM_CONST] = true; // There is some slightly specific behaviour with enums. Basically, diff --git a/Source/Modules/ocaml.cxx b/Source/Modules/ocaml.cxx index 1c5ceefaa..9df6a9551 100644 --- a/Source/Modules/ocaml.cxx +++ b/Source/Modules/ocaml.cxx @@ -1287,6 +1287,9 @@ public: * typedef enum and enum are handled. I need to produce consistent names, * which means looking up and registering by typedef and enum name. */ int enumDeclaration(Node *n) { + if (getCurrentClass() && (cplus_mode != PUBLIC)) + return SWIG_NOWRAP; + String *name = Getattr(n, "name"); if (name) { String *oname = NewString(name); diff --git a/Source/Modules/r.cxx b/Source/Modules/r.cxx index 758cb00ee..a5aec50eb 100644 --- a/Source/Modules/r.cxx +++ b/Source/Modules/r.cxx @@ -1179,6 +1179,9 @@ int R::OutputArrayMethod(String *className, List *el, File *out) { tdname is the typedef of the enumeration, i.e. giving its name. *************************************************************/ int R::enumDeclaration(Node *n) { + if (getCurrentClass() && (cplus_mode != PUBLIC)) + return SWIG_NOWRAP; + String *name = Getattr(n, "name"); String *tdname = Getattr(n, "tdname");