IGNITE-4090: CPP: Fixed compilation for GCC 4.4.7. This closes #1165.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/51cef7c7 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/51cef7c7 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/51cef7c7 Branch: refs/heads/master Commit: 51cef7c740828ffcc40f411a66e630421040a2d2 Parents: 1e21d64 Author: Igor Sapego <[email protected]> Authored: Tue Oct 18 11:53:46 2016 +0300 Committer: vozerov-gridgain <[email protected]> Committed: Wed Oct 26 11:08:11 2016 +0300 ---------------------------------------------------------------------- modules/platforms/cpp/common/Makefile.am | 4 +++- .../cpp/common/include/ignite/common/concurrent.h | 5 +++-- .../platforms/cpp/common/include/ignite/ignite_error.h | 4 ++-- modules/platforms/cpp/common/src/ignite_error.cpp | 4 ++-- modules/platforms/cpp/core-test/Makefile.am | 10 ++++++---- modules/platforms/cpp/core-test/src/decimal_test.cpp | 2 +- .../platforms/cpp/core-test/src/interop_memory_test.cpp | 5 +++-- modules/platforms/cpp/jni/src/java.cpp | 2 +- modules/platforms/cpp/odbc-test/Makefile.am | 4 +++- modules/platforms/cpp/odbc-test/src/queries_test.cpp | 4 ++-- modules/platforms/cpp/odbc/src/config/configuration.cpp | 2 +- 11 files changed, 27 insertions(+), 19 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/51cef7c7/modules/platforms/cpp/common/Makefile.am ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/common/Makefile.am b/modules/platforms/cpp/common/Makefile.am index c230384..2d16c2d 100644 --- a/modules/platforms/cpp/common/Makefile.am +++ b/modules/platforms/cpp/common/Makefile.am @@ -26,7 +26,9 @@ SUBDIRS = \ AM_CPPFLAGS = \ -I$(srcdir)/include \ -I$(srcdir)/os/linux/include \ - -DIGNITE_IMPL + -DIGNITE_IMPL \ + -D__STDC_LIMIT_MACROS \ + -D__STDC_CONSTANT_MACROS AM_CXXFLAGS = \ -Wall \ http://git-wip-us.apache.org/repos/asf/ignite/blob/51cef7c7/modules/platforms/cpp/common/include/ignite/common/concurrent.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/common/include/ignite/common/concurrent.h b/modules/platforms/cpp/common/include/ignite/common/concurrent.h index 465e02e..35c2209 100644 --- a/modules/platforms/cpp/common/include/ignite/common/concurrent.h +++ b/modules/platforms/cpp/common/include/ignite/common/concurrent.h @@ -138,7 +138,8 @@ namespace ignite { if (ptr) { - impl = new SharedPointerImpl(ptr, reinterpret_cast<SharedPointerImpl::DeleterType>(&SharedPointerDefaultDeleter<T>)); + void(*deleter)(T*) = (void(*)(T*)) &SharedPointerDefaultDeleter<T>; + impl = new SharedPointerImpl(ptr, reinterpret_cast<SharedPointerImpl::DeleterType>(deleter)); ImplEnableShared(ptr, impl); } else @@ -360,4 +361,4 @@ namespace ignite } } -#endif //_IGNITE_COMMON_CONCURRENT \ No newline at end of file +#endif //_IGNITE_COMMON_CONCURRENT http://git-wip-us.apache.org/repos/asf/ignite/blob/51cef7c7/modules/platforms/cpp/common/include/ignite/ignite_error.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/common/include/ignite/ignite_error.h b/modules/platforms/cpp/common/include/ignite/ignite_error.h index 17a24dc..4c5c06e 100644 --- a/modules/platforms/cpp/common/include/ignite/ignite_error.h +++ b/modules/platforms/cpp/common/include/ignite/ignite_error.h @@ -245,7 +245,7 @@ namespace ignite /** * Destructor. */ - ~IgniteError(); + ~IgniteError() IGNITE_NO_THROW; /** * Get error code. @@ -291,4 +291,4 @@ namespace ignite # pragma warning(pop) #endif //_MSC_VER -#endif //_IGNITE_IGNITE_ERROR \ No newline at end of file +#endif //_IGNITE_IGNITE_ERROR http://git-wip-us.apache.org/repos/asf/ignite/blob/51cef7c7/modules/platforms/cpp/common/src/ignite_error.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/common/src/ignite_error.cpp b/modules/platforms/cpp/common/src/ignite_error.cpp index 8179184..3076d7a 100644 --- a/modules/platforms/cpp/common/src/ignite_error.cpp +++ b/modules/platforms/cpp/common/src/ignite_error.cpp @@ -70,7 +70,7 @@ namespace ignite return *this; } - IgniteError::~IgniteError() + IgniteError::~IgniteError() IGNITE_NO_THROW { ReleaseChars(msg); } @@ -223,4 +223,4 @@ namespace ignite else if (jniCode == IGNITE_JNI_ERR_JVM_ATTACH) *err = IgniteError(IGNITE_ERR_JVM_ATTACH, "Failed to attach to JVM."); } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/ignite/blob/51cef7c7/modules/platforms/cpp/core-test/Makefile.am ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/core-test/Makefile.am b/modules/platforms/cpp/core-test/Makefile.am index 61c4914..42680cd 100644 --- a/modules/platforms/cpp/core-test/Makefile.am +++ b/modules/platforms/cpp/core-test/Makefile.am @@ -33,7 +33,9 @@ AM_CPPFLAGS = \ -I@top_srcdir@/jni/os/linux/include \ -I$(JAVA_HOME)/include \ -I$(JAVA_HOME)/include/linux \ - -DIGNITE_IMPL + -DIGNITE_IMPL \ + -D__STDC_LIMIT_MACROS \ + -D__STDC_CONSTANT_MACROS AM_CXXFLAGS = \ -Wall \ @@ -55,13 +57,13 @@ ignite_tests_SOURCES = \ src/interop_memory_test.cpp \ src/interop_test.cpp \ src/handle_registry_test.cpp \ - src/ignite_error_test.cpp \ + src/ignite_error_test.cpp \ src/binary_test_defs.cpp \ src/binary_reader_writer_raw_test.cpp \ src/binary_reader_writer_test.cpp \ src/binary_session_test.cpp \ - src/decimal_test.cpp \ - src/dynamic_size_array_test.cpp \ + src/decimal_test.cpp \ + src/dynamic_size_array_test.cpp \ src/fixed_size_array_test.cpp \ src/transactions_test.cpp \ src/teamcity_messages.cpp \ http://git-wip-us.apache.org/repos/asf/ignite/blob/51cef7c7/modules/platforms/cpp/core-test/src/decimal_test.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/core-test/src/decimal_test.cpp b/modules/platforms/cpp/core-test/src/decimal_test.cpp index 47fe8fc..9d0bacf 100644 --- a/modules/platforms/cpp/core-test/src/decimal_test.cpp +++ b/modules/platforms/cpp/core-test/src/decimal_test.cpp @@ -1098,4 +1098,4 @@ BOOST_AUTO_TEST_CASE(TestDoubleCast) CheckDoubleCast(-0.000000000000001); } -BOOST_AUTO_TEST_SUITE_END() \ No newline at end of file +BOOST_AUTO_TEST_SUITE_END() http://git-wip-us.apache.org/repos/asf/ignite/blob/51cef7c7/modules/platforms/cpp/core-test/src/interop_memory_test.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/core-test/src/interop_memory_test.cpp b/modules/platforms/cpp/core-test/src/interop_memory_test.cpp index 07e928c..1c782b5 100644 --- a/modules/platforms/cpp/core-test/src/interop_memory_test.cpp +++ b/modules/platforms/cpp/core-test/src/interop_memory_test.cpp @@ -39,7 +39,8 @@ BOOST_AUTO_TEST_CASE(MemoryReallocationTest) SharedPointer<InteropMemory> mem = env.AllocateMemory(); - BOOST_CHECK_EQUAL(mem.Get()->Capacity(), IgniteEnvironment::DEFAULT_ALLOCATION_SIZE); + BOOST_CHECK_EQUAL(mem.Get()->Capacity(), + static_cast<int32_t>(IgniteEnvironment::DEFAULT_ALLOCATION_SIZE)); BOOST_CHECK(mem.Get()->Data() != NULL); @@ -92,4 +93,4 @@ BOOST_AUTO_TEST_CASE(MemoryReallocationTest) memset(mem.Get()->Data(), 0xF0F0F0F0, mem.Get()->Capacity()); } -BOOST_AUTO_TEST_SUITE_END() \ No newline at end of file +BOOST_AUTO_TEST_SUITE_END() http://git-wip-us.apache.org/repos/asf/ignite/blob/51cef7c7/modules/platforms/cpp/jni/src/java.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/jni/src/java.cpp b/modules/platforms/cpp/jni/src/java.cpp index c1efbe2..18cf672 100644 --- a/modules/platforms/cpp/jni/src/java.cpp +++ b/modules/platforms/cpp/jni/src/java.cpp @@ -1881,7 +1881,7 @@ namespace ignite } JNIEXPORT jlong JNICALL JniAffinityFunctionInit(JNIEnv *env, jclass cls, jlong envPtr, jlong memPtr, jobject baseFunc) { - void* baseFuncRef = baseFunc ? env->NewGlobalRef(baseFunc) : nullptr; + void* baseFuncRef = baseFunc ? env->NewGlobalRef(baseFunc) : 0; IGNITE_SAFE_FUNC(env, envPtr, AffinityFunctionInitHandler, affinityFunctionInit, memPtr, baseFuncRef); } http://git-wip-us.apache.org/repos/asf/ignite/blob/51cef7c7/modules/platforms/cpp/odbc-test/Makefile.am ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc-test/Makefile.am b/modules/platforms/cpp/odbc-test/Makefile.am index ccf1192..e10ef7a 100644 --- a/modules/platforms/cpp/odbc-test/Makefile.am +++ b/modules/platforms/cpp/odbc-test/Makefile.am @@ -34,7 +34,9 @@ AM_CPPFLAGS = \ -I@top_srcdir@/core/os/linux/include \ -I$(JAVA_HOME)/include \ -I$(JAVA_HOME)/include/linux \ - -DIGNITE_IMPL + -DIGNITE_IMPL \ + -D__STDC_LIMIT_MACROS \ + -D__STDC_CONSTANT_MACROS AM_CXXFLAGS = \ -Wall \ http://git-wip-us.apache.org/repos/asf/ignite/blob/51cef7c7/modules/platforms/cpp/odbc-test/src/queries_test.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc-test/src/queries_test.cpp b/modules/platforms/cpp/odbc-test/src/queries_test.cpp index 73d57c9..21edf4e 100644 --- a/modules/platforms/cpp/odbc-test/src/queries_test.cpp +++ b/modules/platforms/cpp/odbc-test/src/queries_test.cpp @@ -196,10 +196,10 @@ struct QueriesTestSuiteFixture BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt)); } - SQLCHAR request[] = "SELECT i8Field, i16Field, i32Field, i64Field, strField, " + char request[] = "SELECT i8Field, i16Field, i32Field, i64Field, strField, " "floatField, doubleField, boolField, guidField, dateField, timestampField FROM TestType"; - ret = SQLExecDirect(stmt, request, SQL_NTS); + ret = SQLExecDirect(stmt, reinterpret_cast<SQLCHAR*>(request), SQL_NTS); if (!SQL_SUCCEEDED(ret)) BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt)); http://git-wip-us.apache.org/repos/asf/ignite/blob/51cef7c7/modules/platforms/cpp/odbc/src/config/configuration.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/src/config/configuration.cpp b/modules/platforms/cpp/odbc/src/config/configuration.cpp index c43b115..07f1368 100644 --- a/modules/platforms/cpp/odbc/src/config/configuration.cpp +++ b/modules/platforms/cpp/odbc/src/config/configuration.cpp @@ -265,7 +265,7 @@ namespace ignite utility::IntoLower(key); - if (value.front() == '{' && value.back() == '}') + if (value[0] == '{' && value[value.size() - 1] == '}') value = value.substr(1, value.size() - 2); args[key] = value;
