diff options
author | Benoit Foucher <benoit@zeroc.com> | 2014-10-28 15:02:03 +0100 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2014-10-28 15:02:03 +0100 |
commit | c8bd13216c537a811dc6b770b2d6631ed230ee2c (patch) | |
tree | 74d96ecfff05197bbe8df59335e6f276745e7641 | |
parent | ICE-5792 fixed IceGridGUI install (diff) | |
download | ice-c8bd13216c537a811dc6b770b2d6631ed230ee2c.tar.bz2 ice-c8bd13216c537a811dc6b770b2d6631ed230ee2c.tar.xz ice-c8bd13216c537a811dc6b770b2d6631ed230ee2c.zip |
Fixed ICE-5548: fixed C++11 support to maintain binary compatibility between C++11 and C++03 compiled code
-rw-r--r-- | config/Make.common.rules | 63 | ||||
-rw-r--r-- | cpp/config/Make.rules.Darwin | 27 | ||||
-rw-r--r-- | cpp/config/Make.rules.Linux | 16 | ||||
-rw-r--r-- | cpp/include/Ice/AsyncResult.h | 10 | ||||
-rw-r--r-- | cpp/src/Ice/CommunicatorI.cpp | 7 | ||||
-rw-r--r-- | cpp/src/Ice/CommunicatorI.h | 3 | ||||
-rw-r--r-- | cpp/src/Ice/ConnectionI.cpp | 8 | ||||
-rw-r--r-- | cpp/src/Ice/ConnectionI.h | 3 | ||||
-rw-r--r-- | cpp/src/slice2cpp/Gen.cpp | 12 | ||||
-rw-r--r-- | cs/config/Make.rules.cs | 9 | ||||
-rw-r--r-- | js/config/Make.rules.js | 9 |
11 files changed, 81 insertions, 86 deletions
diff --git a/config/Make.common.rules b/config/Make.common.rules index 579a90d1ff8..02cc58f4d4e 100644 --- a/config/Make.common.rules +++ b/config/Make.common.rules @@ -12,22 +12,22 @@ # ---------------------------------------------------------------------- SHELL = /bin/sh -VERSION_MAJOR = 3 -VERSION_MINOR = 6b -VERSION_PATCH = 51 -VERSION = 3.6b -SHORT_VERSION = 3.6 -SOVERSION = 36b +VERSION_MAJOR = 3 +VERSION_MINOR = 6b +VERSION_PATCH = 51 +VERSION = 3.6b +SHORT_VERSION = 3.6 +SOVERSION = 36b INSTALL = cp -fp -INSTALL_PROGRAM = ${INSTALL} -INSTALL_LIBRARY = ${INSTALL} -INSTALL_DATA = ${INSTALL} +INSTALL_PROGRAM = ${INSTALL} +INSTALL_LIBRARY = ${INSTALL} +INSTALL_DATA = ${INSTALL} OBJEXT = .o UNAME := $(shell uname) -MACHINE_TYPE := $(shell uname -m) +MACHINE_TYPE := $(shell uname -m) # # Ensure ice_language has been set by the file that includes this one. @@ -75,9 +75,11 @@ ifeq ($(UNAME),Linux) endif ifeq ($(CPP11),yes) - cpp11libdirsuffix = /c++11 - cpp11libsuffix = ++11 - cpp11sonamedir = ../ + ifneq ($(UNAME),Darwin) + cpp11libdirsuffix = /c++11 + cpp11libsuffix = ++11 + cpp11sonamedir = ../ + endif endif ifneq ($(findstring MINGW,$(UNAME)),) @@ -263,7 +265,7 @@ ifneq ($(ice_dir), /usr) ifeq ($(ice_cpp_dir), $(ice_dir)/cpp) ice_lib_dir = $(ice_cpp_dir)/lib else - ice_lib_dir = $(ice_cpp_dir)/$(libsubdir) + ice_lib_dir = $(ice_cpp_dir)/$(libsubdir) endif else ice_lib_dir = $(ice_dir)/$(libsubdir) @@ -282,9 +284,9 @@ ifneq ($(ice_dir), /usr) endif ifdef ice_src_dist - ifeq ($(UNAME),Darwin) - export DYLD_LIBRARY_PATH := $(ice_lib_dir):$(DYLD_LIBRARY_PATH) - endif + ifeq ($(UNAME),Darwin) + export DYLD_LIBRARY_PATH := $(ice_lib_dir):$(DYLD_LIBRARY_PATH) + endif endif ifeq ($(UNAME),AIX) @@ -314,29 +316,42 @@ endif # -# Default functions for shared library names +# Default functions for shared library names (we have to defined them here +# for the SLICE2PARSERLIB dependency) # ifeq ($(mklibfilename),) - mklibfilename = $(if $(2),lib$(1)$(cpp11libsuffix).so.$(2),lib$(1)$(cpp11libsuffix).so) + ifeq ($(UNAME),Darwin) + mklibfilename = $(if $(2),lib$(1)$(cpp11libsuffix).$(2).dylib,lib$(1)$(cpp11libsuffix).dylib) + else + mklibfilename = $(if $(2),lib$(1)$(cpp11libsuffix).so.$(2),lib$(1)$(cpp11libsuffix).so) + endif endif ifeq ($(mksoname),) - mksoname = $(if $(2),lib$(1)$(cpp11libsuffix).so.$(2),lib$(1).so) + ifeq ($(UNAME),Darwin) + mksoname = $(if $(2),lib$(1)$(cpp11libsuffix).$(2).dylib,lib$(1).dylib) + else + mksoname = $(if $(2),lib$(1)$(cpp11libsuffix).so.$(2),lib$(1).so) + endif endif ifeq ($(mklibname),) ifeq ($(STATICLIBS),yes) - mklibname = lib$(1)$(cpp11libsuffix).a + mklibname = lib$(1)$(cpp11libsuffix).a else - mklibname = lib$(1).so + ifeq ($(UNAME),Darwin) + mklibname = lib$(1).dylib + else + mklibname = lib$(1).so + endif endif endif ifndef mklibtargets ifeq ($(STATICLIBS),yes) - mklibtargets = $(3) + mklibtargets = $(3) else - mklibtargets = $(1) $(2) $(3) + mklibtargets = $(1) $(2) $(3) endif endif diff --git a/cpp/config/Make.rules.Darwin b/cpp/config/Make.rules.Darwin index f8445705f41..c0205611727 100644 --- a/cpp/config/Make.rules.Darwin +++ b/cpp/config/Make.rules.Darwin @@ -11,7 +11,7 @@ # This file is included by Make.rules when uname is Darwin. # -OSX_TARGET_MIN_SDK_VERSION = 10.9 +OSX_TARGET_MIN_SDK_VERSION = 10.9 CXX = xcrun clang++ @@ -23,20 +23,21 @@ ifeq ($(OPTIMIZE),yes) # By default we build binaries with both architectures when optimization is enabled. # ifeq ($(CXXARCHFLAGS),) - CXXARCHFLAGS := -arch i386 -arch x86_64 + CXXARCHFLAGS := -arch i386 -arch x86_64 endif CXXFLAGS := $(CXXARCHFLAGS) -O2 -DNDEBUG $(CXXFLAGS) else CXXFLAGS := $(CXXARCHFLAGS) -g $(CXXFLAGS) endif -ifeq ($(CPP11), yes) +# +# On OS X, always build with C++11 support enabled unless we +# explicitly set it to no (possibly to test binary compatibility). +# +ifneq ($(CPP11), no) CPPFLAGS += --std=c++11 endif -mklibfilename = $(if $(2),lib$(1)$(cpp11libsuffix).$(2).dylib,lib$(1)$(cpp11libsuffix).dylib) -mksoname = $(if $(2),lib$(1)$(cpp11libsuffix).$(2).dylib,lib$(1).dylib) - # # C++ run-time libraries, necessary for linking some shared libraries. # @@ -55,16 +56,8 @@ ifeq ($(CXX),g++) LDPLATFORMFLAGS += -rdynamic endif -ifeq ($(STATICLIBS),yes) - mklibname = lib$(1).a -else - mklibname = lib$(1).dylib -endif -mklib = libtool -static -o $(1) $(2) - -curdir = $(shell pwd) - -mkshlib = $(CXX) -dynamiclib $(LDFLAGS) -o $(1) -install_name @rpath/$(2) $(3) $(4) +mklib = libtool -static -o $(1) $(2) +mkshlib = $(CXX) -dynamiclib $(LDFLAGS) -o $(1) -install_name @rpath/$(2) $(3) $(4) BASELIBS = -lIceUtil LIBS = -lIce $(BASELIBS) @@ -93,5 +86,3 @@ ifeq ($(MCPP_HOME),) MCPP_HOME = $(THIRDPARTY_HOME) endif endif - - diff --git a/cpp/config/Make.rules.Linux b/cpp/config/Make.rules.Linux index 2701255338a..ccee5486940 100644 --- a/cpp/config/Make.rules.Linux +++ b/cpp/config/Make.rules.Linux @@ -13,11 +13,11 @@ USE_SPARC_ASM = irrelevant MACHINE = $(shell uname -m) -SUSE_i586 = $(shell grep i586 /etc/SuSE-release 2>/dev/null) +SUSE_i586 = $(shell grep i586 /etc/SuSE-release 2>/dev/null) ifneq ($(shell grep 'release 4' /etc/redhat-release 2>/dev/null),) NPTL_LIB = -L/usr/$(libsubdir)/nptl - NPTL_FLAGS = -I/usr/include/nptl + NPTL_FLAGS = -I/usr/include/nptl endif # @@ -40,7 +40,7 @@ ifeq ($(CXX),g++) ifeq ($(CPP11), yes) CPPFLAGS += -std=c++0x endif - + ifeq ($(MACHINE),sparc64) # # We are an ultra, at least, and so have the atomic instructions @@ -100,7 +100,7 @@ ifeq ($(CXX),g++) mklib = ar cr $(1) $(2) - rpathlink = -Wl,-rpath-link,$(1) + rpathlink = -Wl,-rpath-link,$(1) ifneq ($(embedded_runpath_prefix),) LDPLATFORMFLAGS = -Wl,--enable-new-dtags -Wl,-rpath,$(runpath_libdir) @@ -140,7 +140,7 @@ ifeq ($(CXX),icpc) mklib = ar cr $(1) $(2) - rpathlink = -Wl,-rpath-link,$(1) + rpathlink = -Wl,-rpath-link,$(1) endif @@ -150,10 +150,10 @@ ifneq ($(NPTL_LIB),) BASELIBS := $(NPTL_LIB) $(BASELIBS) endif -ICESSL_LIBS = $(OPENSSL_RPATH_LINK) -lIceSSL +ICESSL_LIBS = $(OPENSSL_RPATH_LINK) -lIceSSL LIBS = $(BZIP2_RPATH_LINK) -lIce $(BASELIBS) -ICEUTIL_OS_LIBS = -lrt $(OPENSSL_RPATH_LINK) -lcrypto -ICE_OS_LIBS = -ldl +ICEUTIL_OS_LIBS = -lrt $(OPENSSL_RPATH_LINK) -lcrypto +ICE_OS_LIBS = -ldl PLATFORM_HAS_READLINE = yes diff --git a/cpp/include/Ice/AsyncResult.h b/cpp/include/Ice/AsyncResult.h index c94d4f01a19..2a415b060d1 100644 --- a/cpp/include/Ice/AsyncResult.h +++ b/cpp/include/Ice/AsyncResult.h @@ -312,6 +312,16 @@ public: } }; +#else + +template<class S> class Function +{ +public: + Function() + { + } +}; + #endif } diff --git a/cpp/src/Ice/CommunicatorI.cpp b/cpp/src/Ice/CommunicatorI.cpp index a7c2aee35d2..9a48b60d55b 100644 --- a/cpp/src/Ice/CommunicatorI.cpp +++ b/cpp/src/Ice/CommunicatorI.cpp @@ -221,11 +221,11 @@ Ice::CommunicatorI::begin_flushBatchRequests(const Callback_Communicator_flushBa return __begin_flushBatchRequests(cb, cookie); } -#ifdef ICE_CPP11 AsyncResultPtr Ice::CommunicatorI::begin_flushBatchRequests(const IceInternal::Function<void (const Exception&)>& exception, const IceInternal::Function<void (bool)>& sent) { +#ifdef ICE_CPP11 class Cpp11CB : public IceInternal::Cpp11FnCallbackNC { @@ -256,8 +256,11 @@ Ice::CommunicatorI::begin_flushBatchRequests(const IceInternal::Function<void (c }; return __begin_flushBatchRequests(new Cpp11CB(exception, sent), 0); -} +#else + assert(false); // Ice not built with C++11 support. + return 0; #endif +} namespace { diff --git a/cpp/src/Ice/CommunicatorI.h b/cpp/src/Ice/CommunicatorI.h index 91fdb0ccfc3..58c9da5cd7b 100644 --- a/cpp/src/Ice/CommunicatorI.h +++ b/cpp/src/Ice/CommunicatorI.h @@ -65,11 +65,10 @@ public: virtual AsyncResultPtr begin_flushBatchRequests(const CallbackPtr&, const LocalObjectPtr& = 0); virtual AsyncResultPtr begin_flushBatchRequests(const Callback_Communicator_flushBatchRequestsPtr&, const LocalObjectPtr& = 0); -#ifdef ICE_CPP11 + virtual AsyncResultPtr begin_flushBatchRequests( const IceInternal::Function<void (const Exception&)>&, const IceInternal::Function<void (bool)>& = IceInternal::Function<void (bool)>()); -#endif virtual void end_flushBatchRequests(const AsyncResultPtr&); diff --git a/cpp/src/Ice/ConnectionI.cpp b/cpp/src/Ice/ConnectionI.cpp index eb2a03cfc34..8da88c6842e 100644 --- a/cpp/src/Ice/ConnectionI.cpp +++ b/cpp/src/Ice/ConnectionI.cpp @@ -993,12 +993,11 @@ Ice::ConnectionI::begin_flushBatchRequests(const Callback_Connection_flushBatchR return __begin_flushBatchRequests(cb, cookie); } -#ifdef ICE_CPP11 AsyncResultPtr Ice::ConnectionI::begin_flushBatchRequests(const IceInternal::Function<void (const Exception&)>& exception, const IceInternal::Function<void (bool)>& sent) { - +#ifdef ICE_CPP11 class Cpp11CB : public IceInternal::Cpp11FnCallbackNC { public: @@ -1028,8 +1027,11 @@ Ice::ConnectionI::begin_flushBatchRequests(const IceInternal::Function<void (con }; return __begin_flushBatchRequests(new Cpp11CB(exception, sent), 0); +#else + assert(false); // Ice not built with C++11 support. + return 0; +#endif } -#endif AsyncResultPtr Ice::ConnectionI::__begin_flushBatchRequests(const CallbackBasePtr& cb, const LocalObjectPtr& cookie) diff --git a/cpp/src/Ice/ConnectionI.h b/cpp/src/Ice/ConnectionI.h index 6ed4618eed7..0542741e49b 100644 --- a/cpp/src/Ice/ConnectionI.h +++ b/cpp/src/Ice/ConnectionI.h @@ -171,11 +171,10 @@ public: virtual AsyncResultPtr begin_flushBatchRequests(const CallbackPtr&, const LocalObjectPtr& = 0); virtual AsyncResultPtr begin_flushBatchRequests(const Callback_Connection_flushBatchRequestsPtr&, const LocalObjectPtr& = 0); -#ifdef ICE_CPP11 + virtual AsyncResultPtr begin_flushBatchRequests( const ::IceInternal::Function<void (const ::Ice::Exception&)>&, const ::IceInternal::Function<void (bool)>& = ::IceInternal::Function<void (bool)>()); -#endif virtual void end_flushBatchRequests(const AsyncResultPtr&); diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index 57f3337c06f..7b195708399 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -3664,17 +3664,11 @@ Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p) } } - H.zeroIndent(); - H << nl << "#ifdef ICE_CPP11"; - H.restoreIndent(); - + H << nl << "// Only supported with C++ 11 support enabled"; H << nl << "virtual ::Ice::AsyncResultPtr begin_" << name << spar << paramsDeclAMI << "const ::IceInternal::Function<void (const ::Ice::Exception&)>& exception" - << "const ::IceInternal::Function<void (bool)>& sent = ::IceInternal::Function<void (bool)>()" << epar << " = 0;"; - - H.zeroIndent(); - H << nl << "#endif"; - H.restoreIndent(); + << "const ::IceInternal::Function<void (bool)>& sent = ::IceInternal::Function<void (bool)>()" + << epar << " = 0;"; H << sp << nl << "virtual ::Ice::AsyncResultPtr begin_" << name << spar << paramsDeclAMI << epar << " = 0;"; diff --git a/cs/config/Make.rules.cs b/cs/config/Make.rules.cs index 19d2e1ddeb8..fe91d56d777 100644 --- a/cs/config/Make.rules.cs +++ b/cs/config/Make.rules.cs @@ -69,15 +69,6 @@ else include $(top_srcdir)/../config/Make.common.rules endif -# -# Platform specific definitions (necessary for SLICEPARSERLIB) -# -ifeq ($(shell test -f $(top_srcdir)/config/Make.rules.$(UNAME) && echo 0),0) - include $(top_srcdir)/config/Make.rules.$(UNAME) -else - include $(top_srcdir)/../cpp/config/Make.rules.$(UNAME) -endif - DSEP = / bindir = $(top_srcdir)/bin diff --git a/js/config/Make.rules.js b/js/config/Make.rules.js index db976e00b6a..8090e095004 100644 --- a/js/config/Make.rules.js +++ b/js/config/Make.rules.js @@ -91,15 +91,6 @@ else endif endif -# -# Platform specific definitions (necessary for SLICEPARSERLIB) -# -ifeq ($(shell test -f $(top_srcdir)/config/Make.rules.$(UNAME) && echo 0),0) - include $(top_srcdir)/config/Make.rules.$(UNAME) -else - include $(top_srcdir)/../cpp/config/Make.rules.$(UNAME) -endif - ifdef ice_src_dist ifeq ($(ice_cpp_dir), $(ice_dir)/cpp) SLICE2JS = $(ice_cpp_dir)/bin/slice2js |