various fixes to remove warnings

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@6580 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2004-11-01 21:10:06 +00:00
commit 11d77ef9ae
21 changed files with 41 additions and 28 deletions

View file

@ -162,9 +162,10 @@ public:
char contrived(const char *c = &charvalue) { return *c; }
protected:
static const int intvalue = 2000;
static const double doublevalue = 987.654;
static const double doublevalue;
};
const char Tricky::charvalue = 'X';
const double Tricky::doublevalue = 987.654;
// tests default argument which is a constructor call within namespace

View file

@ -12,7 +12,7 @@
%inline %{
namespace EnumDirector {
class A;
struct A;
enum Hello {
hi, hello, yo, awright

View file

@ -442,11 +442,9 @@ namespace curly {
}
struct Obscure {
enum {};
enum Zero {};
enum One {one};
enum Two {two, twoagain};
typedef enum {};
typedef enum Empty {};
typedef enum {} AlsoEmpty;
};

View file

@ -9,6 +9,7 @@
%inline
%{
void globalscope(); // forward declaration needed for some compilers
struct A;
struct B

View file

@ -12,7 +12,7 @@ behave appropriately for that particular species.
For this to work correctly however, it is critical that
there is a variable which strictly preserves the name
of the type. '$lextype' doesn't currently do this -
of the type. '$basetype' doesn't currently do this -
it sometimes contains 'Giraffe' and sometimes (specifically
the case of arrays) contains 'Animal'. Since existing
code may rely on that behaviour, we create a new variable
@ -27,11 +27,13 @@ code is not functioning properly it will fail to compile.
%typemap(in) Animal ()
{
void *space_needed = malloc(HEIGHT_$1_lextype * WIDTH_$1_lextype);
$1 = 0;
}
%typemap(in) Animal[2] ()
{
void *space_needed = malloc(2 * HEIGHT_$1_lextype * WIDTH_$1_lextype);
$1 = 0;
}
%inline %{
@ -44,6 +46,6 @@ typedef Animal Giraffe;
void eat(Giraffe g) {}
void drink(Giraffe *g) {}
Giraffe mate(Giraffe g[2]) {}
Giraffe mate(Giraffe g[2]) { return g[0]; }
%}

View file

@ -40,9 +40,19 @@ void halve_in_place(std::vector<double>& v) {
std::bind2nd(std::divides<double>(),2.0));
}
struct Struct {
double num;
Struct() : num(0.0) {}
Struct(double d) : num(d) {}
// bool operator==(const Struct &other) { return (num == other.num); }
};
%}
#ifndef SWIGCSHARP
// Can't do vectors of pointers yet
%template(IntPtrVector) std::vector<int *>;
#endif
%template(StructVector) std::vector<Struct>;

View file

@ -22,6 +22,7 @@
%inline %{
struct Foo {
int var;
#ifdef __cplusplus
int test() { return -1; }
#endif
@ -49,6 +50,7 @@ struct Foo {
%inline %{
typedef struct {
int var;
} Bar;
%}

View file

@ -30,11 +30,11 @@
};
int foobar(int a, int (*pf)(int a)) {
extern "C" int foobar(int a, int (*pf)(int a)) {
return pf(a);
}
int foobarm(int a, A ap, int (A::*pf)(int a)) {
extern "C" int foobarm(int a, A ap, int (A::*pf)(int a)) {
return (ap.*pf)(a);
}

View file

@ -36,8 +36,8 @@
typedef int Int;
typedef int Int;
int hello(int);
inline int hello(int) { return 0; }
inline int hello(int);
int hello(int) { return 0; }
struct B;

View file

@ -1,7 +1,5 @@
%module template_array_numeric
%typemap(arginit) const float[ANY] (float temp[$1_dim0]) { }
%inline %{
template <int Len>

View file

@ -27,8 +27,8 @@
%}
%{
template class Function <double, double>;
template class Class <double, double>;
template struct Function <double, double>;
template struct Class <double, double>;
%}
%template(traits_dd) traits <double, double>;

View file

@ -58,8 +58,8 @@
%{
namespace hello {
template class Function <Double, Double>;
template class ArithFunction <Double, Double>;
template struct Function <Double, Double>;
template struct ArithFunction <Double, Double>;
template class Class <Double, Double>;
}
%}

View file

@ -39,8 +39,8 @@
%}
%{
template class Function <Double, Double>;
template class Class <Double, Double>;
template struct Function <Double, Double>;
template struct Class <Double, Double>;
%}
%template(traits_dd) traits <Double, Double>;

View file

@ -4,7 +4,7 @@
class Foo {
public:
int x;
int blah(int x) { return x; }
int blah(int xx) { return xx; }
int defaulted(int i = -1) { return i; }
};

View file

@ -4,7 +4,7 @@
class Foo {
protected:
int x;
int blah(int x) { return x; }
int blah(int xx) { return xx; }
};
class FooBar : public Foo {

View file

@ -131,7 +131,7 @@ class BB {
friend class AA;
protected:
BB(int a) { this->a = a; };
BB(int aa) { this->a = aa; };
BB() {};
int a;