Merge branch 'master' into tmp

Conflicts:
	.travis.yml
	Examples/Makefile.in
	Examples/test-suite/director_nspace.i
	Examples/test-suite/nspace.i
	Examples/test-suite/nspace_extend.i
	Source/Modules/lang.cxx
	configure.ac
This commit is contained in:
Oliver Buchtala 2014-03-05 01:09:26 +01:00
commit a234542543
871 changed files with 29690 additions and 7800 deletions

View file

@ -0,0 +1,20 @@
%module c_delete
/* check C++ delete keyword is okay in C wrappers */
#pragma SWIG nowarn=SWIGWARN_PARSE_KEYWORD
#if !defined(SWIGOCTAVE) /* Octave compiles wrappers as C++ */
%inline %{
struct delete {
int delete;
};
%}
%rename(DeleteGlobalVariable) delete;
%inline %{
int delete = 0;
%}
#endif

View file

@ -0,0 +1,11 @@
%module c_delete_function
/* check C++ delete keyword is okay in C wrappers */
#if !defined(SWIGOCTAVE) /* Octave compiles wrappers as C++ */
%inline %{
double delete(double d) { return d; }
%}
#endif

View file

@ -69,17 +69,17 @@ SWIGOPT += -nounit
$(run_testcase)
%.cppproxy:
echo "$(ACTION)ing testcase $* (with run test) under chicken with -proxy"
echo "$(ACTION)ing $(LANGUAGE) testcase $* (with run test) with -proxy"
+$(swig_and_compile_cpp)
$(run_testcase)
%.cproxy:
echo "$(ACTION)ing testcase $* (with run test) under chicken with -proxy"
echo "$(ACTION)ing $(LANGUAGE) testcase $* (with run test) with -proxy"
+$(swig_and_compile_c)
$(run_testcase)
%.multiproxy:
echo "$(ACTION)ing testcase $* (with run test) under chicken with -proxy"
echo "$(ACTION)ing $(LANGUAGE) testcase $* (with run test) with -proxy"
+$(swig_and_compile_multi_cpp)
$(run_testcase)

View file

@ -84,16 +84,19 @@ CPP_TEST_BROKEN += \
extend_variable \
li_std_vector_ptr \
li_boost_shared_ptr_template \
nested_private \
overload_complicated \
rename_camel \
template_default_pointer \
template_expr
template_private_assignment \
template_expr \
$(CPP11_TEST_BROKEN)
# Broken C test cases. (Can be run individually using: make testcase.ctest)
C_TEST_BROKEN += \
tag_no_clash_with_variable
# C++ test cases. (Can be run individually using: make testcase.cpptest)
ifndef SKIP_CPP_CASES
CPP_TEST_CASES += \
@ -195,6 +198,7 @@ CPP_TEST_CASES += \
disown \
dynamic_cast \
empty \
enum_plus \
enum_rename \
enum_scope_template \
enum_template \
@ -243,10 +247,13 @@ CPP_TEST_CASES += \
li_boost_shared_ptr \
li_boost_shared_ptr_bits \
li_boost_shared_ptr_template \
li_boost_shared_ptr_attribute \
li_carrays \
li_cdata \
li_cpointer \
li_std_auto_ptr \
li_stdint \
li_swigtype_inout \
li_typemaps \
li_typemaps_apply \
li_windows \
@ -275,8 +282,11 @@ CPP_TEST_CASES += \
nspace \
nspace_extend \
naturalvar \
naturalvar_more \
naturalvar_onoff \
nested_class \
nested_comment \
nested_scope \
nested_workaround \
newobject1 \
null_pointer \
@ -286,8 +296,9 @@ CPP_TEST_CASES += \
operbool \
ordering \
overload_copy \
overload_method \
overload_extend \
overload_method \
overload_numeric \
overload_rename \
overload_return_type \
overload_simple \
@ -314,6 +325,7 @@ CPP_TEST_CASES += \
rename_strip_encoder \
rename_pcre_encoder \
rename_pcre_enum \
rename_predicates \
restrict_cplusplus \
return_const_value \
return_value_scope \
@ -416,6 +428,7 @@ CPP_TEST_CASES += \
template_typedef_ns \
template_typedef_ptr \
template_typedef_rec \
template_typedef_typedef \
template_typemaps \
template_typemaps_typedef \
template_typemaps_typedef2 \
@ -434,6 +447,7 @@ CPP_TEST_CASES += \
typedef_scope \
typedef_sizet \
typedef_struct \
typedef_typedef \
typemap_arrays \
typemap_array_qualifiers \
typemap_delete \
@ -478,6 +492,44 @@ CPP_TEST_CASES += \
wrapmacro
endif
# C++11 test cases.
CPP11_TEST_CASES = \
cpp11_alternate_function_syntax \
cpp11_constexpr \
cpp11_decltype \
cpp11_default_delete \
cpp11_delegating_constructors \
cpp11_explicit_conversion_operators \
cpp11_final_override \
cpp11_function_objects \
cpp11_inheriting_constructors \
cpp11_initializer_list \
cpp11_initializer_list_extend \
cpp11_lambda_functions \
cpp11_noexcept \
cpp11_null_pointer_constant \
cpp11_raw_string_literals \
cpp11_rvalue_reference \
cpp11_rvalue_reference2 \
cpp11_rvalue_reference3 \
cpp11_sizeof_object \
cpp11_static_assert \
cpp11_thread_local \
cpp11_template_double_brackets \
cpp11_template_explicit \
cpp11_template_typedefs \
cpp11_uniform_initialization \
cpp11_unrestricted_unions \
cpp11_userdefined_literals \
cpp11_variadic_templates
# cpp11_hash_tables \ # not fully implemented yet
# cpp11_result_of \ # SWIG does not support
# cpp11_strongly_typed_enumerations \ # SWIG not quite getting this right yet in all langs
# Broken C++11 test cases.
CPP11_TEST_BROKEN =
#
# Put all the heavy STD/STL cases here, where they can be skipped if needed
#
@ -507,12 +559,17 @@ ifndef SKIP_CPP_STD_CASES
CPP_TEST_CASES += ${CPP_STD_TEST_CASES}
endif
ifneq (,$(HAVE_CXX11_COMPILER))
CPP_TEST_CASES += $(CPP11_TEST_CASES)
endif
# C test cases. (Can be run individually using: make testcase.ctest)
ifndef SKIP_C_CASES
C_TEST_CASES += \
arrays \
bom_utf8 \
c_delete \
c_delete_function \
char_constant \
const_const \
constant_expr \
@ -523,6 +580,7 @@ C_TEST_CASES += \
extern_declaration \
funcptr \
function_typedef \
global_functions \
immutable_values \
inctest \
integers \
@ -590,19 +648,34 @@ ALL_CLEAN = $(CPP_TEST_CASES:=.clean) \
$(CPP_TEST_BROKEN:=.clean) \
$(C_TEST_BROKEN:=.clean)
#######################################################################
# Error test suite has its own set of test cases
#######################################################################
ifneq (,$(ERROR_TEST_CASES))
check: $(ERROR_TEST_CASES)
else
#######################################################################
# The following applies for all module languages
#######################################################################
all: $(BROKEN_TEST_CASES) $(NOT_BROKEN_TEST_CASES)
all: $(NOT_BROKEN_TEST_CASES) $(BROKEN_TEST_CASES)
check: $(NOT_BROKEN_TEST_CASES)
broken: $(BROKEN_TEST_CASES)
check: $(NOT_BROKEN_TEST_CASES)
check-c: $(C_TEST_CASES:=.ctest)
check-cpp: $(CPP_TEST_CASES:=.cpptest)
check-cpp11: $(CPP11_TEST_CASES:=.cpptest)
endif
# partialcheck target runs SWIG only, ie no compilation or running of tests (for a subset of languages)
partialcheck:
$(MAKE) check CC=true CXX=true LDSHARED=true CXXSHARED=true RUNTOOL=true COMPILETOOL=true
broken: $(BROKEN_TEST_CASES)
swig_and_compile_cpp = \
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile CXXSRCS="$(CXXSRCS)" \
SWIG_LIB="$(SWIG_LIB)" SWIG="$(SWIG)" \
@ -641,9 +714,9 @@ swig_and_compile_runtime = \
setup = \
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
echo "$(ACTION)ing testcase $* (with run test) under $(LANGUAGE)" ; \
echo "$(ACTION)ing $(LANGUAGE) testcase $* (with run test)" ; \
else \
echo "$(ACTION)ing testcase $* under $(LANGUAGE)" ; \
echo "$(ACTION)ing $(LANGUAGE) testcase $*" ; \
fi;

View file

@ -94,14 +94,16 @@ public:
namespace Space {
class Flow {
int x;
public:
Flow(int i) {}
Flow(int i) : x(i) {}
};
class FlowFlow {
int x;
public:
FlowFlow(int i) {}
FlowFlow(int i) : x(i) {}
};
}

View file

@ -0,0 +1,18 @@
/* This testcase checks whether SWIG correctly uses the new alternate functions
declarations and definitions introduced in C++11. */
%module cpp11_alternate_function_syntax
%inline %{
struct SomeStruct {
int addNormal(int x, int y);
auto addAlternate(int x, int y) -> int;
};
auto SomeStruct::addAlternate(int x, int y) -> int {
return x + y;
}
int SomeStruct::addNormal(int x, int y) {
return x + y;
}
%}

View file

@ -0,0 +1,12 @@
/* This interface tests whether SWIG supports the new "constexpr" keyword
introduced by C++11.
*/
%module cpp11_constexpr
%inline %{
class TestClass {
public:
constexpr int func() { return 10; }
};
%}

View file

@ -0,0 +1,19 @@
/* This testcase checks whether SWIG correctly uses the new 'decltype()'
introduced in C++11.
*/
%module cpp11_decltype
%inline %{
class A {
public:
int i;
decltype(i) j;
auto foo( decltype(i) a ) -> decltype(i) {
if (a==5)
return 10;
else
return 0;
}
};
%}

View file

