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; } char contrived(const char *c = &charvalue) { return *c; }
protected: protected:
static const int intvalue = 2000; static const int intvalue = 2000;
static const double doublevalue = 987.654; static const double doublevalue;
}; };
const char Tricky::charvalue = 'X'; const char Tricky::charvalue = 'X';
const double Tricky::doublevalue = 987.654;
// tests default argument which is a constructor call within namespace // tests default argument which is a constructor call within namespace

View file

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

View file

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

View file

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

View file

@ -12,7 +12,7 @@ behave appropriately for that particular species.
For this to work correctly however, it is critical that For this to work correctly however, it is critical that
there is a variable which strictly preserves the name 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 it sometimes contains 'Giraffe' and sometimes (specifically
the case of arrays) contains 'Animal'. Since existing the case of arrays) contains 'Animal'. Since existing
code may rely on that behaviour, we create a new variable 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 () %typemap(in) Animal ()
{ {
void *space_needed = malloc(HEIGHT_$1_lextype * WIDTH_$1_lextype); void *space_needed = malloc(HEIGHT_$1_lextype * WIDTH_$1_lextype);
$1 = 0;
} }
%typemap(in) Animal[2] () %typemap(in) Animal[2] ()
{ {
void *space_needed = malloc(2 * HEIGHT_$1_lextype * WIDTH_$1_lextype); void *space_needed = malloc(2 * HEIGHT_$1_lextype * WIDTH_$1_lextype);
$1 = 0;
} }
%inline %{ %inline %{
@ -44,6 +46,6 @@ typedef Animal Giraffe;
void eat(Giraffe g) {} void eat(Giraffe g) {}
void drink(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)); 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 *>; %template(IntPtrVector) std::vector<int *>;
#endif
%template(StructVector) std::vector<Struct>;

View file

@ -22,6 +22,7 @@
%inline %{ %inline %{
struct Foo { struct Foo {
int var;
#ifdef __cplusplus #ifdef __cplusplus
int test() { return -1; } int test() { return -1; }
#endif #endif
@ -49,6 +50,7 @@ struct Foo {
%inline %{ %inline %{
typedef struct { typedef struct {
int var;
} Bar; } 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); 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); return (ap.*pf)(a);
} }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -414,7 +414,7 @@ class CSHARP : public Language {
void emitBanner(File *f) { void emitBanner(File *f) {
Printf(f, "/* ----------------------------------------------------------------------------\n"); Printf(f, "/* ----------------------------------------------------------------------------\n");
Printf(f, " * This file was automatically generated by SWIG (http://www.swig.org).\n"); Printf(f, " * This file was automatically generated by SWIG (http://www.swig.org).\n");
Printf(f, " * Version: %s\n", PACKAGE_VERSION); Printf(f, " * Version %s\n", PACKAGE_VERSION);
Printf(f, " *\n"); Printf(f, " *\n");
Printf(f, " * Do not make changes to this file unless you know what you are doing--modify\n"); Printf(f, " * Do not make changes to this file unless you know what you are doing--modify\n");
Printf(f, " * the SWIG interface file instead.\n"); Printf(f, " * the SWIG interface file instead.\n");

View file

@ -600,7 +600,7 @@ class JAVA : public Language {
void emitBanner(File *f) { void emitBanner(File *f) {
Printf(f, "/* ----------------------------------------------------------------------------\n"); Printf(f, "/* ----------------------------------------------------------------------------\n");
Printf(f, " * This file was automatically generated by SWIG (http://www.swig.org).\n"); Printf(f, " * This file was automatically generated by SWIG (http://www.swig.org).\n");
Printf(f, " * Version: %s\n", PACKAGE_VERSION); Printf(f, " * Version %s\n", PACKAGE_VERSION);
Printf(f, " *\n"); Printf(f, " *\n");
Printf(f, " * Do not make changes to this file unless you know what you are doing--modify\n"); Printf(f, " * Do not make changes to this file unless you know what you are doing--modify\n");
Printf(f, " * the SWIG interface file instead.\n"); Printf(f, " * the SWIG interface file instead.\n");
@ -2063,6 +2063,7 @@ class JAVA : public Language {
Printf(conn_wrap->def, "JNIEXPORT void JNICALL Java_%s%s_%s(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg) {", Printf(conn_wrap->def, "JNIEXPORT void JNICALL Java_%s%s_%s(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg) {",
jnipackage, jni_imclass_name, swig_director_connect_jni); jnipackage, jni_imclass_name, swig_director_connect_jni);
Printf(conn_wrap->code, " %s *obj = *((%s **) &objarg);\n", norm_name, norm_name); Printf(conn_wrap->code, " %s *obj = *((%s **) &objarg);\n", norm_name, norm_name);
Printf(conn_wrap->code, " (void)jcls;\n");
Printf(conn_wrap->code, " SwigDirector_%s *director = dynamic_cast<SwigDirector_%s *>(obj);\n", Printf(conn_wrap->code, " SwigDirector_%s *director = dynamic_cast<SwigDirector_%s *>(obj);\n",
Getattr(n, "sym:name"), Getattr(n, "sym:name")); Getattr(n, "sym:name"), Getattr(n, "sym:name"));
Printf(conn_wrap->code, " if (director) {\n"); Printf(conn_wrap->code, " if (director) {\n");

View file

@ -1236,7 +1236,7 @@ MODULA3 ():
Printf (f, "\ Printf (f, "\
(*******************************************************************************\n\ (*******************************************************************************\n\
* This file was automatically generated by SWIG (http://www.swig.org/).\n\ * This file was automatically generated by SWIG (http://www.swig.org/).\n\
* Version: %s\n\ * Version %s\n\
*\n\ *\n\
* Do not make changes to this file unless you know what you are doing --\n\ * Do not make changes to this file unless you know what you are doing --\n\
* modify the SWIG interface file instead.\n\ * modify the SWIG interface file instead.\n\

View file

@ -1025,11 +1025,11 @@ public:
if (n && Getattr(n,"feature:callback")) { if (n && Getattr(n,"feature:callback")) {
if (have_docstring(n)) { if (have_docstring(n)) {
Printf(methods,"\"%s\\nswig_ptr: %s\"", Printf(methods,"(char *)\"%s\\nswig_ptr: %s\"",
docstring(n, AUTODOC_FUNC, "", false), docstring(n, AUTODOC_FUNC, "", false),
Getattr(n,"feature:callback:name")); Getattr(n,"feature:callback:name"));
} else { } else {
Printf(methods,"\"swig_ptr: %s\"",Getattr(n,"feature:callback:name")); Printf(methods,"(char *)\"swig_ptr: %s\"",Getattr(n,"feature:callback:name"));
} }
} else { } else {
Printf(methods,"NULL"); Printf(methods,"NULL");

View file

@ -1003,7 +1003,7 @@ public:
int numarg = emit_num_arguments(l); int numarg = emit_num_arguments(l);
int numreq = emit_num_required(l); int numreq = emit_num_required(l);
int varargs = emit_isvarargs(l); int varargs = emit_isvarargs(l);
bool allow_kwargs = Getattr(n,"feature:kwargs"); bool allow_kwargs = Getattr(n,"feature:kwargs") ? true : false;
bool use_director = (current == CONSTRUCTOR_INITIALIZE && Swig_directorclass(n)); bool use_director = (current == CONSTRUCTOR_INITIALIZE && Swig_directorclass(n));
int start = (current == MEMBER_FUNC || current == MEMBER_VAR || use_director) ? 1 : 0; int start = (current == MEMBER_FUNC || current == MEMBER_VAR || use_director) ? 1 : 0;