Replace unknown enums with int in the wrappers
An enum can be declared outside of the code wrapped by SWIG, just use int instead of it then.
This commit is contained in:
parent
41d46460b8
commit
e2bb89ccb3
2 changed files with 14 additions and 8 deletions
|
|
@ -27,7 +27,6 @@ CPP_TEST_CASES := \
|
||||||
# The following tests are currently broken and need to be fixed.
|
# The following tests are currently broken and need to be fixed.
|
||||||
FAILING_C_TESTS := \
|
FAILING_C_TESTS := \
|
||||||
arrays \
|
arrays \
|
||||||
enum_missing \
|
|
||||||
funcptr \
|
funcptr \
|
||||||
function_typedef \
|
function_typedef \
|
||||||
lextype \
|
lextype \
|
||||||
|
|
|
||||||
|
|
@ -1362,17 +1362,24 @@ ready:
|
||||||
String* const int_type_str = NewStringf("int%s", unnamed_end + 1);
|
String* const int_type_str = NewStringf("int%s", unnamed_end + 1);
|
||||||
Delete(type_str);
|
Delete(type_str);
|
||||||
type_str = int_type_str;
|
type_str = int_type_str;
|
||||||
|
} else {
|
||||||
|
scoped_dohptr btype(SwigType_base(type));
|
||||||
|
if (SwigType_isenum(btype)) {
|
||||||
|
// Enums are special as they can be unknown, i.e. not wrapped by SWIG. In this case we just use int instead.
|
||||||
|
if (!enumLookup(btype)) {
|
||||||
|
Replaceall(type_str, btype, "int");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// Don't bother with checking if type is representable in C if we're wrapping C and not C++ anyhow: of course it is.
|
// Don't bother with checking if type is representable in C if we're wrapping C and not C++ anyhow: of course it is.
|
||||||
if (CPlusPlus) {
|
if (CPlusPlus) {
|
||||||
if (SwigType_isreference(type))
|
if (SwigType_isreference(type))
|
||||||
return NIL;
|
return NIL;
|
||||||
|
|
||||||
scoped_dohptr btype(SwigType_base(type));
|
if (!SwigType_isbuiltin(btype))
|
||||||
if (!SwigType_isbuiltin(btype) && !SwigType_isenum(btype))
|
|
||||||
return NIL;
|
return NIL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
String* const var_decl = NewStringEmpty();
|
String* const var_decl = NewStringEmpty();
|
||||||
if (SwigType_isarray(type)) {
|
if (SwigType_isarray(type)) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue