On 24.04.2015 08:43, Alexander Thomas wrote: > Compiling 1.9.0-rc1 JavaHL in RHEL3 32bit with GCC version 3.2.3-53 > and libstdc++ version 5.0.3 fails with multiple compilation error in > javahl/native/EditorProxy.cpp. In addition to line number 213, line > 360 also fails with same error. > > However I was able to successfully compile against GCC 4.2.0 with > libstdc++ 6.0.9. > > Is this something we can fix for RHEL3 ? > > [[[ > subversion/bindings/javahl/native/EditorProxy.cpp: In static member > function > `static svn_error_t* EditorProxy::cb_add_file(void*, const char*, > const > svn_checksum_t*, svn_stream_t*, apr_hash_t*, long int, apr_pool_t*)': > subversion/bindings/javahl/native/EditorProxy.cpp:213: `Env' specified as > declarator-id > subversion/bindings/javahl/native/EditorProxy.cpp:213: multiple > declarations ` > int' and `Java::RuntimeException' > subversion/bindings/javahl/native/EditorProxy.cpp:213: `int > Java::Env()' should > have been declared inside `Java' > subversion/bindings/javahl/native/EditorProxy.cpp:213: syntax error > before `.' > token > subversion/bindings/javahl/native/EditorProxy.cpp:213: `Env' specified as > declarator-id > subversion/bindings/javahl/native/EditorProxy.cpp:213: multiple > declarations ` > int' and `Java::RuntimeException' > subversion/bindings/javahl/native/EditorProxy.cpp:213: `int > Java::Env()' should > have been declared inside `Java' > subversion/bindings/javahl/native/EditorProxy.cpp:213: syntax error > before `.' > token > ]]]
It appears that this (very old) version of GCC does not implement C++ name lookup and/or temporary object binding correctly. The declaration of Java::Env in this case is equivalent to: namespace Java { class Env {}; } but the compiler doesn't recognize 'Java::Env()' as constructing a temporary object. We could fix this particular instance by declaring a named variable in the scope of the conditional statement, like this: if (contents != NULL) { Java::Env env; SVN_JAVAHL_CATCH(Java::Env(), ...); } but there are likely to be more cases where compilation with GCC 3.2 will fail for this or other reasons. Frankly, I'm not sure it's a good idea to try to dumb down the code for a compiler that does not implement C++98 correctly. Can you try compiling with the following patch, please, and report the results? -- Brane Index: subversion/bindings/javahl/native/EditorProxy.cpp =================================================================== --- subversion/bindings/javahl/native/EditorProxy.cpp (revision 1675261) +++ subversion/bindings/javahl/native/EditorProxy.cpp (working copy) @@ -209,8 +209,11 @@ SVN_JNI_CATCH(,SVN_ERR_RA_SVN_EDIT_ABORTED); if (contents != NULL) - SVN_JAVAHL_CATCH(Java::Env(), SVN_ERR_RA_SVN_EDIT_ABORTED, - jcontents = wrap_input_stream(contents)); + { + Java::Env env; + SVN_JAVAHL_CATCH(env, SVN_ERR_RA_SVN_EDIT_ABORTED, + jcontents = wrap_input_stream(contents)); + } SVN_JNI_CATCH( JNIUtil::getEnv()->CallVoidMethod(ep->m_jeditor, mid, @@ -356,8 +359,11 @@ SVN_JNI_CATCH(,SVN_ERR_RA_SVN_EDIT_ABORTED); if (contents != NULL) - SVN_JAVAHL_CATCH(Java::Env(), SVN_ERR_RA_SVN_EDIT_ABORTED, - jcontents = wrap_input_stream(contents)); + { + Java::Env env; + SVN_JAVAHL_CATCH(env, SVN_ERR_RA_SVN_EDIT_ABORTED, + jcontents = wrap_input_stream(contents)); + } SVN_JNI_CATCH( JNIUtil::getEnv()->CallVoidMethod(ep->m_jeditor, mid,