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.

Closes #594.
This commit is contained in:
William S Fulton 2016-03-31 20:27:36 +01:00
commit 1d62790928
10 changed files with 38 additions and 1 deletions

View file

@ -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.

View file

@ -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
};
};
%}

View file

@ -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);
}

View file

@ -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;

View file

@ -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");

View file

@ -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) {

View file

@ -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");

View file

@ -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,

View file

@ -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);

View file

@ -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");