OntoBREP / occjava

OccJava - A SWIG-generated Java wrapper for OpenCascade
GNU Lesser General Public License v2.1
17 stars 9 forks source link

Compile Error on macOS Sierra #1

Open miho opened 7 years ago

miho commented 7 years ago

Hi,

I'm trying to compile OCCJava on macOS Sierra (Xcode 8). Unfortunately, I'm getting the following error message:

$> make
[ 25%] Building CXX object CMakeFiles/OccJava.dir/src-java/org/jcae/opencascade/jni/OccJavaJAVA_wrap.cxx.o
/Users/username/software/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
make[1]: *** [CMakeFiles/OccJava.dir/all] Error 2
make: *** [all] Error 2

Is this a known issue?

miho commented 7 years ago

Hmm, seems that the generated code works against compiler flags (-Waddress-of-temporary).

Either introduce tmpVar or relax -W... flags

TopoDS_Shape tmpRes = ((BRepBuilderAPI_ModifyShape const *)arg1)->
  ModifiedShape((TopoDS_Shape const &)*arg2);
result = (TopoDS_Shape *) &tmpRes;