Merge branch 'clang_fixes' of github.com:marvingreenberg/swig into marvingreenberg-clang_fixes
This commit is contained in:
commit
078dbf8d22
18 changed files with 182 additions and 21 deletions
|
|
@ -1205,7 +1205,7 @@ CSHARPCOMPILER = @CSHARPCOMPILER@
|
|||
CSHARPCILINTERPRETER = @CSHARPCILINTERPRETER@
|
||||
CSHARPCFLAGS = @CSHARPCFLAGS@
|
||||
CSHARPSO = @CSHARPSO@
|
||||
CSHARP_RUNME = ./$(RUNME).exe
|
||||
CSHARP_RUNME = $(CSHARPCILINTERPRETER) ./$(RUNME).exe
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# Build a CSharp dynamically loadable module (C)
|
||||
|
|
|
|||
|
|
@ -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) {}
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,9 +17,10 @@
|
|||
#if defined(SWIG_GOOD_VECTOR)
|
||||
%inline %{
|
||||
class Flow {
|
||||
Flow() {}
|
||||
double x;
|
||||
Flow():x(0.0) {}
|
||||
public:
|
||||
Flow(double d) {}
|
||||
Flow(double d) : x(d) {}
|
||||
};
|
||||
%}
|
||||
|
||||
|
|
@ -28,9 +29,10 @@ public:
|
|||
|
||||
%inline %{
|
||||
class Flow {
|
||||
double x;
|
||||
public:
|
||||
Flow() {}
|
||||
Flow(double d) {}
|
||||
Flow(): x(0.0) {}
|
||||
Flow(double d) : x(d) {}
|
||||
};
|
||||
%}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,12 +7,22 @@
|
|||
%inline %{
|
||||
namespace ns {
|
||||
struct Global {
|
||||
#ifdef __clang__
|
||||
struct Outer {
|
||||
struct Nested;
|
||||
struct Nested {
|
||||
int data;
|
||||
};
|
||||
};
|
||||
struct Outer::Nested instance;
|
||||
#else
|
||||
struct Outer {
|
||||
struct Nested;
|
||||
};
|
||||
struct Outer::Nested {
|
||||
int data;
|
||||
} instance;
|
||||
#endif
|
||||
};
|
||||
}
|
||||
%}
|
||||
%}
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@
|
|||
|
||||
%inline %{
|
||||
class ItkLevelSetNodeUS2 {
|
||||
int x;
|
||||
};
|
||||
%}
|
||||
|
||||
|
|
|
|||
|
|
@ -191,7 +191,8 @@ template <class C> struct Param
|
|||
|
||||
struct Foo
|
||||
{
|
||||
Foo(int i) {
|
||||
int x;
|
||||
Foo(int i) : x(i) {
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ namespace simuPOP
|
|||
template<class _POP1, class _POP2 = POP>
|
||||
class Operator
|
||||
{
|
||||
int x;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
{
|
||||
struct OpaqueStruct
|
||||
{
|
||||
int x;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,15 @@ namespace Outer1 {
|
|||
}
|
||||
using namespace Outer1::Space1;
|
||||
using Outer1::Space1::Thing1;
|
||||
#ifdef __clang__
|
||||
namespace Outer1 {
|
||||
namespace Space1 {
|
||||
template<typename T> class Thing1 {};
|
||||
}
|
||||
}
|
||||
#else
|
||||
template<typename T> class Thing1 {};
|
||||
#endif
|
||||
void useit1(Thing1<int> t) {}
|
||||
void useit1a(Outer1::Space1::Thing1<int> t) {}
|
||||
void useit1b(::Outer1::Space1::Thing1<int> t) {}
|
||||
|
|
@ -25,7 +33,15 @@ namespace Outer2 {
|
|||
}
|
||||
using namespace Outer2;
|
||||
using Space2::Thing2;
|
||||
#ifdef __clang__
|
||||
namespace Outer2 {
|
||||
namespace Space2 {
|
||||
template<typename T> class Thing2 {};
|
||||
}
|
||||
}
|
||||
#else
|
||||
template<typename T> class Thing2 {};
|
||||
#endif
|
||||
void useit2(Thing2<int> t) {}
|
||||
void useit2a(Outer2::Space2::Thing2<int> t) {}
|
||||
void useit2b(::Outer2::Space2::Thing2<int> t) {}
|
||||
|
|
@ -45,7 +61,17 @@ namespace Outer3 {
|
|||
using namespace Outer3;
|
||||
using namespace Space3;
|
||||
using Middle3::Thing3;
|
||||
#ifdef __clang__
|
||||
namespace Outer3 {
|
||||
namespace Space3 {
|
||||
namespace Middle3 {
|
||||
template<typename T> class Thing3 {};
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
template<typename T> class Thing3 {};
|
||||
#endif
|
||||
void useit3(Thing3<int> t) {}
|
||||
void useit3a(Outer3::Space3::Middle3::Thing3<int> t) {}
|
||||
void useit3b(::Outer3::Space3::Middle3::Thing3<int> t) {}
|
||||
|
|
@ -66,7 +92,17 @@ namespace Outer4 {
|
|||
}
|
||||
using namespace Outer4::Space4;
|
||||
using Middle4::Thing4;
|
||||
#ifdef __clang__
|
||||
namespace Outer4 {
|
||||
namespace Space4 {
|
||||
namespace Middle4 {
|
||||
template<typename T> class Thing4 {};
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
template<typename T> class Thing4 {};
|
||||
#endif
|
||||
void useit4(Thing4<int> t) {}
|
||||
void useit4a(Outer4::Space4::Middle4::Thing4<int> t) {}
|
||||
void useit4b(::Outer4::Space4::Middle4::Thing4<int> t) {}
|
||||
|
|
@ -90,7 +126,19 @@ namespace Outer5 {
|
|||
using namespace ::Outer5::Space5;
|
||||
using namespace Middle5;
|
||||
using More5::Thing5;
|
||||
#ifdef __clang__
|
||||
namespace Outer5 {
|
||||
namespace Space5 {
|
||||
namespace Middle5 {
|
||||
namespace More5 {
|
||||
template<typename T> class Thing5 {};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
template<typename T> class Thing5 {};
|
||||
#endif
|
||||
void useit5(Thing5<int> t) {}
|
||||
void useit5a(Outer5::Space5::Middle5::More5::Thing5<int> t) {}
|
||||
void useit5b(::Outer5::Space5::Middle5::More5::Thing5<int> t) {}
|
||||
|
|
@ -109,7 +157,17 @@ namespace Outer7 {
|
|||
}
|
||||
}
|
||||
using namespace Outer7::Space7;
|
||||
#ifdef __clang__
|
||||
namespace Outer7 {
|
||||
namespace Space7 {
|
||||
namespace Middle7 {
|
||||
template<typename T> class Thing7 {};
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
template<typename T> class Middle7::Thing7 {};
|
||||
#endif
|
||||
using Middle7::Thing7;
|
||||
void useit7(Thing7<int> t) {}
|
||||
void useit7a(Outer7::Space7::Middle7::Thing7<int> t) {}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,15 @@ namespace Outer1 {
|
|||
}
|
||||
using namespace Outer1::Space1;
|
||||
using Outer1::Space1::Thing1;
|
||||
#ifdef __clang__
|
||||
namespace Outer1 {
|
||||
namespace Space1 {
|
||||
class Thing1 {};
|
||||
}
|
||||
}
|
||||
#else
|
||||
class Thing1 {};
|
||||
#endif
|
||||
void useit1(Thing1 t) {}
|
||||
void useit1a(Outer1::Space1::Thing1 t) {}
|
||||
void useit1b(::Outer1::Space1::Thing1 t) {}
|
||||
|
|
@ -25,7 +33,17 @@ namespace Outer2 {
|
|||
}
|
||||
using namespace Outer2;
|
||||
using Space2::Thing2;
|
||||
using namespace Outer1::Space1;
|
||||
using Outer1::Space1::Thing1;
|
||||
#ifdef __clang__
|
||||
namespace Outer2 {
|
||||
namespace Space2 {
|
||||
class Thing2 {};
|
||||
}
|
||||
}
|
||||
#else
|
||||
class Thing2 {};
|
||||
#endif
|
||||
void useit2(Thing2 t) {}
|
||||
void useit2a(Outer2::Space2::Thing2 t) {}
|
||||
void useit2b(::Outer2::Space2::Thing2 t) {}
|
||||
|
|
@ -45,7 +63,17 @@ namespace Outer3 {
|
|||
using namespace Outer3;
|
||||
using namespace Space3;
|
||||
using Middle3::Thing3;
|
||||
#ifdef __clang__
|
||||
namespace Outer3 {
|
||||
namespace Space3 {
|
||||
namespace Middle3 {
|
||||
class Thing3 {};
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
class Thing3 {};
|
||||
#endif
|
||||
void useit3(Thing3 t) {}
|
||||
void useit3a(Outer3::Space3::Middle3::Thing3 t) {}
|
||||
void useit3b(::Outer3::Space3::Middle3::Thing3 t) {}
|
||||
|
|
@ -66,7 +94,17 @@ namespace Outer4 {
|
|||
}
|
||||
using namespace Outer4::Space4;
|
||||
using Middle4::Thing4;
|
||||
#ifdef __clang__
|
||||
namespace Outer4 {
|
||||
namespace Space4 {
|
||||
namespace Middle4 {
|
||||
class Thing4 {};
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
class Thing4 {};
|
||||
#endif
|
||||
void useit4(Thing4 t) {}
|
||||
void useit4a(Outer4::Space4::Middle4::Thing4 t) {}
|
||||
void useit4b(::Outer4::Space4::Middle4::Thing4 t) {}
|
||||
|
|
@ -90,7 +128,19 @@ namespace Outer5 {
|
|||
using namespace ::Outer5::Space5;
|
||||
using namespace Middle5;
|
||||
using More5::Thing5;
|
||||
#ifdef __clang__
|
||||
namespace Outer5 {
|
||||
namespace Space5 {
|
||||
namespace Middle5 {
|
||||
namespace More5 {
|
||||
class Thing5 {};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
class Thing5 {};
|
||||
#endif
|
||||
void useit5(Thing5 t) {}
|
||||
void useit5a(Outer5::Space5::Middle5::More5::Thing5 t) {}
|
||||
void useit5b(::Outer5::Space5::Middle5::More5::Thing5 t) {}
|
||||
|
|
@ -109,7 +159,17 @@ namespace Outer7 {
|
|||
}
|
||||
}
|
||||
using namespace Outer7::Space7;
|
||||
#ifdef __clang__
|
||||
namespace Outer7 {
|
||||
namespace Space7 {
|
||||
namespace Middle7 {
|
||||
class Thing7 {};
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
class Middle7::Thing7 {};
|
||||
#endif
|
||||
using Middle7::Thing7;
|
||||
void useit7(Thing7 t) {}
|
||||
void useit7a(Outer7::Space7::Middle7::Thing7 t) {}
|
||||
|
|
|
|||
|
|
@ -217,7 +217,7 @@
|
|||
else
|
||||
throw std::out_of_range("index");
|
||||
}
|
||||
const_reference getitem(int index) throw (std::out_of_range) {
|
||||
CONST_REFERENCE getitem(int index) throw (std::out_of_range) {
|
||||
if (index>=0 && index<(int)$self->size())
|
||||
return (*$self)[index];
|
||||
else
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ public void capacity(size_t value) {
|
|||
return $self->capacity() - $self->size();
|
||||
}
|
||||
|
||||
const_reference remove() throw (std::out_of_range) {
|
||||
CONST_REFERENCE remove() throw (std::out_of_range) {
|
||||
if ($self->empty()) {
|
||||
throw std::out_of_range("Tried to remove last element from empty vector.");
|
||||
}
|
||||
|
|
@ -138,7 +138,7 @@ public void capacity(size_t value) {
|
|||
return value;
|
||||
}
|
||||
|
||||
const_reference remove(size_type index) throw (std::out_of_range) {
|
||||
CONST_REFERENCE remove(size_type index) throw (std::out_of_range) {
|
||||
if (index >= $self->size()) {
|
||||
throw std::out_of_range("Tried to remove element with invalid index.");
|
||||
}
|
||||
|
|
@ -153,7 +153,7 @@ public void capacity(size_t value) {
|
|||
// Wrappers for setting/getting items with the possibly thrown exception
|
||||
// specified (important for SWIG wrapper generation).
|
||||
%extend {
|
||||
const_reference getElement(size_type index) throw (std::out_of_range) {
|
||||
CONST_REFERENCE getElement(size_type index) throw (std::out_of_range) {
|
||||
if ((index < 0) || ($self->size() <= index)) {
|
||||
throw std::out_of_range("Tried to get value of element with invalid index.");
|
||||
}
|
||||
|
|
@ -464,7 +464,7 @@ int opApply(int delegate(ref size_t index, ref $typemap(dtype, CTYPE) value) dg)
|
|||
return pv;
|
||||
}
|
||||
|
||||
const_reference remove() throw (std::out_of_range) {
|
||||
CONST_REFERENCE remove() throw (std::out_of_range) {
|
||||
if ($self->empty()) {
|
||||
throw std::out_of_range("Tried to remove last element from empty vector.");
|
||||
}
|
||||
|
|
@ -474,7 +474,7 @@ int opApply(int delegate(ref size_t index, ref $typemap(dtype, CTYPE) value) dg)
|
|||
return value;
|
||||
}
|
||||
|
||||
const_reference remove(size_type index) throw (std::out_of_range) {
|
||||
CONST_REFERENCE remove(size_type index) throw (std::out_of_range) {
|
||||
if (index >= $self->size()) {
|
||||
throw std::out_of_range("Tried to remove element with invalid index.");
|
||||
}
|
||||
|
|
@ -506,7 +506,7 @@ int opApply(int delegate(ref size_t index, ref $typemap(dtype, CTYPE) value) dg)
|
|||
// Wrappers for setting/getting items with the possibly thrown exception
|
||||
// specified (important for SWIG wrapper generation).
|
||||
%extend {
|
||||
const_reference getElement(size_type index) throw (std::out_of_range) {
|
||||
CONST_REFERENCE getElement(size_type index) throw (std::out_of_range) {
|
||||
if ((index < 0) || ($self->size() <= index)) {
|
||||
throw std::out_of_range("Tried to get value of element with invalid index.");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ namespace std {
|
|||
%rename(add) push_back;
|
||||
void push_back(const value_type& x);
|
||||
%extend {
|
||||
const_reference get(int i) throw (std::out_of_range) {
|
||||
bool get(int i) throw (std::out_of_range) {
|
||||
int size = int(self->size());
|
||||
if (i>=0 && i<size)
|
||||
return (*self)[i];
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ namespace std {
|
|||
%rename(add) push_back;
|
||||
void push_back(const value_type& x);
|
||||
%extend {
|
||||
const_reference get(int i) throw (std::out_of_range) {
|
||||
bool get(int i) throw (std::out_of_range) {
|
||||
int size = int(self->size());
|
||||
if (i>=0 && i<size)
|
||||
return (*self)[i];
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ namespace std {
|
|||
self->pop_back();
|
||||
return x;
|
||||
}
|
||||
const_reference get(int i) throw (std::out_of_range) {
|
||||
bool get(int i) throw (std::out_of_range) {
|
||||
int size = int(self->size());
|
||||
if (i>=0 && i<size)
|
||||
return (*self)[i];
|
||||
|
|
|
|||
|
|
@ -73,7 +73,13 @@ namespace std {
|
|||
#endif
|
||||
%}
|
||||
|
||||
%fragment("StdTraitsCommon","header") %{
|
||||
%fragment("StdStringInclude","header") %{
|
||||
#ifdef __clang__
|
||||
#include <string>
|
||||
#endif
|
||||
%}
|
||||
|
||||
%fragment("StdTraitsCommon","header",fragment="StdStringInclude") %{
|
||||
namespace swig {
|
||||
template <class Type>
|
||||
struct noconst_traits {
|
||||
|
|
|
|||
|
|
@ -26,7 +26,13 @@
|
|||
#include <stdexcept>
|
||||
%}
|
||||
|
||||
%fragment("Traits","header")
|
||||
%fragment("StdStringInclude","header") %{
|
||||
#ifdef __clang__
|
||||
#include <string>
|
||||
#endif
|
||||
%}
|
||||
|
||||
%fragment("Traits","header",fragment="StdStringInclude")
|
||||
{
|
||||
namespace swig {
|
||||
/*
|
||||
|
|
|
|||
13
configure.ac
13
configure.ac
|
|
@ -352,6 +352,19 @@ if test x"$enable_cpp11_testing" = xyes; then
|
|||
fi
|
||||
fi
|
||||
|
||||
# On darwin 10.7,10.8,10.9 using clang++, need to ensure using
|
||||
# libc++ for tests and examples to run under mono. May affect
|
||||
# other language targets as well - problem is an OSX incompatibility
|
||||
# between libraries depending on libstdc++ and libc++.
|
||||
CLANGXX=
|
||||
$CXX -v 2>&1 | grep -i clang >/dev/null && CLANGXX=yes
|
||||
case $host in
|
||||
*-*-darwin11* | *-*-darwin12* |*-*-darwin13* ) if test "$CLANGXX" = "yes";
|
||||
then PLATCXXFLAGS="$PLATCXXFLAGS -stdlib=libc++"
|
||||
fi;;
|
||||
*) ;;
|
||||
esac
|
||||
|
||||
# Set info about shared libraries.
|
||||
AC_SUBST(SO)
|
||||
AC_SUBST(LDSHARED)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue