more fixes for gcc -fstrict-aliasing -Wall
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7193 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
94e6c86d06
commit
71646dcd81
4 changed files with 8 additions and 8 deletions
|
|
@ -27,13 +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;
|
$1 = space_needed;
|
||||||
}
|
}
|
||||||
|
|
||||||
%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;
|
$1 = space_needed;
|
||||||
}
|
}
|
||||||
|
|
||||||
%inline %{
|
%inline %{
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ struct Structure {
|
||||||
const std::string ConstMemberString;
|
const std::string ConstMemberString;
|
||||||
static const std::string ConstStaticMemberString;
|
static const std::string ConstStaticMemberString;
|
||||||
|
|
||||||
Structure() : ConstMemberString("const member string"), MemberString2("member string 2") {}
|
Structure() : MemberString2("member string 2"), ConstMemberString("const member string") {}
|
||||||
};
|
};
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -366,13 +366,13 @@ JAVA_ARRAYS_TYPEMAPS(double, double, jdouble, Double, "[D") /* double[ANY] *
|
||||||
}
|
}
|
||||||
|
|
||||||
%typemap(in) ARRAYSOFENUMS[] (jint *jarr)
|
%typemap(in) ARRAYSOFENUMS[] (jint *jarr)
|
||||||
%{ if (!SWIG_JavaArrayInInt(jenv, &jarr, (int**)&$1, $input)) return $null; %}
|
%{ if (!SWIG_JavaArrayInInt(jenv, &jarr, (int **)(void *)&$1, $input)) return $null; %}
|
||||||
%typemap(in) ARRAYSOFENUMS[ANY] (jint *jarr) {
|
%typemap(in) ARRAYSOFENUMS[ANY] (jint *jarr) {
|
||||||
if ($input && JCALL1(GetArrayLength, jenv, $input) != $1_size) {
|
if ($input && JCALL1(GetArrayLength, jenv, $input) != $1_size) {
|
||||||
SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, "incorrect array size");
|
SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, "incorrect array size");
|
||||||
return $null;
|
return $null;
|
||||||
}
|
}
|
||||||
if (!SWIG_JavaArrayInInt(jenv, &jarr, (int**)&$1, $input)) return $null;
|
if (!SWIG_JavaArrayInInt(jenv, &jarr, (int **)(void *)&$1, $input)) return $null;
|
||||||
}
|
}
|
||||||
%typemap(argout) ARRAYSOFENUMS[ANY]
|
%typemap(argout) ARRAYSOFENUMS[ANY]
|
||||||
%{ SWIG_JavaArrayArgoutInt(jenv, jarr$argnum, (int *)$1, $input); %}
|
%{ SWIG_JavaArrayArgoutInt(jenv, jarr$argnum, (int *)$1, $input); %}
|
||||||
|
|
|
||||||
|
|
@ -3658,7 +3658,6 @@ class JAVA : public Language {
|
||||||
Printf(w->code, "if (baseclass == NULL) return;\n");
|
Printf(w->code, "if (baseclass == NULL) return;\n");
|
||||||
Printf(w->code, "baseclass = (jclass) jenv->NewGlobalRef(baseclass);\n");
|
Printf(w->code, "baseclass = (jclass) jenv->NewGlobalRef(baseclass);\n");
|
||||||
Printf(w->code, "}\n");
|
Printf(w->code, "}\n");
|
||||||
Printf(w->code, "bool derived = (jenv->IsSameObject(baseclass, jcls) ? false : true);\n");
|
|
||||||
|
|
||||||
int n_methods = curr_class_dmethod - first_class_dmethod;
|
int n_methods = curr_class_dmethod - first_class_dmethod;
|
||||||
|
|
||||||
|
|
@ -3673,6 +3672,7 @@ class JAVA : public Language {
|
||||||
|
|
||||||
/* Emit the code to look up the class's methods, initialize the override array */
|
/* Emit the code to look up the class's methods, initialize the override array */
|
||||||
|
|
||||||
|
Printf(w->code, "bool derived = (jenv->IsSameObject(baseclass, jcls) ? false : true);\n");
|
||||||
Printf(w->code, "for (int i = 0; i < %d; ++i) {\n", n_methods);
|
Printf(w->code, "for (int i = 0; i < %d; ++i) {\n", n_methods);
|
||||||
Printf(w->code, " if (methods[i].base_methid == NULL) {\n");
|
Printf(w->code, " if (methods[i].base_methid == NULL) {\n");
|
||||||
Printf(w->code, " methods[i].base_methid = jenv->GetMethodID(baseclass, methods[i].mname, methods[i].mdesc);\n");
|
Printf(w->code, " methods[i].base_methid = jenv->GetMethodID(baseclass, methods[i].mname, methods[i].mdesc);\n");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue