Remove void * cast which was suppressing gcc's strict aliasing warning display. Note g++ 4.0 still does not display the warning even though with -O2 the resulting code fails due to aliasing optimisations.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@8948 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
7a0351adc2
commit
a969ab73dd
3 changed files with 26 additions and 26 deletions
|
|
@ -262,7 +262,7 @@ JAVA_ARRAYS_TYPEMAPS(double, double, jdouble, Double, "[D") /* double[ANY] *
|
|||
return $null;
|
||||
}
|
||||
for (i=0; i<sz; i++) {
|
||||
$1[i] = **($&1_ltype)(void *)&jarr[i];
|
||||
$1[i] = **($&1_ltype)&jarr[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -292,7 +292,7 @@ JAVA_ARRAYS_TYPEMAPS(double, double, jdouble, Double, "[D") /* double[ANY] *
|
|||
return $null;
|
||||
}
|
||||
for (i=0; i<sz; i++) {
|
||||
$1[i] = **($&1_ltype)(void *)&jarr[i];
|
||||
$1[i] = **($&1_ltype)&jarr[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -301,7 +301,7 @@ JAVA_ARRAYS_TYPEMAPS(double, double, jdouble, Double, "[D") /* double[ANY] *
|
|||
int i;
|
||||
for (i=0; i<sz$argnum; i++) {
|
||||
jarr$argnum[i] = 0;
|
||||
*($&1_ltype)(void *)&jarr$argnum[i] = &$1[i];
|
||||
*($&1_ltype)&jarr$argnum[i] = &$1[i];
|
||||
}
|
||||
JCALL3(ReleaseLongArrayElements, jenv, $input, jarr$argnum, 0);
|
||||
}
|
||||
|
|
@ -320,7 +320,7 @@ JAVA_ARRAYS_TYPEMAPS(double, double, jdouble, Double, "[D") /* double[ANY] *
|
|||
}
|
||||
for (i=0; i<$1_dim0; i++) {
|
||||
arr[i] = 0;
|
||||
*($&1_ltype)(void *)&arr[i] = &$1[i];
|
||||
*($&1_ltype)&arr[i] = &$1[i];
|
||||
}
|
||||
JCALL3(ReleaseLongArrayElements, jenv, $result, arr, 0);
|
||||
}
|
||||
|
|
@ -366,13 +366,13 @@ JAVA_ARRAYS_TYPEMAPS(double, double, jdouble, Double, "[D") /* double[ANY] *
|
|||
}
|
||||
|
||||
%typemap(in) ARRAYSOFENUMS[] (jint *jarr)
|
||||
%{ if (!SWIG_JavaArrayInInt(jenv, &jarr, (int **)(void *)&$1, $input)) return $null; %}
|
||||
%{ if (!SWIG_JavaArrayInInt(jenv, &jarr, (int **)&$1, $input)) return $null; %}
|
||||
%typemap(in) ARRAYSOFENUMS[ANY] (jint *jarr) {
|
||||
if ($input && JCALL1(GetArrayLength, jenv, $input) != $1_size) {
|
||||
SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, "incorrect array size");
|
||||
return $null;
|
||||
}
|
||||
if (!SWIG_JavaArrayInInt(jenv, &jarr, (int **)(void *)&$1, $input)) return $null;
|
||||
if (!SWIG_JavaArrayInInt(jenv, &jarr, (int **)&$1, $input)) return $null;
|
||||
}
|
||||
%typemap(argout) ARRAYSOFENUMS[ANY]
|
||||
%{ SWIG_JavaArrayArgoutInt(jenv, jarr$argnum, (int *)$1, $input); %}
|
||||
|
|
|
|||
|
|
@ -548,7 +548,7 @@
|
|||
|
||||
/* Default handling. Object passed by value. Convert to a pointer */
|
||||
%typemap(in) SWIGTYPE ($&1_type argp)
|
||||
%{ argp = *($&1_ltype*)(void *)&$input;
|
||||
%{ argp = *($&1_ltype*)&$input;
|
||||
if (!argp) {
|
||||
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null $1_type");
|
||||
return $null;
|
||||
|
|
@ -560,51 +560,51 @@
|
|||
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Unexpected null return for type $1_type");
|
||||
return $null;
|
||||
}
|
||||
$1 = *($&1_ltype)(void *)&$input; %}
|
||||
$1 = *($&1_ltype)&$input; %}
|
||||
|
||||
%typemap(out) SWIGTYPE
|
||||
#ifdef __cplusplus
|
||||
%{ *($&1_ltype*)(void *)&$result = new $1_ltype(($1_ltype &)$1); %}
|
||||
%{ *($&1_ltype*)&$result = new $1_ltype(($1_ltype &)$1); %}
|
||||
#else
|
||||
{
|
||||
$&1_ltype $1ptr = ($&1_ltype) malloc(sizeof($1_ltype));
|
||||
memmove($1ptr, &$1, sizeof($1_type));
|
||||
*($&1_ltype*)(void *)&$result = $1ptr;
|
||||
*($&1_ltype*)&$result = $1ptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
%typemap(directorin,descriptor="L$packagepath/$&javaclassname;") SWIGTYPE
|
||||
%{ $input = 0;
|
||||
*(($&1_ltype*)(void *)&$input) = &$1; %}
|
||||
*(($&1_ltype*)&$input) = &$1; %}
|
||||
%typemap(javadirectorin) SWIGTYPE "new $&javaclassname($jniinput, false)"
|
||||
%typemap(javadirectorout) SWIGTYPE "$&javaclassname.getCPtr($javacall)"
|
||||
|
||||
/* Generic pointers and references */
|
||||
%typemap(in) SWIGTYPE *, SWIGTYPE (CLASS::*) %{ $1 = *($&1_ltype)(void *)&$input; %}
|
||||
%typemap(in) SWIGTYPE & %{ $1 = *($&1_ltype)(void *)&$input;
|
||||
%typemap(in) SWIGTYPE *, SWIGTYPE (CLASS::*) %{ $1 = *($&1_ltype)&$input; %}
|
||||
%typemap(in) SWIGTYPE & %{ $1 = *($&1_ltype)&$input;
|
||||
if(!$1) {
|
||||
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "$1_type reference is null");
|
||||
return $null;
|
||||
} %}
|
||||
%typemap(out) SWIGTYPE *, SWIGTYPE (CLASS::*)
|
||||
%{ *($&1_ltype)(void *)&$result = $1; %}
|
||||
%{ *($&1_ltype)&$result = $1; %}
|
||||
%typemap(out) SWIGTYPE &
|
||||
%{ *($&1_ltype)(void *)&$result = $1; %}
|
||||
%{ *($&1_ltype)&$result = $1; %}
|
||||
|
||||
%typemap(directorout) SWIGTYPE *, SWIGTYPE (CLASS::*)
|
||||
%{ $1 = *($&1_ltype)(void *)&$input; %}
|
||||
%{ $1 = *($&1_ltype)&$input; %}
|
||||
%typemap(directorin,descriptor="L$packagepath/$javaclassname;") SWIGTYPE *, SWIGTYPE (CLASS::*)
|
||||
%{ *(($&1_ltype)(void *)&$input) = ($1_ltype) $1; %}
|
||||
%{ *(($&1_ltype)&$input) = ($1_ltype) $1; %}
|
||||
|
||||
%typemap(directorin,descriptor="L$packagepath/$javaclassname;") SWIGTYPE &
|
||||
%{ *($&1_ltype)(void *)&$input = ($1_ltype) &$1; %}
|
||||
%{ *($&1_ltype)&$input = ($1_ltype) &$1; %}
|
||||
|
||||
%typemap(javadirectorin) SWIGTYPE *, SWIGTYPE (CLASS::*), SWIGTYPE &, const SWIGTYPE & "new $javaclassname($jniinput, false)"
|
||||
%typemap(javadirectorout) SWIGTYPE *, SWIGTYPE (CLASS::*), SWIGTYPE &, const SWIGTYPE & "$javaclassname.getCPtr($javacall)"
|
||||
|
||||
/* Default array handling */
|
||||
%typemap(in) SWIGTYPE [] %{ $1 = *($&1_ltype)(void *)&$input; %}
|
||||
%typemap(out) SWIGTYPE [] %{ *($&1_ltype)(void *)&$result = $1; %}
|
||||
%typemap(in) SWIGTYPE [] %{ $1 = *($&1_ltype)&$input; %}
|
||||
%typemap(out) SWIGTYPE [] %{ *($&1_ltype)&$result = $1; %}
|
||||
%typemap(freearg) SWIGTYPE [ANY], SWIGTYPE [] ""
|
||||
|
||||
/* char arrays - treat as String */
|
||||
|
|
@ -1014,10 +1014,10 @@
|
|||
return (cPtr == 0) ? null : new $*javaclassname(cPtr, $owner);
|
||||
}
|
||||
%typemap(in) SWIGTYPE *& ($*1_ltype temp = 0)
|
||||
%{ temp = *($1_ltype)(void *)&$input;
|
||||
%{ temp = *($1_ltype)&$input;
|
||||
$1 = &temp; %}
|
||||
%typemap(out) SWIGTYPE *&
|
||||
%{ *($1_ltype)(void *)&$result = *$1; %}
|
||||
%{ *($1_ltype)&$result = *$1; %}
|
||||
|
||||
/* Array reference typemaps */
|
||||
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
|
||||
|
|
|
|||
|
|
@ -1675,7 +1675,7 @@ class JAVA : public Language {
|
|||
" jlong baseptr = 0;\n"
|
||||
" (void)jenv;\n"
|
||||
" (void)jcls;\n"
|
||||
" *($cbaseclass **)(void *)&baseptr = *($cclass **)(void *)&jarg1;\n"
|
||||
" *($cbaseclass **)&baseptr = *($cclass **)&jarg1;\n"
|
||||
" return baseptr;\n"
|
||||
"}\n",
|
||||
"\n",
|
||||
|
|
@ -1779,7 +1779,7 @@ class JAVA : public Language {
|
|||
jnipackage, jni_imclass_name, jni_class_name);
|
||||
Printf(dcast_wrap->code, " Swig::Director *director = (Swig::Director *) 0;\n");
|
||||
Printf(dcast_wrap->code, " jobject jresult = (jobject) 0;\n");
|
||||
Printf(dcast_wrap->code, " %s *obj = *((%s **)(void *)&jCPtrBase);\n", norm_name, norm_name);
|
||||
Printf(dcast_wrap->code, " %s *obj = *((%s **)&jCPtrBase);\n", norm_name, norm_name);
|
||||
Printf(dcast_wrap->code, " if (obj) director = dynamic_cast<Swig::Director *>(obj);\n");
|
||||
Printf(dcast_wrap->code, " if (director) jresult = director->swig_get_self(jenv);\n");
|
||||
Printf(dcast_wrap->code, " return jresult;\n");
|
||||
|
|
@ -2818,7 +2818,7 @@ class JAVA : public Language {
|
|||
"JNIEXPORT void JNICALL Java_%s%s_%s(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jswig_mem_own, "
|
||||
"jboolean jweak_global) {\n",
|
||||
jnipackage, jni_imclass_name, swig_director_connect_jni);
|
||||
Printf(code_wrap->code, " %s *obj = *((%s **)(void *)&objarg);\n", norm_name, norm_name);
|
||||
Printf(code_wrap->code, " %s *obj = *((%s **)&objarg);\n", norm_name, norm_name);
|
||||
Printf(code_wrap->code, " (void)jcls;\n");
|
||||
Printf(code_wrap->code, " SwigDirector_%s *director = dynamic_cast<SwigDirector_%s *>(obj);\n",
|
||||
sym_name, sym_name);
|
||||
|
|
@ -2845,7 +2845,7 @@ class JAVA : public Language {
|
|||
Printf(code_wrap->def,
|
||||
"JNIEXPORT void JNICALL Java_%s%s_%s(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jtake_or_release) {\n",
|
||||
jnipackage, jni_imclass_name, changeown_jnimethod_name);
|
||||
Printf(code_wrap->code, " %s *obj = *((%s **)(void *)&objarg);\n", norm_name, norm_name);
|
||||
Printf(code_wrap->code, " %s *obj = *((%s **)&objarg);\n", norm_name, norm_name);
|
||||
Printf(code_wrap->code, " SwigDirector_%s *director = dynamic_cast<SwigDirector_%s *>(obj);\n",
|
||||
sym_name, sym_name);
|
||||
Printf(code_wrap->code, " (void)jcls;\n");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue