How do I found out which .i rule/pattern generates a specific (illegal) C++ code fragment?
Kustaa Nyholm <[email protected]>
| Newsgroups | gmane.comp.programming.swig |
|---|---|
| Message-ID | <[email protected]> |
I've abandoned my effort to use .i files for OCC (OpenCascade) from the occpython project because
it looks like there is a lot of Python specific stuff in there that would have to be recreated for Java
and I don't have the appetite for that.
Instead I went back to occjava which I successfully compiled some years ago.
Now some bit rot has set in and when I try to compile it I get:
[ 50%] Building CXX object CMakeFiles/OccJava.dir/src-java/org/jcae/opencascade/jni/OccJavaJAVA_wrap.cxx.o
/Users/nyholku/jcae/occjava/src-java/org/jcae/opencascade/jni/OccJavaJAVA_wrap.cxx:5123:29: error: taking the address of a temporary object of type 'TopoDS_Shape' [-Waddress-of-temporary]
result = (TopoDS_Shape *) &((BRepBuilderAPI_ModifyShape const *)arg1)->ModifiedShape((TopoDS_Shape const &)*arg2);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make[2]: *** [CMakeFiles/OccJava.dir/src-java/org/jcae/opencascade/jni/OccJavaJAVA_wrap.cxx.o] Error 1
As far as I have been able to find out above actually is illegal (at least today) even though it used to compile a few years back with clang.
The actual SWIG generated code is:
SWIGEXPORT jlong JNICALL Java_org_jcae_opencascade_jni_OccJavaJNI_BRepBuilderAPI_1ModifyShape_1modifiedShape(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) {
jlong jresult = 0 ;
BRepBuilderAPI_ModifyShape *arg1 = (BRepBuilderAPI_ModifyShape *) 0 ;
TopoDS_Shape *arg2 = 0 ;
TopoDS_Shape *result = 0 ;
(void)jenv;
(void)jcls;
(void)jarg1_;
(void)jarg2_;
arg1 = *(BRepBuilderAPI_ModifyShape **)&jarg1;
arg2 = *(TopoDS_Shape **)&jarg2;
if (!arg2) {
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "TopoDS_Shape const & reference is null");
return 0;
}
result = (TopoDS_Shape *) &((BRepBuilderAPI_ModifyShape const *)arg1)->ModifiedShape((TopoDS_Shape const &)*arg2);
{
if(result->IsNull())
If I hand edit this to:
TopoDS_Shape result;
...
result = BRepBuilderAPI_ModifyShape const *)arg1)->ModifiedShape((TopoDS_Shape const &)*arg2); {
{
if(result.IsNull())
The code compiles and seems to work (not sure if above piece of code get executed though).
Now, my question is how do I found out which .i rule/pattern generates above illegal C++ code fragment?
wbr Kusti