@ -0,0 +1,81 @@
/* This testcase checks whether SWIG correctly parses C++11 explicitly defaulted functions and deleted functions */
%module cpp11_default_delete
%warnfilter(SWIGWARN_LANG_OVERLOAD_IGNORED, SWIGWARN_LANG_OVERLOAD_SHADOW) trivial::trivial(trivial&&);
%warnfilter(SWIGWARN_LANG_OVERLOAD_IGNORED, SWIGWARN_LANG_OVERLOAD_SHADOW) trivial::operator =(trivial&&);
%rename(Assignment) *::operator=;
%inline %{
class NonCopyable {
public:
NonCopyable& operator=(const NonCopyable&) = delete; /* Removes operator= */
NonCopyable(const NonCopyable&) = delete; /* Removed copy constructor */
NonCopyable() = default; /* Explicitly allows the empty constructor */
void *operator new(size_t) = delete; /* Removes new NonCopyable */
};
struct A1 {
void func(int i) {}
A1() = default;
~A1() = default;
void func(double i) = delete; /* Don't cast double to int. Compiler returns an error */
private:
A1(const A1&);
};
A1::A1(const A1&) = default;
struct A2 {
void func(int i) {}
virtual void fff(int) = delete;
virtual ~A2() = default;
template<class T> void func(T) = delete;
};
struct trivial {
trivial() = default;
trivial(const trivial&) = default;
trivial(trivial&&) = default;
trivial& operator=(const trivial&) = default;
trivial& operator=(trivial&&) = default;
~trivial() = default;
};
struct nontrivial1 {
nontrivial1();
};
nontrivial1::nontrivial1() = default;
struct sometype {
sometype() = delete;
sometype(int) = delete;
sometype(double);
};
sometype::sometype(double) {}
/* Not working with prerelease of gcc-4.8
struct nonew {
void *operator new(std::size_t) = delete;
void *operator new[](std::size_t) = delete;
};
*/
struct moveonly {
moveonly() = default;
moveonly(const moveonly&) = delete;
moveonly(moveonly&&) = default;
moveonly& operator=(const moveonly&) = delete;
moveonly& operator=(moveonly&&) = default;
~moveonly() = default;
};
struct ConstructorThrow {
ConstructorThrow() throw() = default;
ConstructorThrow(const ConstructorThrow&) throw() = delete;
ConstructorThrow(ConstructorThrow&&) throw() = delete;
ConstructorThrow& operator=(const ConstructorThrow&) throw() = delete;
~ConstructorThrow() throw() = default;
};
%}

View file

@ -0,0 +1,18 @@
/* This test checks whether SWIG correctly parses the new delegating
constructors.
*/
%module cpp11_delegating_constructors
%inline %{
class A {
public:
int a;
int b;
int c;
A() : A( 10 ) {}
A(int aa) : A(aa, 20) {}
A(int aa, int bb) : A(aa, bb, 30) {}
A(int aa, int bb, int cc) { a=aa; b=bb; c=cc; }
};
%}

View file

@ -0,0 +1,28 @@
/* This interface checks whether SWIG correctly compiles the new
explicit conversion operators feature introduced in C++11.
*/
%module cpp11_explicit_conversion_operators
%inline %{
class U {
public:
int u;
};
class V {
public:
int v;
};
class TestClass {
public:
//implicit converting constructor
TestClass( U const &val ) { t=val.u; }
// explicit constructor
explicit TestClass( V const &val ) { t=val.v; }
int t;
};
%}

View file

@ -0,0 +1,128 @@
// Test C++11 virtual specifier sequences (final and/or override on methods)
// Also check final/override - the two 'identifiers with special meaning' work as normal identifiers
%module cpp11_final_override
%warnfilter(SWIGWARN_PARSE_KEYWORD) final; // 'final' is a java keyword, renaming to '_final'
%warnfilter(SWIGWARN_PARSE_KEYWORD) override; // 'override' is a C# keyword, renaming to '_override'
%inline %{
struct Base {
virtual void stuff() const {}
virtual void override1() const {}
virtual void override2() const {}
virtual void finaloverride1() {}
virtual void finaloverride2() {}
virtual void finaloverride3() {}
virtual void finaloverride4() const {}
virtual ~Base() {}
};
struct Derived /*final*/ : Base {
virtual void stuff() const noexcept override final {}
virtual void override1() const noexcept override;
virtual void override2() const noexcept override;
virtual void final1() final {}
virtual void final2() noexcept final {}
virtual void final4() const final {}
virtual void final5() const noexcept final {}
virtual void finaloverride1() final override {}
virtual void finaloverride2() override final {}
virtual void finaloverride3() noexcept override final {}
virtual void finaloverride4() const noexcept override final {}
virtual ~Derived() override final {}
};
void Derived::override2() const noexcept {}
// Pure virtual methods
struct PureBase {
virtual void pure1(int) const = 0;
virtual void pure2(int) const = 0;
virtual void pure3(int) const = 0;
virtual void pure4(int) const = 0;
virtual void pure5(int) const = 0;
virtual ~PureBase() {}
};
struct PureDerived : PureBase {
virtual void pure1(int) const override = 0;
virtual void pure2(int) const final = 0;
virtual void pure3(int) const override final = 0;
virtual void pure4(int) const final override = 0;
virtual void pure5(int) const noexcept final override = 0;
virtual ~PureDerived() override final;
};
void PureDerived::pure1(int) const {}
void PureDerived::pure2(int) const {}
void PureDerived::pure3(int) const {}
void PureDerived::pure4(int) const {}
void PureDerived::pure5(int) const noexcept {}
PureDerived::~PureDerived() {}
// Destructors and virtual specifier sequences (final/override)
struct Destructors1 : Base {
virtual ~Destructors1() override {}
};
struct Destructors2 : Base {
virtual ~Destructors2() final {}
};
struct Destructors3 : Base {
virtual ~Destructors3() noexcept final override {}
};
struct Destructors4 : Base {
virtual ~Destructors4() noexcept override final {}
};
// Check the two 'identifiers with special meaning' work as normal identifiers
struct FinalOverrideMethods {
virtual void final() {}
virtual void override(int) {}
};
struct FinalOverrideVariables {
int final;
double override;
};
void final(int) {}
void override() {}
%}
%{
void Derived::override1() const noexcept {}
%}
// Example in documentation ... declarations only
%inline %{
struct BaseStruct {
virtual void ab() const = 0;
virtual void cd();
virtual void ef();
virtual ~BaseStruct();
};
struct DerivedStruct : BaseStruct {
virtual void ab() const override;
virtual void cd() final;
virtual void ef() final override;
virtual ~DerivedStruct() override;
};
struct DerivedNoVirtualStruct : BaseStruct {
void ab() const override;
void cd() final;
void ef() final override;
~DerivedNoVirtualStruct() override;
};
%}
%{
void BaseStruct::cd() {}
void BaseStruct::ef() {}
BaseStruct::~BaseStruct() {}
void DerivedStruct::ab() const {}
void DerivedStruct::cd() {}
void DerivedStruct::ef() {}
DerivedStruct::~DerivedStruct() {}
void DerivedNoVirtualStruct::ab() const {}
void DerivedNoVirtualStruct::cd() {}
void DerivedNoVirtualStruct::ef() {}
DerivedNoVirtualStruct::~DerivedNoVirtualStruct() {}
%}

View file

@ -0,0 +1,35 @@
/* This testcase checks whether SWIG correctly parses function objects
and the templates for the functions (signature).
Function objects are objects which overload the operator() function.
The std::function does not provide any seamless support in the target languages yet.
*/
%module cpp11_function_objects
%rename(__call__) Test::operator();
%inline %{
struct Test {
int value;
void operator()(int x, int y) {
value=x+y;
}
Test() : value(0) {}
} test;
#include <functional>
std::function<void ( int, int )> pF = test;
int testit1(Test new_test, int a, int b) {
pF = new_test;
pF(a, b);
return new_test.value;
}
int testit2(int a, int b) {
test(a, b);
return test.value;
}
%}

View file

@ -0,0 +1,43 @@
/* This testcase checks the new wrappers for the new unordered_ STL types
introduced in C++11. */
%module cpp11_hash_tables
%inline %{
#include <set>
//#include <map>
#include <unordered_set>
//#include <unordered_map>
%}
%include "std_set.i"
//%include "std_map.i"
%include "std_unordered_set.i"
//%include "std_unordered_map.i"
%template (SetInt) std::set<int>;
//%template (MapIntInt) std::map<int, int>;
%template (UnorderedSetInt) std::unordered_set<int>;
//%template (UnorderedMapIntInt) std::unordered_map<int, int>;
%inline %{
using namespace std;
class MyClass {
public:
set<int> getSet() { return _set; }
void addSet(int elt) { _set.insert(_set.begin(), elt); }
// map<int, int> getMap() { return _map; }
// void addMap(int elt1, int elt2) { _map.insert(make_pair(elt1, elt2)); }
unordered_set<int> getUnorderedSet() { return _unordered_set; }
void addUnorderedSet(int elt) { _unordered_set.insert(_unordered_set.begin(), elt); }
// unordered_map<int, int> getUnorderedMap() { return _unordered_map; }
// void addUnorderedMap(int elt1, int elt2) { _unordered_map.insert(make_pair(elt1, elt2)); }
private:
set<int> _set;
// map<int, int> _map;
unordered_set<int> _unordered_set;
// unordered_map<int, int> _unordered_map;
};
%}

View file

@ -0,0 +1,18 @@
/* This test checks whether SWIG correctly parses the new constructor
inheritance.
*/
%module cpp11_inheriting_constructors
%inline %{
class BaseClass {
private:
int _val;
public:
BaseClass(int iValue) { _val = iValue; }
};
class DerivedClass: public BaseClass {
public:
using BaseClass::BaseClass; // Adds DerivedClass(int) constructor
};
%}

View file

@ -0,0 +1,34 @@
/* This testcase shows a few simple ways to deal with the new initializer_list
introduced in C++11. */
%module cpp11_initializer_list
%warnfilter(SWIGWARN_TYPEMAP_INITIALIZER_LIST) B::B;
%ignore A::A(std::initializer_list<int>);
%ignore B::method;
%typemap(in) std::initializer_list<const char *> {
$1 = {"Ab", "Fab"};
}
%inline %{
#include <initializer_list>
class A {
public:
A(std::initializer_list<int>) {}
A() {}
A(double d) {}
};
class B {
public:
B(std::initializer_list<int>, std::initializer_list<double>) {}
B() {}
void method(std::initializer_list<int> init) {}
};
class C {
public:
C(std::initializer_list<const char *>) {}
C() {}
};
%}

View file

@ -0,0 +1,29 @@
/* This testcase shows how to replace std_initializer_list with std_vector. */
%module cpp11_initializer_list_extend
%ignore Container::Container(std::initializer_list<int>);
%include <std_vector.i>
%template(VectorInt) std::vector<int>;
%extend Container {
Container(const std::vector<int> &elements) {
Container *c = new Container();
for (int element : elements)
c->push_back(element);
return c;
}
}
%inline %{
#include <initializer_list>
class Container {
public:
Container(std::initializer_list<int>) {}
Container() {}
void push_back(const int&) {}
};
%}

View file

@ -0,0 +1,110 @@
/* This testcase checks whether SWIG correctly parses the lambda expressions
and closure syntax introduced in C++11.
SWIG supports only lambda syntax and doesn't produce any wrapper code for
this.
*/
%module cpp11_lambda_functions
%warnfilter(SWIGWARN_CPP11_LAMBDA) lambda1;
%warnfilter(SWIGWARN_CPP11_LAMBDA) lambda2;
%warnfilter(SWIGWARN_CPP11_LAMBDA) lambda3;
%warnfilter(SWIGWARN_CPP11_LAMBDA) lambda4;
%warnfilter(SWIGWARN_CPP11_LAMBDA) lambda5;
%warnfilter(SWIGWARN_CPP11_LAMBDA) lambda6;
%warnfilter(SWIGWARN_CPP11_LAMBDA) lambda7;
%warnfilter(SWIGWARN_CPP11_LAMBDA) lambda8;
%warnfilter(SWIGWARN_CPP11_LAMBDA) lambda9;
%warnfilter(SWIGWARN_CPP11_LAMBDA) lambda10;
%warnfilter(SWIGWARN_CPP11_LAMBDA) lambda11;
%warnfilter(SWIGWARN_CPP11_LAMBDA) lambda12;
%warnfilter(SWIGWARN_CPP11_LAMBDA) lambda13;
%warnfilter(SWIGWARN_CPP11_LAMBDA) lambda14;
%warnfilter(SWIGWARN_CPP11_LAMBDA) lambda15;
%warnfilter(SWIGWARN_CPP11_LAMBDA) lambda16;
%warnfilter(SWIGWARN_CPP11_LAMBDA) lambda17;
%warnfilter(SWIGWARN_CPP11_LAMBDA) lambda18;
%warnfilter(SWIGWARN_CPP11_LAMBDA) Space1::lambda19;
%warnfilter(SWIGWARN_CPP11_LAMBDA) Space1::Space2::lambda20;
%inline %{
/* Defined lambda function with return value. */
auto lambda1 = [](int x, int y) -> int { return x+y; };
/* Defined lambda function without return value.
Return value is calculated by compiler, if the function contains a
single statement "return expr;". */
auto lambda2 = [](int x, int y) { return x+y; };
auto lambda3 = [&](int x, int y) { return x+y; };
auto lambda4 = [=](int x, int y) { return x+y; };
int thing = 0;
#ifdef SWIG
// Not strictly correct as captured variables should have non-automatic storage duration, ie shouldn't capture globals. gcc-4.7 warns about this, but we check that SWIG can parse this anyway.
auto lambda5 = [=,&thing]() { return thing; };
#else
auto lambda5 = [=]() { return thing; };
#endif
void fn() {
int stuff = 0;
auto lambdaxxxx = [=,&stuff]() { return thing; };
}
auto lambda6 = [] (int a, int b) mutable { return a + b; };
auto lambda7 = [] (int x, int y) -> int { return x+y; };
auto lambda8 = [] (int x, int y) throw() -> int { return x+y; };
auto lambda9 = [] (int x, int y) mutable throw() -> int { return x+y; };
auto lambda10 = [] (int x, int y) throw(int) { return x+y; };
auto lambda11 = [] (int x, int y) mutable throw(int) { return x+y; };
auto lambda12 = [] (int a, int b) { return a + b; }(1, 2);
auto lambda13 = [] (int a, int b) mutable { return a + b; }(1, 2);
auto lambda14 = [] () throw () {};
auto lambda15 = [] () mutable throw () {};
auto lambda16 = [] { return thing; };
auto lambda17 = [] { return thing; }();
constexpr auto lambda18 = [] (int x, int y) mutable throw(int) { return x+y; };
namespace Space1 {
constexpr auto lambda19 = [] (int x, int y) mutable throw(int) { return x+y; };
namespace Space2 {
constexpr auto lambda20 = [] (int x, int y) mutable throw(int) { return x+y; };
}
}
int runLambda1() {
return lambda1(5,6);
}
int runLambda2() {
return lambda2(5,6);
}
int runLambda3() {
return lambda3(5,6);
}
int runLambda4() {
return lambda4(5,6);
}
int runLambda5() {
thing++;
return lambda5();
}
/* Inline defined lambda function. */
int runLambdaInline() {
auto myLambda = [](int x, int y) { return x+y; };
return myLambda(5,6);
}
%}
%{
// TODO
struct LambdaStruct {
static constexpr auto lambda_struct1 = [=]() { return thing; };
};
int(*lambda101notauto)(int, int) = [] (int a, int b) { return a + b; };
int lambda102 = [] (int a, int b) mutable { return a + b; }(1, 2);
void lambda_init(int = ([=]{ return 0; })());
%}

View file

@ -0,0 +1,49 @@
%module cpp11_noexcept
%ignore NoExceptClass(NoExceptClass&&);
%rename(Assignment) NoExceptClass::operator=;
%inline %{
extern "C" void global_noexcept(int, bool) noexcept;
struct NoExceptClass {
static const bool VeryTrue = true;
NoExceptClass() noexcept {}
NoExceptClass(const NoExceptClass&) noexcept {}
NoExceptClass(NoExceptClass&&) noexcept {}
NoExceptClass& operator=(const NoExceptClass&) noexcept {}
~NoExceptClass() noexcept {}
void noex0() noexcept {}
void noex1() noexcept(sizeof(int) == 4) {}
void noex2() noexcept(true) {}
void noex3() noexcept(false) {}
void noex4() noexcept(VeryTrue) {}
template<typename T> void template_noexcept(T) noexcept {}
void noo1() const noexcept {}
static void noo2() noexcept {}
virtual void noo3() const noexcept {}
virtual void noo4() const noexcept = delete;
virtual void noo5() const throw() = delete;
};
struct NoExceptAbstract {
virtual void noo4() const noexcept = 0;
virtual ~NoExceptAbstract() noexcept = 0;
};
struct NoExceptDefaultDelete {
template<typename T> NoExceptDefaultDelete(T) noexcept = delete;
NoExceptDefaultDelete() noexcept = default;
NoExceptDefaultDelete(const NoExceptDefaultDelete&) noexcept = delete;
NoExceptDefaultDelete(NoExceptDefaultDelete&&) = delete;
NoExceptDefaultDelete& operator=(const NoExceptDefaultDelete&) = delete;
~NoExceptDefaultDelete() noexcept = default;
};
%}

View file

@ -0,0 +1,22 @@
/* This testcase checks whether SWIG correctly treats the new nullptr_t
constant introduced in C++11.
*/
%module cpp11_null_pointer_constant
%feature("autodoc") A::NullPtrMethod; // Triggers conversion of nullptr to None, nil etc in target language
%feature("compactdefaultargs") A::NullPtrMethod;
%inline %{
const int *const MyIntegerPtr = nullptr;
class A {
public:
A() : _myA(nullptr) { }
A *_myA;
void NullPtrMethod(double *ptr = nullptr) {}
};
%}

View file

@ -0,0 +1,59 @@
/* This module tests whether SWIG correctly parses:
- ordinary strings (char_t)
- L wide strings (wchar_t)
- u8 unicode8 strings (char_t)
- u unicode16 strings (char16_t)
- U unicode32 strings (char32_t)
This module also tests whether SWIG correctly parses custom string delimiters.
*/
%module cpp11_raw_string_literals
%warnfilter(SWIGWARN_TYPEMAP_CHARLEAK_MSG) bb;
%warnfilter(SWIGWARN_TYPEMAP_CHARLEAK_MSG) ee;
%warnfilter(SWIGWARN_TYPEMAP_CHARLEAK_MSG) gg;
%warnfilter(SWIGWARN_TYPEMAP_CHARLEAK_MSG) xx;
%warnfilter(SWIGWARN_TYPEMAP_SWIGTYPELEAK_MSG) cc;
%warnfilter(SWIGWARN_TYPEMAP_SWIGTYPELEAK_MSG) dd;
%warnfilter(SWIGWARN_TYPEMAP_SWIGTYPELEAK_MSG) hh;
%warnfilter(SWIGWARN_TYPEMAP_SWIGTYPELEAK_MSG) ii;
%include <std_wstring.i>
%inline %{
#include <iostream>
#include <string>
using namespace std;
int L = 100;
int u8 = 100;
int u = 100;
struct UStruct {
static const int U = 100;
};
int R = 100;
int LR = 100;
int u8R = 100;
int uR = 100;
struct URStruct {
static const int UR = 100;
};
// New string literals
wstring aa = L"Wide string";
const char *bb = u8"UTF-8 string";
const char16_t *cc = u"UTF-16 string";
const char32_t *dd = U"UTF-32 string";
%}
/* Raw string literals */
%inline %{
const char *xx = ")I'm an \"ascii\" \\ string.";
const char *ee = R"XXX()I'm an "ascii" \ string.)XXX";
wstring ff = LR"XXX(I'm a "raw wide" \ string.)XXX";
const char *gg = u8R"XXX(I'm a "raw UTF-8" \ string.)XXX";
const char16_t *hh = uR"XXX(I'm a "raw UTF-16" \ string.)XXX";
const char32_t *ii = UR"XXX(I'm a "raw UTF-32" \ string.)XXX";
%}

View file

@ -0,0 +1,20 @@
/* This testcase checks whether SWIG correctly uses the new result_of class
and its templating capabilities introduced in C++11. */
%module cpp11_result_of
%inline %{
#include <functional>
#include <iostream>
double square(double x) {
return (x * x);
}
template<class Fun, class Arg>
typename std::result_of<Fun(Arg)>::type test_result_impl(Fun fun, Arg arg) {
return fun(arg);
}
%}
%template(test_result) test_result_impl<double(*)(double), double>;
%constant double (*SQUARE)(double) = square;

View file

@ -0,0 +1,22 @@
/* This testcase checks whether SWIG correctly parses the double ampersand &&
move operator which is currently mapped to the reference & operator. */
%module cpp11_rvalue_reference
%inline %{
#include <utility>
class A {
public:
int getAcopy() { return _a; }
int *getAptr() { return &_a; }
int &getAref() { return _a; }
int &&getAmove() { return std::move(_a); }
void setAcopy(int a) { _a = a; }
void setAptr(int *a) { _a = *a; }
void setAref(int &a) { _a = a; }
void setAmove(int &&a) { _a = a; }
private:
int _a;
};
%}

View file

@ -0,0 +1,86 @@
%module cpp11_rvalue_reference2
%warnfilter(SWIGWARN_TYPEMAP_SWIGTYPELEAK) globalrrval;
// This testcase tests lots of different places that rvalue reference syntax can be used
%typemap(in) Something && "/*in Something && typemap*/"
%rename(OperatorRValue) Thingy::operator int&&;
%rename(memberFnRenamed) memberFn(short &&i);
%feature("compactdefaultargs") Thingy::compactDefaultArgs(const bool &&b = (const bool &&)PublicGlobalTrue, const UserDef &&u = (const UserDef &&)PublicUserDef);
%feature("exception") Thingy::privateDefaultArgs(const bool &&b = (const bool &&)PrivateTrue);
%ignore Thingy::operator=;
%inline %{
#include <utility>
struct UserDef {
int a;
};
static const bool PublicGlobalTrue = true;
static const UserDef PublicUserDef = UserDef();
struct Thingy {
typedef int Integer;
int val;
int &lvalref;
int &&rvalref;
Thingy(int v) : val(v), lvalref(val), rvalref(22) {}
void refIn(long &i) {}
void rvalueIn(long &&i) {}
short && rvalueInOut(short &&i) { return std::move(i); }
static short && staticRvalueInOut(short &&i) { return std::move(i); }
// test both primitive and user defined rvalue reference default arguments and compactdefaultargs
void compactDefaultArgs(const bool &&b = (const bool &&)PublicGlobalTrue, const UserDef &&u = (const UserDef &&)PublicUserDef) {}
void privateDefaultArgs(const bool &&b = (const bool &&)PrivateTrue) {}
operator int &&() {}
Thingy& operator=(const Thingy& rhs) {
val = rhs.val;
lvalref = rhs.lvalref;
rvalref = rhs.rvalref;
}
private:
static const bool PrivateTrue;
Thingy();
};
const bool Thingy::PrivateTrue = true;
short && globalRvalueInOut(short &&i) { return std::move(i); }
Thingy &&globalrrval = Thingy(55);
short && func(short &&i) { return std::move(i); }
Thingy getit() { return Thingy(22); }
void rvalrefFunction1(int &&v = (int &&)5) {}
void rvalrefFunctionBYVAL(short (Thingy::*memFunc)(short)) {}
void rvalrefFunctionLVALUE(short &(Thingy::*memFunc)(short &)) {}
void rvalrefFunction2(short && (Thingy::*memFunc)(short &&)) {}
void rvalrefFunction3(short && (*memFunc)(short &&)) {}
template <typename T> struct RemoveReference {
typedef T type;
};
template <typename T> struct RemoveReference<T&> {
typedef T type;
};
template <typename T> struct RemoveReference<T&&> {
typedef T type;
};
template <> struct RemoveReference<short &&> {
typedef short type;
};
// like std::move
template <typename T> typename RemoveReference<T>::type&& Move(T&& t) {
return static_cast<typename RemoveReference<T>::type&&>(t);
}
%}
%template(RemoveReferenceDouble) RemoveReference<double &&>;
%template(RemoveReferenceFloat) RemoveReference<float &&>;
%template(RemoveReferenceShort) RemoveReference<short &&>;
%template(MoveFloat) Move<float>;

View file

@ -0,0 +1,67 @@
%module cpp11_rvalue_reference3
%warnfilter(SWIGWARN_TYPEMAP_SWIGTYPELEAK);
%inline %{
#include <utility>
struct Thing {};
Thing && global_rvalue_ref = Thing();
Thing *&& global_rvalue_ref_ptr1 = 0;
Thing const*&& global_rvalue_ref_ptr2 = 0;
Thing *const&& global_rvalue_ref_ptr3 = 0;
Thing const*const &&global_rvalue_ref_ptr4 = 0;
Thing && returnit1() { return std::move(global_rvalue_ref); }
Thing *&& returnit2() { return std::move(global_rvalue_ref_ptr1); }
Thing const*&& returnit3() { return std::move(global_rvalue_ref_ptr2); }
Thing *const&& returnit4() { return std::move(global_rvalue_ref_ptr3); }
Thing const*const&& returnit5() { return std::move(global_rvalue_ref_ptr4); }
void takeit1(Thing && t) {}
void takeit2(Thing *&& t) {}
void takeit3(Thing const*&& t) {}
void takeit4(Thing *const&& t) {}
void takeit5(Thing const*const&& t) {}
struct Containing {
Thing && member_rvalue_ref;
Thing *&& member_rvalue_ref_ptr1 = 0;
Thing const*&& member_rvalue_ref_ptr2 = 0;
Thing *const&& member_rvalue_ref_ptr3 = 0;
Thing const*const &&member_rvalue_ref_ptr4 = 0;
Containing() : member_rvalue_ref(Thing()) {}
};
%}
%inline %{
int && int_global_rvalue_ref = 5;
int *&& int_global_rvalue_ref_ptr1 = 0;
int const*&& int_global_rvalue_ref_ptr2 = 0;
int *const&& int_global_rvalue_ref_ptr3 = 0;
int const*const &&int_global_rvalue_ref_ptr4 = 0;
int && int_returnit1() { return std::move(int_global_rvalue_ref); }
int *&& int_returnit2() { return std::move(int_global_rvalue_ref_ptr1); }
int const*&& int_returnit3() { return std::move(int_global_rvalue_ref_ptr2); }
int *const&& int_returnit4() { return std::move(int_global_rvalue_ref_ptr3); }
int const*const&& int_returnit5() { return std::move(int_global_rvalue_ref_ptr4); }
void int_takeit1(int && t) {}
void int_takeit2(int *&& t) {}
void int_takeit3(int const*&& t) {}
void int_takeit4(int *const&& t) {}
void int_takeit5(int const*const&& t) {}
struct IntContaining {
int && member_rvalue_ref;
int *&& member_rvalue_ref_ptr1 = 0;
int const*&& member_rvalue_ref_ptr2 = 0;
int *const&& member_rvalue_ref_ptr3 = 0;
int const*const &&member_rvalue_ref_ptr4 = 0;
IntContaining() : member_rvalue_ref(55) {}
};
%}

View file

@ -0,0 +1,17 @@
/* This testcase checks whether SWIG correctly uses the sizeof() on the
concrete objects and not only types introduced in C++11. */
%module cpp11_sizeof_object
%inline %{
struct B {
unsigned long member1;
long long member2;
char member3;
};
struct A {
B member;
};
const int a = sizeof(A::member);
%}

View file

@ -0,0 +1,17 @@
/* This test case checks whether SWIG correctly parses and ignores the
keywords "static_assert()" inside the class or struct.
*/
%module cpp11_static_assert
%inline %{
template <typename T>
struct Check1 {
static_assert(sizeof(int) <= sizeof(T), "not big enough");
};
template <typename T>
class Check2 {
static_assert(sizeof(int) <= sizeof(T), "not big enough");
};
%}

View file

@ -0,0 +1,87 @@
/* This testcase checks whether SWIG produces the correct wrapper for the
strongly typed enums. Enums with the same type are comparable. Enum classes
require support for nested classes. */
%module cpp11_strongly_typed_enumerations
%warnfilter(302) Val1;
%warnfilter(302) Val2;
%warnfilter(302) Val3;
%warnfilter(302) Val4;
/* Forward declarations (illegally accepted by SWIG - oh well!) */
enum Enum1 : short;
enum Enum3;
enum ;
enum : unsigned short;
%inline %{
enum class Enum1 {
Val1,
Val2,
Val3 = 100,
Val4 /* = 101 */
};
enum class Enum2 : short {
Val1,
Val2,
Val3 = 100,
Val4
};
%}
// SWIG should fail this one
enum Enum2 : unsigned short; // Illegal in C++11, because Enum2 was previously declared with a different type.
%inline %{
/* Forward declarations. */
enum Enum4 : unsigned int; // Legal in C++11.
enum class Enum5; // Legal in C++11, because enum class declarations have a default type of "int".
enum class Enum6 : unsigned int; // Legal C++11.
enum Enum4 : unsigned int {
Val1, Val2, Val3 = 100, Val4
};
enum class Enum5 {
Val1, Val2, Val3 = 100, Val4
};
enum class Enum6 : unsigned int {
Val1, Val2, Val3 = 300, Val4
};
typedef enum class Enum7 : unsigned int {
Val1, Val2, Val3 = 300, Val4
} Enum7td;
// enum inherits from non-primitive type
enum class Enum8 : size_t {
Val1, Val2, Val3 = 300, Val4
};
template <typename T> struct TType {
typedef T type_name;
};
enum class Enum10 : TType<int>::type_name {
Val1, Val2, Val3 = 300, Val4
};
// forward declaration, no definition of enum
enum class Enum11 : int;
struct UseEnum11 {
Enum11 myenum11;
};
/*
TODO
enum class MyClass {AAA, BBB, CCC};
namespace Space {
enum MyEnum {XXX, YYY, ZZZ};
}
struct SSS {
MyClass m;
};
*/
%}

View file

@ -0,0 +1,39 @@
/* This interface checks whether SWIG supports the new double angled brackets
in the template syntax without having a space inbetween. This feature was
introduced in new C++11 standard.
*/
%module cpp11_template_double_brackets
%inline %{
#include <map>
std::map<int,std::map<int, double>> map1;
std::map< int,std::map<int, double> > map2;
std::map<int,std::map<int, std::map<int, double>>> map3;
std::map<int,std::map<int, std::map<int, std::map<int, double>>>> map4;
%}
// Check streaming operators are still okay
%rename(ExtractionOperator) operator>>;
%rename(InsertionOperator) operator<<;
%inline %{
class ABC {
public:
int a;
int operator>>(ABC &) { return 0; }
int operator<<(ABC &) { return 0; }
};
template<class T>
class ABC2 {
public:
int a;
template<typename U>
U operator>>(ABC &);
template<typename U>
U operator<<(ABC &);
};
%}

View file

@ -0,0 +1,24 @@
/* This unit tests whether SWIG correctly parses the code and makes wrappers
for the new C++11 extern templates (explicit template instantiation without
using the translation unit).
*/
%module cpp11_template_explicit
#pragma SWIG nowarn=SWIGWARN_PARSE_EXPLICIT_TEMPLATE
%inline %{
#include <vector>
class A {
public:
int member;
int memberFunction() { return 100; }
};
template class std::vector<A>;
extern template class std::vector<A>;
template class std::vector<A*>;
extern template class std::vector<A*>;
%}

View file

@ -0,0 +1,32 @@
/* This testcase checks whether SWIG correctly parses alias templates. */
%module cpp11_template_typedefs
%warnfilter(SWIGWARN_CPP11_ALIAS_TEMPLATE) TypedefName;
%warnfilter(SWIGWARN_CPP11_ALIAS_TEMPLATE) MyIntKeyClass;
%warnfilter(SWIGWARN_CPP11_ALIAS_DECLARATION) PF;
%inline %{
template< typename T1, typename T2, int >
class SomeType {
T1 a;
T2 b;
int c;
};
// template aliasing
template< typename T2 >
using TypedefName = SomeType<char*, T2, 5>;
// type aliasing
typedef void (*PFD)(double); // Old style
using PF = void (*)(double); // New introduced syntax
// use of template aliasing
template<typename Key,typename Val>
class MyCPP11Class {
};
template<typename VAL> using MyIntKeyClass = MyCPP11Class<int,VAL>;
MyIntKeyClass<char> intchar;
%}

View file

@ -0,0 +1,33 @@
/* This testcase checks whether SWIG correctly parses the 'thread_local' storage specifier */
%module cpp11_thread_local
%inline %{
struct ThreadLocals {
// thread_local int tval; // members must also be declared static
static thread_local int stval;
thread_local static int tsval;
static thread_local const int stcval88 = 88;
thread_local static const int tscval99 = 99;
};
thread_local int tval;
static thread_local int stval;
thread_local static int tsval;
extern thread_local int etval;
thread_local extern int teval;
extern "C" thread_local int ectval;
extern "C++" thread_local int ecpptval;
thread_local int ThreadLocals::stval = 11;
thread_local int ThreadLocals::tsval = 22;
thread_local const int ThreadLocals::stcval88;
thread_local const int ThreadLocals::tscval99;
%}
%{
// externs
thread_local int etval = 33;
thread_local int teval = 44;
thread_local int ectval = 55;
thread_local int ecpptval = 66;
%}

View file

@ -0,0 +1,49 @@
/* This testcase checks whether SWIG syntactically correctly parses the initialization syntax using
{} braces for uniform member initialization. */
%module cpp11_uniform_initialization
%include <std_vector.i>
%template(VectorInt) std::vector<int>;
%inline %{
struct BasicStruct {
int x;
double y;
};
struct AltStruct {
AltStruct(int x, double y) : x_{x}, y_{y} {}
int getX() { return x_; }
double getY() { return y_; }
private:
int x_;
double y_;
};
BasicStruct var1{5, 3.2}; // only fills the struct components
AltStruct var2{2, 4.3}; // calls the constructor
class MoreInit
{
public:
int yarray[5] {1,2,3,4,5};
char *charptr {nullptr};
std::vector<int> vi {1,2,3,4,5};
MoreInit() {}
int more1(std::vector<int> vv = {1,2,3,4}) {
int sum = 0;
for (int i : vv)
sum += i;
return sum;
}
};
const int arr1[] = {1,2,3};
const int arr2[]{1,2,3};
const int arr3[][3]{ {1,2,3}, {4,5,6} };
const int arr4[][3] = { {1,2,3}, {4,5,6} };
%}

View file

@ -0,0 +1,23 @@
/* This testcase checks whether SWIG correctly parses the support for types
without the defined trivial constructor in the unions. */
%module cpp11_unrestricted_unions
%inline %{
struct point {
point() {}
point(int x, int y) : x_(x), y_(y) {}
int x_, y_;
};
#include <new> // For placement 'new' in the constructor below
union P {
int z;
double w;
point p; // Illegal in C++03; legal in C++11.
// Due to the point member, a constructor definition is required.
P() {
new(&p) point();
}
} p1;
%}

View file

@ -0,0 +1,53 @@
/* This testcase checks whether SWIG correctly parses the user-defined literals
introduced in C++11. */
%module cpp11_userdefined_literals
// Unfortunately full declaration is needed for %rename atm, the parameter list cannot be omitted.
%rename(MyRawLiteral) operator"" _myRawLiteral(const char * value);
%rename(MySuffixIntegral) operator "" _mySuffixIntegral(unsigned long long);
%rename(MySuffixFloat) operator "" _mySuffixFloat(long double);
%rename(MySuffix1) operator "" _mySuffix1(const char * string_values, size_t num_chars);
%rename(MySuffix2) operator "" _mySuffix2(const wchar_t * string_values, size_t num_chars);
%rename(MySuffix3) operator "" _mySuffix3(const char16_t * string_values, size_t num_chars);
%rename(MySuffix4) operator "" _mySuffix4(const char32_t * string_values, size_t num_chars);
%ignore operator "" _myRawLiteralIgnored(const char * value);
%inline %{
#include <iostream>
struct OutputType {
int val;
OutputType(int v) : val(v) {}
};
// Raw literal
OutputType operator "" _myRawLiteral(const char * value) { return OutputType(10); }
// Cooked numeric literals
OutputType operator "" _mySuffixIntegral(unsigned long long) { return OutputType(20); }
OutputType operator "" _mySuffixFloat(long double) { return OutputType(30); }
// Cooked string literals
OutputType operator "" _mySuffix1(const char * string_values, size_t num_chars) { return OutputType(100); }
OutputType operator "" _mySuffix2(const wchar_t * string_values, size_t num_chars) { return OutputType(200); }
OutputType operator "" _mySuffix3(const char16_t * string_values, size_t num_chars) { return OutputType(300); }
OutputType operator "" _mySuffix4(const char32_t * string_values, size_t num_chars) { return OutputType(400); }
OutputType operator"" _myRawLiteralIgnored(const char * value) { return OutputType(15); }
%}
%{
// TODO: SWIG cannot parse these
OutputType some_variable_a = 1234_myRawLiteral;
OutputType some_variable_b = 1234_mySuffixIntegral;
OutputType some_variable_c = 3.1416_mySuffixFloat;
OutputType some_variable_d = "1234"_mySuffix1;
OutputType some_variable_e = u8"1234"_mySuffix1;
OutputType some_variable_f = L"1234"_mySuffix2;
OutputType some_variable_g = u"1234"_mySuffix3;
OutputType some_variable_h = U"1234"_mySuffix4;
%}

View file

@ -0,0 +1,77 @@
/* This testcase checks whether SWIG correctly parses and generates the code
for variadic templates. This covers the variadic number of arguments inside
the template brackets, new functions sizeof... and multiple inheritance
using variadic number of classes.
*/
%module cpp11_variadic_templates
%warnfilter(SWIGWARN_CPP11_VARIADIC_TEMPLATE) MultiArgs;
%warnfilter(SWIGWARN_CPP11_VARIADIC_TEMPLATE) SizeOf;
%warnfilter(SWIGWARN_CPP11_VARIADIC_TEMPLATE) MultiInherit;
////////////////////////
// Variadic templates //
////////////////////////
%inline %{
#include <vector>
#include <string>
#include <map>
template<typename... Values>
class MultiArgs {
};
class MultiArgs<int, std::vector<int>, std::map<std::string, std::vector<int>>> multiArgs;
%}
// TODO
%template (MultiArgs1) MultiArgs<int, std::vector<int>, std::map<std::string, std::vector<int>>>;
////////////////////////
// Variadic sizeof... //
////////////////////////
%inline %{
template<typename... Args> struct SizeOf {
static const int size = sizeof...(Args);
};
%}
%template (SizeOf1) SizeOf<int, int>;
//////////////////////////
// Variadic inheritance //
//////////////////////////
%inline %{
class A {
public:
A() {
a = 100;
}
virtual ~A() {}
int a;
};
class B {
public:
B() {
b = 200;
}
virtual ~B() {}
int b;
};
template <typename... BaseClasses> class MultiInherit : public BaseClasses... {
public:
MultiInherit(BaseClasses&... baseClasses) : BaseClasses(baseClasses)... {}
int InstanceMethod() { return 123; }
static int StaticMethod() { return 456; }
};
%}
// TODO
//%template (MultiInherit0) MultiInherit<>;
%template (MultiInherit1) MultiInherit<A>;
// TODO
%template (MultiInherit2) MultiInherit<A,B>;

View file

@ -4,8 +4,8 @@
LANGUAGE = csharp
SCRIPTSUFFIX = _runme.cs
INTERPRETER = @CSHARPCILINTERPRETER@
INTERPRETER_FLAGS = @CSHARPCILINTERPRETER_FLAGS@
CSHARPCILINTERPRETER = @CSHARPCILINTERPRETER@
CSHARPCILINTERPRETER_FLAGS = @CSHARPCILINTERPRETER_FLAGS@
CSHARPPATHSEPARATOR = "@CSHARPPATHSEPARATOR@"
CSHARPCYGPATH_W = @CSHARPCYGPATH_W@
srcdir = @srcdir@
@ -14,9 +14,11 @@ top_builddir = ../@top_builddir@
CPP_TEST_CASES = \
csharp_attributes \
csharp_swig2_compatibility \
csharp_exceptions \
csharp_features \
csharp_lib_arrays \
csharp_namespace_system_collision \
csharp_prepost \
csharp_typemaps \
enum_thorough_simple \
@ -35,6 +37,7 @@ CSHARPFLAGSSPECIAL =
# Custom tests - tests with additional commandline options
intermediary_classname.cpptest: SWIGOPT += -dllimport intermediary_classname
csharp_lib_arrays.cpptest: CSHARPFLAGSSPECIAL = -unsafe
csharp_swig2_compatibility.cpptest: SWIGOPT += -DSWIG2_CSHARP
# Rules for the different types of tests
%.cpptest:
@ -55,9 +58,9 @@ csharp_lib_arrays.cpptest: CSHARPFLAGSSPECIAL = -unsafe
# Makes a directory for the testcase if it does not exist
setup = \
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
echo "$(ACTION)ing testcase $* (with run test) under $(LANGUAGE)" ; \
echo "$(ACTION)ing $(LANGUAGE) testcase $* (with run test)" ; \
else \
echo "$(ACTION)ing testcase $* under $(LANGUAGE)" ; \
echo "$(ACTION)ing $(LANGUAGE) testcase $*" ; \
fi; \
if [ ! -d $* ]; then \
mkdir $*; \
@ -72,7 +75,7 @@ run_testcase = \
$(MAKE) -f $*/$(top_builddir)/$(EXAMPLES)/Makefile \
CSHARPFLAGS='-nologo -debug+ $(CSHARPFLAGSSPECIAL) -out:$*_runme.exe' \
CSHARPSRCS='`$(CSHARPCYGPATH_W) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX)` `find $* -name "*.cs" -exec $(CSHARPCYGPATH_W) "{}" \+`' csharp_compile && \
env LD_LIBRARY_PATH="$*:$$LD_LIBRARY_PATH" PATH="$*:$$PATH" SHLIB_PATH="$*:$$SHLIB_PATH" DYLD_FALLBACK_LIBRARY_PATH= $(RUNTOOL) $(INTERPRETER) $(INTERPRETER_FLAGS) ./$*_runme.exe; \
env LD_LIBRARY_PATH="$*:$$LD_LIBRARY_PATH" PATH="$*:$$PATH" SHLIB_PATH="$*:$$SHLIB_PATH" DYLD_FALLBACK_LIBRARY_PATH= $(RUNTOOL) $(CSHARPCILINTERPRETER) $(CSHARPCILINTERPRETER_FLAGS) ./$*_runme.exe; \
else \
cd $* && \
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile \

View file

@ -0,0 +1,37 @@
using System;
using li_std_auto_ptrNamespace;
public class li_std_auto_ptr_runme {
private static void WaitForGC()
{
System.GC.Collect();
System.GC.WaitForPendingFinalizers();
System.Threading.Thread.Sleep(10);
}
public static void Main()
{
Klass k1 = li_std_auto_ptr.makeKlassAutoPtr("first");
if (k1.getLabel() != "first")
throw new Exception("wrong object label");
Klass k2 = li_std_auto_ptr.makeKlassAutoPtr("second");
if (Klass.getTotal_count() != 2)
throw new Exception("number of objects should be 2");
k1 = null;
WaitForGC();
if (Klass.getTotal_count() != 1)
throw new Exception("number of objects should be 1");
if (k2.getLabel() != "second")
throw new Exception("wrong object label");
k2 = null;
WaitForGC();
if (Klass.getTotal_count() != 0)
throw new Exception("no objects should be left");
}
}

View file

@ -82,17 +82,6 @@ public class li_std_vector_runme {
} catch (ArgumentException) {
}
}
#if SWIG_DOTNET_1
{
// runtime check that 2D arrays fail
double[,] outputarray = new double[collectionSize,collectionSize];
try {
vect.CopyTo(outputarray);
throw new Exception("CopyTo (5a) test failed");
} catch (ArgumentException) {
}
}
#endif
{
StructVector inputvector = new StructVector();
int arrayLen = 10;
@ -208,7 +197,6 @@ public class li_std_vector_runme {
throw new Exception("Repeat (1) test failed");
}
}
#if !SWIG_DOTNET_1
{
System.Collections.Generic.IEnumerator<double> myEnumerator = dv.GetEnumerator();
while ( myEnumerator.MoveNext() ) {
@ -216,7 +204,6 @@ public class li_std_vector_runme {
throw new Exception("Repeat (2) test failed");
}
}
#endif
}
{

View file

@ -0,0 +1,56 @@
using System;
using li_swigtype_inoutNamespace;
public class li_swigtype_inout_runme {
public static void Main() {
XXX xxx = new XXX(999);
check_count(1);
XXX x1 = null;
XXX x2 = null;
XXX x3 = null;
XXX x4 = null;
li_swigtype_inout.ptr_ref_out(out x1, out x2, out x3, out x4);
check_value(111, x1.value);
check_value(222, x2.value);
check_value(333, x3.value);
check_value(444, x4.value);
check_count(5);
x1.Dispose();
x2.Dispose();
x3.Dispose();
x4.Dispose();
xxx.Dispose();
check_count(0);
x1 = null;
x2 = null;
x3 = null;
x4 = null;
new ConstructorTest(out x1, out x2, out x3, out x4);
check_count(4);
check_value(111, x1.value);
check_value(222, x2.value);
check_value(333, x3.value);
check_value(444, x4.value);
x1.Dispose();
x2.Dispose();
x3.Dispose();
x4.Dispose();
check_count(0);
}
public static void check_count(int count) {
int actual = XXX.count;
if( count != actual ) {
throw new Exception(String.Format("Count wrong. Expected: {0} Got: {1}", count, actual));
}
}
public static void check_value(int expected, int actual) {
if( expected != actual ) {
throw new Exception(String.Format("Wrong value. Expected: {0} Got: {1}", expected, actual));
}
}
}

View file

@ -0,0 +1,66 @@
using System;
using nested_classNamespace;
#pragma warning disable 219
public class runme {
static void Main() {
Outer outer = new Outer();
outer.a = 1;
outer.b = 2;
Outer.InnerStruct1 is1 = outer.makeInnerStruct1();
Outer.InnerClass1 ic1 = outer.makeInnerClass1();
Outer.InnerUnion1 iu1 = outer.makeInnerUnion1();
Outer.InnerStruct2 is2 = outer.makeInnerStruct2();
Outer.InnerClass2 ic2 = outer.makeInnerClass2();
Outer.InnerUnion2 iu2 = outer.makeInnerUnion2();
Outer.InnerClass4Typedef ic4 = outer.makeInnerClass4Typedef();
Outer.InnerStruct4Typedef is4 = outer.makeInnerStruct4Typedef();
Outer.InnerUnion4Typedef iu4 = outer.makeInnerUnion4Typedef();
Outer.InnerClass5Typedef ic5 = outer.makeInnerClass5();
Outer.InnerStruct5Typedef is5 = outer.makeInnerStruct5();
Outer.InnerUnion5Typedef iu5 = outer.makeInnerUnion5();
ic5 = outer.makeInnerClass5Typedef();
is5 = outer.makeInnerStruct5Typedef();
iu5 = outer.makeInnerUnion5Typedef();
{
Outer.InnerMultiple im1 = outer.MultipleInstance1;
Outer.InnerMultiple im2 = outer.MultipleInstance2;
Outer.InnerMultiple im3 = outer.MultipleInstance3;
Outer.InnerMultiple im4 = outer.MultipleInstance4;
}
{
Outer.InnerMultipleDerived im1 = outer.MultipleDerivedInstance1;
Outer.InnerMultipleDerived im2 = outer.MultipleDerivedInstance2;
Outer.InnerMultipleDerived im3 = outer.MultipleDerivedInstance3;
Outer.InnerMultipleDerived im4 = outer.MultipleDerivedInstance4;
}
{
Outer.InnerMultipleDerived im1 = outer.MultipleDerivedInstance1;
Outer.InnerMultipleDerived im2 = outer.MultipleDerivedInstance2;
Outer.InnerMultipleDerived im3 = outer.MultipleDerivedInstance3;
Outer.InnerMultipleDerived im4 = outer.MultipleDerivedInstance4;
}
{
Outer.InnerMultipleAnonTypedef1 mat1 = outer.makeInnerMultipleAnonTypedef1();
Outer.InnerMultipleAnonTypedef1 mat2 = outer.makeInnerMultipleAnonTypedef2();
SWIGTYPE_p_p_Outer__InnerMultipleAnonTypedef1 mat3 = outer.makeInnerMultipleAnonTypedef3();
Outer.InnerMultipleNamedTypedef1 mnt = outer.makeInnerMultipleNamedTypedef();
Outer.InnerMultipleNamedTypedef1 mnt1 = outer.makeInnerMultipleNamedTypedef1();
Outer.InnerMultipleNamedTypedef1 mnt2 = outer.makeInnerMultipleNamedTypedef2();
SWIGTYPE_p_p_Outer__InnerMultipleNamedTypedef mnt3 = outer.makeInnerMultipleNamedTypedef3();
}
{
Outer.InnerSameName isn = outer.makeInnerSameName();
}
}
}

View file

@ -0,0 +1,28 @@
using System;
using nested_structsNamespace;
#pragma warning disable 219
public class runme {
static void Main() {
Outer outer = new Outer();
nested_structs.setValues(outer, 10);
Outer_inner1 inner1 = outer.inner1;
Outer_inner1 inner2 = outer.inner2;
Outer_inner1 inner3 = outer.inner3;
Outer_inner1 inner4 = outer.inner4;
if (inner1.val != 10) throw new Exception("failed inner1");
if (inner2.val != 20) throw new Exception("failed inner2");
if (inner3.val != 20) throw new Exception("failed inner3");
if (inner4.val != 40) throw new Exception("failed inner4");
Named inside1 = outer.inside1;
Named inside2 = outer.inside2;
Named inside3 = outer.inside3;
Named inside4 = outer.inside4;
if (inside1.val != 100) throw new Exception("failed inside1");
if (inside2.val != 200) throw new Exception("failed inside2");
if (inside3.val != 200) throw new Exception("failed inside3");
if (inside4.val != 400) throw new Exception("failed inside4");
}
}

View file

@ -0,0 +1,23 @@
using System;
using nested_workaroundNamespace;
#pragma warning disable 219
public class runme {
static void Main() {
{
Inner inner = new Inner(5);
Outer outer = new Outer();
Inner newInner = outer.doubleInnerValue(inner);
if (newInner.getValue() != 10)
throw new Exception("inner failed");
}
{
Outer outer = new Outer();
Inner inner = outer.createInner(3);
Inner newInner = outer.doubleInnerValue(inner);
if (outer.getInnerValue(newInner) != 6)
throw new Exception("inner failed");
}
}
}

View file

@ -4,9 +4,12 @@ using rename_pcre_encoderNamespace;
public class runme {
static void Main() {
SomeWidget w = new SomeWidget();
w.putBorderWidth(17);
if ( w.getBorderWidth() != 17 )
w.put_borderWidth(17);
if ( w.get_borderWidth() != 17 )
throw new Exception(String.Format("Border with should be 17, not {0}",
w.getBorderWidth()));
w.get_borderWidth()));
if ( rename_pcre_encoder.StartINSAneAndUNSAvoryTraNSAtlanticRaNSAck() != 42 )
throw new Exception("Unexpected result of renamed function call");
}
}

View file

@ -0,0 +1,25 @@
using System;
using template_nestedNamespace;
#pragma warning disable 219
public class runme {
static void Main() {
new T_NormalTemplateNormalClass().tmethod(new NormalClass());
new OuterClass().T_OuterTMethodNormalClass(new NormalClass());
TemplateFuncs tf = new TemplateFuncs();
if (tf.T_TemplateFuncs1Int(-10) != -10)
throw new Exception("it failed");
if (tf.T_TemplateFuncs2Double(-12.3) != -12.3)
throw new Exception("it failed");
T_NestedOuterTemplateDouble tn = new T_NestedOuterTemplateDouble();
if (tn.hohum(-12.3) != -12.3)
throw new Exception("it failed");
OuterClass.T_OuterClassInner1Int inner1 = new OuterClass().useInner1(new OuterClass.T_OuterClassInner1Int());
OuterClass.T_OuterClassInner2NormalClass inner2 = new OuterClass.T_OuterClassInner2NormalClass();
inner2.embeddedVar = 2;
OuterClass.T_OuterClassInner2NormalClass inner22 = new OuterClass().useInner2Again(inner2);
}
}

View file

@ -1,4 +1,5 @@
%module csharp_features
%include "wchar.i"
// SWIG gets the method modifiers wrong occasionally, like with private inheritance, %csmethodmodifiers can fix this
%csmethodmodifiers Derived::VirtualMethod() "public virtual"
@ -19,6 +20,9 @@ public:
class MoreDerived : public Derived {
public:
int variable;
// test wide char literals support for C# module
void methodWithDefault1(const wchar_t* s = L"literal with escapes \x1234"){}
void methodWithDefault2(wchar_t c = L'\x1234'){}
};
%}

View file

@ -0,0 +1,39 @@
%module namespace_system_collision
%{
#include <string>
namespace TopLevel
{
namespace System
{
class Foo {
public:
virtual ~Foo() {}
virtual std::string ping() { return "TopLevel::System::Foo::ping()"; }
};
}
}
%}
%include <std_string.i>
// nspace feature only supported by these languages
#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGD)
%nspace;
#else
//#warning nspace feature not yet supported in this target language
#endif
namespace TopLevel
{
namespace System
{
class Foo {
public:
virtual ~Foo();
virtual std::string ping();
};
}
}

View file

@ -116,7 +116,7 @@ struct PrePost3 {
// Check attributes in the typemaps
%typemap(cstype, inattributes="[CustomInt]") int val "int"
%typemap(csin, pre=" int tmp_$csinput = $csinput * 100;") int val "tmp_$csinput"
%typemap(imtype, out="IntPtr/*overridden*/", outattributes="[CustomIntPtr]") CsinAttributes * "HandleRef/*overridden*/"
%typemap(imtype, out="global::System.IntPtr/*overridden*/", outattributes="[CustomIntPtr]") CsinAttributes * "global::System.Runtime.InteropServices.HandleRef/*overridden*/"
%inline %{
class CsinAttributes {
@ -216,8 +216,8 @@ void subtractYears(CDate *pDate, int years) {
%typemap(csvarout, excode=SWIGEXCODE2) CDate * %{
/* csvarout typemap code */
get {
IntPtr cPtr = $imcall;
CDate tempDate = (cPtr == IntPtr.Zero) ? null : new CDate(cPtr, $owner);$excode
global::System.IntPtr cPtr = $imcall;
CDate tempDate = (cPtr == global::System.IntPtr.Zero) ? null : new CDate(cPtr, $owner);$excode
return new System.DateTime(tempDate.getYear(), tempDate.getMonth(), tempDate.getDay(),
0, 0, 0);
} %}

View file

@ -0,0 +1,48 @@
%module csharp_swig2_compatibility
%typemap(cscode) Foo %{
// Without the using directives generated by the
// SWIG 2 compatibility mode, this code would fail
// to build.
public void FooBar(string input)
{
Console.WriteLine(input);
}
%}
%pragma(csharp) imclasscode=%{
// Without the using directives generated by the
// SWIG 2 compatibility mode, this code would fail
// to build.
public void IntermediateClassMethod(string input)
{
Console.WriteLine(input);
}
%}
%pragma(csharp) modulecode=%{
// Without the using directives generated by the
// SWIG 2 compatibility mode, this code would fail
// to build.
public void ModuleClassMethod(string input)
{
Console.WriteLine(input);
}
%}
%inline %{
class Foo {
public:
Foo() {}
void Bar() {}
};
%}

View file

@ -94,7 +94,7 @@ Number times12(const Number* num) {
%typemap(csvarin, excode=SWIGEXCODE2) int %{
set {
if ($csinput < 0)
throw new ApplicationException("number too small!");
throw new global::System.ApplicationException("number too small!");
$imcall;$excode
} %}

View file

@ -46,9 +46,9 @@ SWIGOPT+=-splitproxy -package $*
# Makes a directory for the testcase if it does not exist
setup = \
if [ -f $(srcdir)/$(TESTPREFIX)$*$(TESTSUFFIX) ]; then \
echo "$(ACTION)ing testcase $* (with run test) under $(LANGUAGE)" ; \
echo "$(ACTION)ing $(LANGUAGE) testcase $* (with run test)" ; \
else \
echo "$(ACTION)ing testcase $* under $(LANGUAGE)" ; \
echo "$(ACTION)ing $(LANGUAGE) testcase $*" ; \
fi; \
if [ ! -d $*$(VERSIONSUFFIX) ]; then \
mkdir $*$(VERSIONSUFFIX); \

View file

@ -10,7 +10,10 @@ This was reported in bug #909389 */
%inline %{
class A { int x; };
class A {
public:
int x;
};
class B {
class C { int y; }; //generates a warning
class D : public A { int z; }; //ok

View file

@ -41,6 +41,29 @@ class DirectorMethodException: public Swig::DirectorException {};
#endif
#ifdef SWIGJAVA
// Default for director exception warns about unmapped exceptions now in java
// Suppress warnings for this older test
// %warnfilter(476) Bar;
// Default for java is to throw Swig::DirectorException if no
// direct:except feature. Since methods below have exception specification
// cannot throw director exception.
// Change back to old 2.0 default behavior
%feature("director:except") {
jthrowable $error = jenv->ExceptionOccurred();
if ($error) {
// Dont clear exception, still be active when return to java execution
// Essentially ignore exception occurred -- old behavior.
return $null;
}
}
#endif
#ifdef SWIGRUBY
%feature("director:except") {

View file

@ -40,11 +40,11 @@ namespace TopLevel
%include <std_string.i>
// nspace feature only supported by these languages
#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGD) || defined(SWIGJAVASCRIPT)
#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGD) || defined(SWIGLUA) || defined(SWIGJAVASCRIPT)
%nspace TopLevel::Bar::Foo;
%nspace TopLevel::Bar::FooBar;
#else
#warning nspace feature not yet supported in this target language
//#warning nspace feature not yet supported in this target language
#endif
%feature("director") TopLevel::Bar::Foo;

View file

@ -34,11 +34,11 @@ namespace TopLevel
%include <std_string.i>
// nspace feature only supported by these languages
#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGD)
#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGD) || defined(SWIGLUA)
%nspace TopLevel::A::Foo;
%nspace TopLevel::B::Foo;
#else
#warning nspace feature not yet supported in this target language
//#warning nspace feature not yet supported in this target language
%ignore TopLevel::B::Foo;
#endif

View file

@ -0,0 +1,51 @@
#######################################################################
# Makefile for errors test-suite
#
# This test-suite is for checking SWIG errors and warnings and uses
# Python as the target language.
#
# It compares the stderr output from SWIG to the contents of the .stderr
# file for each test case. The test cases are different to those used by
# the language module test-suites. The .i files in this directory are
# used instead of those in the parent directory.
#
# When adding a new test case, be sure to commit the expected output
# file (.stderr) in addition to the test case itself.
#######################################################################
LANGUAGE = python
ERROR_EXT = newerr
srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = @top_builddir@
# All .i files with prefix 'cpp_' will be treated as C++ input and remaining .i files as C input
ALL_ERROR_TEST_CASES := $(patsubst %.i,%, $(wildcard *.i))
CPP_ERROR_TEST_CASES := $(filter cpp_%, $(ALL_ERROR_TEST_CASES))
C_ERROR_TEST_CASES := $(filter-out $(CPP_ERROR_TEST_CASES), $(ALL_ERROR_TEST_CASES))
ERROR_TEST_CASES := $(CPP_ERROR_TEST_CASES:=.cpptest) \
$(C_ERROR_TEST_CASES:=.ctest)
include $(srcdir)/../common.mk
# Rules for the different types of tests
%.cpptest:
echo "$(ACTION)ing errors testcase $*"
-$(SWIG) -c++ -python -Wall $(SWIGOPT) $*.i 2> $*.$(ERROR_EXT)
$(COMPILETOOL) diff -c $*.stderr $*.newerr
%.ctest:
echo "$(ACTION)ing errors testcase $*"
-$(SWIG) -python -Wall $(SWIGOPT) $*.i 2> $*.$(ERROR_EXT)
$(COMPILETOOL) diff -c $*.stderr $*.newerr
%.clean:
clean:
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile $(LANGUAGE)_clean
@rm -f *.newerr *.py

View file

@ -0,0 +1,2 @@
c_bad_name.i:3: Warning 121: %name is deprecated. Use %rename instead.
c_bad_name.i:3: Error: Missing argument to %name directive.

View file

@ -0,0 +1 @@
c_bad_native.i:3: Error: %native declaration 'foo' is not a function.

View file

@ -0,0 +1,2 @@
c_class.i:3: Warning 301: class keyword used, but not in C++ mode.
c_class.i:3: Warning 314: 'class' is a python keyword, renaming to '_class'

View file

@ -0,0 +1,2 @@
c_deprecated.i:3: Warning 102: %val directive deprecated (ignored).
c_deprecated.i:3: Warning 103: %out directive deprecated (ignored).

View file

@ -0,0 +1 @@
c_empty_char.i:3: Error: Empty character constant

View file

@ -0,0 +1 @@
c_enum_badvalue.i:6: Error: Type error. Expecting an integral type

View file

@ -0,0 +1 @@
c_extra_rblock.i:5: Error: Syntax error in input(1).

View file

@ -0,0 +1 @@
c_extra_rbrace.i:5: Error: Syntax error. Extraneous '}'

View file

@ -0,0 +1,3 @@
c_extra_unsigned.i:3: Error: Extra unsigned specifier.
c_extra_unsigned.i:4: Error: Extra signed specifier.
c_extra_unsigned.i:5: Error: Extra signed specifier.

View file

@ -0,0 +1 @@
c_insert_missing.i:3: Error: Couldn't find 'missing_file.i'.

View file

@ -0,0 +1,4 @@
c_long_short.i:3: Error: Extra long specifier.
c_long_short.i:4: Error: Extra short specifier.
c_long_short.i:5: Error: Extra long specifier.
c_long_short.i:6: Error: Extra short specifier.

View file

@ -0,0 +1,2 @@
c_missing_rbrace.i:3: Error: Missing '}'. Reached end of input.
c_missing_rbrace.i:3: Error: Syntax error in input(1).

View file

@ -0,0 +1 @@
c_missing_semi.i:3: Error: Syntax error in input(1).

View file

@ -0,0 +1,6 @@
c_redefine.i:4: Warning 302: Identifier 'foo' redefined (ignored),
c_redefine.i:3: Warning 302: previous definition of 'foo'.
c_redefine.i:8: Warning 302: Identifier 'bar' redefined (ignored),
c_redefine.i:6: Warning 302: previous definition of 'bar'.
c_redefine.i:14: Warning 322: Redundant redeclaration of 'bar' (Renamed from 'spam'),
c_redefine.i:6: Warning 322: previous declaration of 'bar'.

View file

@ -0,0 +1 @@
c_varargs_neg.i:3: Error: Argument count in %varargs must be positive.

View file

@ -0,0 +1,2 @@
cpp_bad_extern.i:5: Warning 313: Unrecognized extern type "INTERCAL".
cpp_bad_extern.i:7: Warning 313: Unrecognized extern type "INTERCAL".

View file

@ -0,0 +1,19 @@
cpp_extend_destructors.i:8: Warning 302: Identifier '~AStruct' redefined by %extend (ignored),
cpp_extend_destructors.i:5: Warning 302: %extend definition of '~AStruct'.
cpp_extend_destructors.i:14: Warning 302: Identifier '~BStruct' redefined (ignored),
cpp_extend_destructors.i:13: Warning 302: previous definition of '~BStruct'.
cpp_extend_destructors.i:87: Warning 302: Identifier '~JStruct' redefined (ignored),
cpp_extend_destructors.i:85: Warning 302: previous definition of '~JStruct'.
cpp_extend_destructors.i:100: Warning 302: Identifier '~LStruct' redefined (ignored),
cpp_extend_destructors.i:98: Warning 302: previous definition of '~LStruct'.
cpp_extend_destructors.i:24: Warning 521: Illegal destructor name CStruct::~NOT_CStruct(). Ignored.
cpp_extend_destructors.i:30: Warning 521: Illegal destructor name DStruct::~NOT_DStruct(). Ignored.
cpp_extend_destructors.i:44: Warning 521: Illegal destructor name EStruct::~NOT_EStruct(). Ignored.
cpp_extend_destructors.i:50: Warning 521: Illegal destructor name FStruct::~NOT_FStruct(). Ignored.
cpp_extend_destructors.i:65: Warning 521: Illegal destructor name GStruct::~NOT_GStruct(). Ignored.
cpp_extend_destructors.i:72: Warning 521: Illegal destructor name HStruct::~NOT_HStruct(). Ignored.
cpp_extend_destructors.i:81: Warning 521: Illegal destructor name IStruct::~NOT_IStruct(). Ignored.
cpp_extend_destructors.i:86: Warning 521: Illegal destructor name JStruct::~NOT_JStruct(). Ignored.
cpp_extend_destructors.i:92: Warning 521: Illegal destructor name KStruct::~NOT_KStruct(). Ignored.
cpp_extend_destructors.i:99: Warning 521: Illegal destructor name LStruct< int >::~NOT_LStruct(). Ignored.
cpp_extend_destructors.i:99: Warning 521: Illegal destructor name LStruct< short >::~NOT_LStruct(). Ignored.

View file

@ -0,0 +1,4 @@
cpp_extend_redefine.i:9: Warning 302: Identifier 'bar' redefined by %extend (ignored),
cpp_extend_redefine.i:5: Warning 302: %extend definition of 'bar'.
cpp_extend_redefine.i:14: Warning 322: Redundant redeclaration of 'spam',
cpp_extend_redefine.i:10: Warning 322: previous declaration of 'spam'.

View file

@ -0,0 +1 @@
cpp_extend_undefined.i:6: Warning 303: %extend defined for an undeclared class foo.

View file

@ -0,0 +1,20 @@
cpp_inherit.i:18: Warning 309: private inheritance from base 'A3' (ignored).
cpp_inherit.i:20: Warning 309: private inheritance from base 'A4' (ignored).
cpp_inherit.i:28: Warning 309: protected inheritance from base 'A8< double >' (ignored).
cpp_inherit.i:39: Warning 319: No access specifier given for base class 'B1' (ignored).
cpp_inherit.i:40: Warning 319: No access specifier given for base class 'B2< int >' (ignored).
cpp_inherit.i:15: Warning 401: Base class 'A1' undefined.
cpp_inherit.i:33: Warning 401: 'A1' must be defined before it is used as a base class.
cpp_inherit.i:17: Warning 401: Nothing known about base class 'A2'. Ignored.
cpp_inherit.i:22: Warning 402: Base class 'A5' is incomplete.
cpp_inherit.i:4: Warning 402: Only forward declaration 'A5' was found.
cpp_inherit.i:24: Error: 'A6' is not a valid base class.
cpp_inherit.i:5: Error: See definition of 'A6'.
cpp_inherit.i:24: Warning 401: Nothing known about base class 'A6'. Ignored.
cpp_inherit.i:26: Warning 401: Nothing known about base class 'A7< int >'. Ignored.
cpp_inherit.i:26: Warning 401: Maybe you forgot to instantiate 'A7< int >' using %template.
cpp_inherit.i:45: Warning 323: Recursive scope inheritance of 'Recursive'.
cpp_inherit.i:52: Warning 401: Base class 'Base< int >' has no name as it is an empty template instantiated with '%template()'. Ignored.
cpp_inherit.i:51: Warning 401: The %template directive must be written before 'Base< int >' is used as a base class and be declared with a name.
cpp_inherit.i:53: Warning 401: Base class 'Base< double >' undefined.
cpp_inherit.i:54: Warning 401: 'Base< double >' must be defined before it is used as a base class.

View file

@ -0,0 +1 @@
cpp_inline_namespace.i:4: Error: %inline directive inside a namespace is disallowed.

View file

@ -0,0 +1,21 @@
cpp_macro_locator.i:66: Warning 204: CPP #warning, "inline warning message one".
cpp_macro_locator.i:96: Warning 204: CPP #warning, "an inline warning message 2".
cpp_macro_locator.i:50: Warning 325: Nested struct not currently supported (Inner ignored)
cpp_macro_locator.i:53: Warning 509: Overloaded method overload1(int const *) effectively ignored,
cpp_macro_locator.i:52: Warning 509: as it is shadowed by overload1(int *).
cpp_macro_locator.i:61: Warning 509: Overloaded method overload2(int const *) effectively ignored,
cpp_macro_locator.i:60: Warning 509: as it is shadowed by overload2(int *).
cpp_macro_locator.i:64: Warning 509: Overloaded method Klass1::methodX(int const *) effectively ignored,
cpp_macro_locator.i:64: Warning 509: as it is shadowed by Klass1::methodX(int *).
cpp_macro_locator.i:68: Warning 509: Overloaded method overload3(int const *) effectively ignored,
cpp_macro_locator.i:67: Warning 509: as it is shadowed by overload3(int *).
cpp_macro_locator.i:90: Warning 509: Overloaded method overload4(int const *) effectively ignored,
cpp_macro_locator.i:89: Warning 509: as it is shadowed by overload4(int *).
cpp_macro_locator.i:94: Warning 509: Overloaded method overloadinline1(int const *) effectively ignored,
cpp_macro_locator.i:93: Warning 509: as it is shadowed by overloadinline1(int *).
cpp_macro_locator.i:95: Warning 509: Overloaded method Klass2::methodX(int const *) effectively ignored,
cpp_macro_locator.i:95: Warning 509: as it is shadowed by Klass2::methodX(int *).
cpp_macro_locator.i:98: Warning 509: Overloaded method overloadinline2(int const *) effectively ignored,
cpp_macro_locator.i:97: Warning 509: as it is shadowed by overloadinline2(int *).
cpp_macro_locator.i:101: Warning 509: Overloaded method overload5(int const *) effectively ignored,
cpp_macro_locator.i:100: Warning 509: as it is shadowed by overload5(int *).

View file

@ -0,0 +1,2 @@
cpp_missing_rparenthesis.i:5: Error: Missing ')'. Reached end of input.
cpp_missing_rparenthesis.i:5: Error: Syntax error in input(3).

View file

@ -0,0 +1 @@
cpp_missing_rtemplate.i:4: Error: Syntax error in input(1).

View file

@ -0,0 +1 @@
cpp_namespace_alias.i:8: Warning 308: Namespace alias 'B' not allowed here. Assuming 'blah'

View file

@ -0,0 +1 @@
cpp_namespace_aliasnot.i:4: Error: 'blah' is not a namespace

View file

@ -0,0 +1 @@
cpp_namespace_aliasundef.i:3: Error: Unknown namespace 'blah'

View file

@ -1,13 +0,0 @@
%module xxx
class Foo {
public:
class Bar {
};
};
class Spam {
public:
class Grok {
} x;
};

View file

@ -0,0 +1,20 @@
%module xxx
template<typename T> struct Temply {
T thing;
};
struct A {
int var;
%template(TemplyInt) Temply<int>;
};
struct B {
int var;
};
%extend B {
%template(TemplyDouble) Temply<double>;
}

View file

@ -0,0 +1,2 @@
cpp_nested_template.i:9: Warning 324: Named nested template instantiations not supported. Processing as if no name was given to %template().
cpp_nested_template.i:18: Warning 324: Named nested template instantiations not supported. Processing as if no name was given to %template().

View file

@ -0,0 +1 @@
cpp_no_access.i:3: Warning 319: No access specifier given for base class 'foo' (ignored).

View file

@ -0,0 +1,2 @@
cpp_no_return_type.i:6: Warning 504: Function S::R() must have a return type. Ignored.
cpp_no_return_type.i:10: Warning 504: Function U::UU() must have a return type. Ignored.

View file

@ -0,0 +1,3 @@
cpp_nobase.i:3: Warning 401: Nothing known about base class 'Bar'. Ignored.
cpp_nobase.i:6: Warning 401: Nothing known about base class 'Bar< int >'. Ignored.
cpp_nobase.i:6: Warning 401: Maybe you forgot to instantiate 'Bar< int >' using %template.

View file

@ -0,0 +1,10 @@
cpp_overload_const.i:4: Warning 509: Overloaded method check(int *) effectively ignored,
cpp_overload_const.i:3: Warning 509: as it is shadowed by check(int const *).
cpp_overload_const.i:5: Warning 509: Overloaded method check(int &) effectively ignored,
cpp_overload_const.i:3: Warning 509: as it is shadowed by check(int const *).
cpp_overload_const.i:10: Warning 509: Overloaded method check(OverStruct *) effectively ignored,
cpp_overload_const.i:9: Warning 509: as it is shadowed by check(OverStruct const *).
cpp_overload_const.i:11: Warning 509: Overloaded method check(OverStruct &) effectively ignored,
cpp_overload_const.i:9: Warning 509: as it is shadowed by check(OverStruct const *).
cpp_overload_const.i:12: Warning 509: Overloaded method check(OverStruct const &) effectively ignored,
cpp_overload_const.i:9: Warning 509: as it is shadowed by check(OverStruct const *).

View file

@ -0,0 +1,2 @@
cpp_private_inherit.i:6: Warning 309: private inheritance from base 'Foo' (ignored).
cpp_private_inherit.i:9: Warning 309: protected inheritance from base 'Foo' (ignored).

View file

@ -0,0 +1 @@
:1: Error: Recursive typedef detected resolving 'pds *' to 'std::set< pds > *' to 'std::set< std::set< pds > > *' and so on...

View file

@ -0,0 +1,3 @@
cpp_shared_ptr.i:20: Warning 520: Base class 'A' of 'C' is not similarly marked as a smart pointer.
cpp_shared_ptr.i:24: Warning 520: Derived class 'D' of 'C' is not similarly marked as a smart pointer.
cpp_shared_ptr.i:24: Warning 520: Derived class 'D' of 'B' is not similarly marked as a smart pointer.

View file

@ -0,0 +1,2 @@
cpp_template_nargs.i:5: Error: Template 'blah' undefined.
cpp_template_nargs.i:6: Error: Template 'blah' undefined.

View file

@ -0,0 +1 @@
cpp_template_not.i:5: Error: 'blah' is not defined as a template. (cdecl)

Some files were not shown because too many files have changed in this diff Show more