This is an automated email from the ASF dual-hosted git repository. jbarrett pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode-native.git
The following commit(s) were added to refs/heads/develop by this push: new 407f3a6 GEODE-5031: Solaris compiler warnings as error (#267) 407f3a6 is described below commit 407f3a66124e03b7b7f3c742de1f44ad7604e8a9 Author: Jacob Barrett <jbarr...@pivotal.io> AuthorDate: Sat Apr 7 09:19:04 2018 -0700 GEODE-5031: Solaris compiler warnings as error (#267) --- CMakeLists.txt | 11 +++++++++-- clicache/integration-test2/CMakeLists.txt | 4 +++- clicache/test2/CMakeLists.txt | 4 +++- cppcache/integration-test-2/CMakeLists.txt | 2 ++ cppcache/integration-test-2/ExampleTest.cpp | 2 +- .../integration-test-2/RegionPutGetAllTest.cpp | 4 ++-- cppcache/integration-test-2/framework/Cluster.cpp | 2 ++ cppcache/integration-test-2/framework/Cluster.h | 11 ++++++----- cppcache/integration-test-2/framework/Framework.h | 2 +- cppcache/integration-test-2/framework/Gfsh.h | 11 ++++++++++- .../integration-test-2/framework/GfshExecute.h | 2 ++ cppcache/integration-test/TallyLoader.hpp | 2 +- .../integration-test/ThinClientListenerInit.hpp | 2 +- .../ThinClientLocalCacheLoader.hpp | 2 +- cryptoimpl/CMakeLists.txt | 2 +- cryptoimpl/SSLImpl.hpp | 7 +++++++ templates/security/PkcsAuthInit.cpp | 4 ++++ templates/security/PkcsAuthInit.hpp | 13 ++++++++----- tests/cpp/security/PkcsAuthInit.hpp | 22 ++++++++++++---------- tests/cpp/testobject/InvalidPdxUsage.cpp | 8 ++++---- tests/cpp/testobject/PdxType.cpp | 8 ++++---- tests/cpp/testobject/PdxVersioned1.cpp | 8 ++++---- tests/cpp/testobject/PdxVersioned2.cpp | 8 ++++---- 23 files changed, 92 insertions(+), 49 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3bee799..a9783df 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -163,7 +163,7 @@ add_library(c++11 INTERFACE) # Interface for warning flags add_library(_WarningsAsError INTERFACE) -if(CMAKE_CXX_COMPILER_ID STREQUAL "SunPro") +if(CMAKE_CXX_COMPILER_ID MATCHES "SunPro") # Force linker to error on undefined symbols in shared libraries set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -z defs") if (PRODUCT_SYSTEM_NAME STREQUAL "solaris-sparc") @@ -176,6 +176,10 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "SunPro") #TODO look into CMAKE_CXX_STANDARD_LIBRARIES target_link_libraries(c++11 INTERFACE -std=c++11 stdc++ gcc_s CrunG3 m c) + target_compile_options(_WarningsAsError INTERFACE + -errtags + -errwarn=%all + ) elseif (CMAKE_CXX_COMPILER_ID MATCHES "GNU") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,defs") target_compile_options(_WarningsAsError INTERFACE @@ -196,6 +200,7 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") -Wno-unknown-pragmas #TODO fix -Wno-unused-variable #TODO fix -Wno-unused-function #TODO fix + -Wno-used-but-marked-unused #TODO fix -Wpedantic -Weverything -Wno-non-virtual-dtor #TODO fix @@ -240,7 +245,9 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") /EHa) target_compile_options(_WarningsAsError INTERFACE - /WX) + /WX + /wd4068 # TODO fix + ) # TODO error on warnings set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4996") diff --git a/clicache/integration-test2/CMakeLists.txt b/clicache/integration-test2/CMakeLists.txt index 6716dd0..1244f13 100644 --- a/clicache/integration-test2/CMakeLists.txt +++ b/clicache/integration-test2/CMakeLists.txt @@ -41,11 +41,13 @@ set_source_files_properties(cache.xml xunit.runner.json geode.properties PROPERT ) target_link_libraries(${PROJECT_NAME} - Apache.Geode + PUBLIC + Apache.Geode ) set_target_properties( ${PROJECT_NAME} PROPERTIES VS_GLOBAL_ROOTNAMESPACE ${PROJECT_NAME} + VS_GLOBAL_TreatWarningsAsErrors True VS_GLOBAL_TestProjectType UnitTest VS_GLOBAL_PROJECT_TYPES "{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" VS_DOTNET_TARGET_FRAMEWORK_VERSION "v4.5.2" diff --git a/clicache/test2/CMakeLists.txt b/clicache/test2/CMakeLists.txt index 715fcd0..8c8ff23 100644 --- a/clicache/test2/CMakeLists.txt +++ b/clicache/test2/CMakeLists.txt @@ -31,11 +31,13 @@ set_source_files_properties(cache.xml xunit.runner.json geode.properties PROPERT ) target_link_libraries(${PROJECT_NAME} - Apache.Geode + PUBLIC + Apache.Geode ) set_target_properties( ${PROJECT_NAME} PROPERTIES VS_GLOBAL_ROOTNAMESPACE ${PROJECT_NAME} + VS_GLOBAL_TreatWarningsAsErrors True VS_GLOBAL_TestProjectType UnitTest VS_GLOBAL_PROJECT_TYPES "{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" VS_DOTNET_TARGET_FRAMEWORK_VERSION "v4.5.2" diff --git a/cppcache/integration-test-2/CMakeLists.txt b/cppcache/integration-test-2/CMakeLists.txt index 17331c2..4be953e 100644 --- a/cppcache/integration-test-2/CMakeLists.txt +++ b/cppcache/integration-test-2/CMakeLists.txt @@ -47,6 +47,8 @@ target_link_libraries(integration-test-2 Boost::boost Boost::system Boost::log + PRIVATE + _WarningsAsError ) if(WIN32) diff --git a/cppcache/integration-test-2/ExampleTest.cpp b/cppcache/integration-test-2/ExampleTest.cpp index 4c25d68..8013fd0 100644 --- a/cppcache/integration-test-2/ExampleTest.cpp +++ b/cppcache/integration-test-2/ExampleTest.cpp @@ -127,4 +127,4 @@ TEST(ExampleTest, DISABLED_putGetAndUpdateWith1Server) { ASSERT_EQ(std::future_status::ready, task2.wait_for(debug_safe(minutes(1)))); } -} // namespace \ No newline at end of file +} // namespace diff --git a/cppcache/integration-test-2/RegionPutGetAllTest.cpp b/cppcache/integration-test-2/RegionPutGetAllTest.cpp index cadd635..a9361f9 100644 --- a/cppcache/integration-test-2/RegionPutGetAllTest.cpp +++ b/cppcache/integration-test-2/RegionPutGetAllTest.cpp @@ -112,7 +112,7 @@ void assert_eq(HashMapOfCacheable &expected, HashMapOfCacheable &actual) { const auto key = CacheableInt32::create(T::index); ASSERT_TRUE( std::dynamic_pointer_cast<typename T::type>(expected[key]) - ->equals(std::dynamic_pointer_cast<typename T::type>(expected[key]))) + ->equals(std::dynamic_pointer_cast<typename T::type>(actual[key]))) << "Expected key " << key->value() << " with value of type " << typeid(typename T::type).name() << " to be equal."; } @@ -140,7 +140,7 @@ std::vector<Key> to_keys(std::unordered_map<Key, Tail...> map) { keys.push_back(entry.first); } return keys; -}; +} template <class Container> void localDestroy(Region ®ion, const Container keys) { diff --git a/cppcache/integration-test-2/framework/Cluster.cpp b/cppcache/integration-test-2/framework/Cluster.cpp index 0771274..9a07846 100644 --- a/cppcache/integration-test-2/framework/Cluster.cpp +++ b/cppcache/integration-test-2/framework/Cluster.cpp @@ -26,6 +26,7 @@ void Locator::start() { .withDir(name_) .withBindAddress(locatorAddress_.address) .withPort(locatorAddress_.port) + .withMaxHeap("256m") .withJmxManagerPort(jmxManagerPort_) .withHttpServicePort(0) .execute(); @@ -50,6 +51,7 @@ void Server::start() { .withDir(name_) .withBindAddress(serverAddress_.address) .withPort(serverAddress_.port) + .withMaxHeap("1g") .withLocators(locators_.front().getAdddress().address + "[" + std::to_string(locators_.front().getAdddress().port) + "]") .execute(); diff --git a/cppcache/integration-test-2/framework/Cluster.h b/cppcache/integration-test-2/framework/Cluster.h index d73899a..794b39e 100644 --- a/cppcache/integration-test-2/framework/Cluster.h +++ b/cppcache/integration-test-2/framework/Cluster.h @@ -55,8 +55,8 @@ class Locator { Locator(Cluster &cluster, std::vector<Locator> &locators, std::string name, uint16_t jmxManagerPort) : cluster_(cluster), - locators_(locators), name_(std::move(name)), + locators_(locators), jmxManagerPort_(jmxManagerPort) { auto hostname = "localhost"; auto port = Framework::getAvailablePort(); @@ -79,11 +79,11 @@ class Locator { Locator &operator=(const Locator ©) = delete; Locator(Locator &&move) : cluster_(move.cluster_), + name_(move.name_), locators_(move.locators_), locatorAddress_(move.locatorAddress_), jmxManagerPort_(move.jmxManagerPort_), - started_(move.started_), - name_(move.name_) { + started_(move.started_) { move.started_ = false; }; // Locator &operator=(Locator &&move) = default; @@ -96,14 +96,15 @@ class Locator { private: Cluster &cluster_; + + std::string name_; + std::vector<Locator> &locators_; LocatorAddress locatorAddress_; uint16_t jmxManagerPort_; - std::string name_; - bool started_ = false; }; diff --git a/cppcache/integration-test-2/framework/Framework.h b/cppcache/integration-test-2/framework/Framework.h index 4b9d197..641550a 100644 --- a/cppcache/integration-test-2/framework/Framework.h +++ b/cppcache/integration-test-2/framework/Framework.h @@ -44,6 +44,6 @@ constexpr std::chrono::duration<_Rep, _Period> debug_safe( #else return duration; #endif -}; +} #endif // INTEGRATION_TEST_FRAMEWORK_FRAMEWORK_H diff --git a/cppcache/integration-test-2/framework/Gfsh.h b/cppcache/integration-test-2/framework/Gfsh.h index b56c7e9..a5bec28 100644 --- a/cppcache/integration-test-2/framework/Gfsh.h +++ b/cppcache/integration-test-2/framework/Gfsh.h @@ -23,7 +23,6 @@ #include <string> #include <iostream> -#include <boost/process.hpp> #include <boost/log/trivial.hpp> class Gfsh { @@ -114,6 +113,11 @@ class Gfsh { command_ += " --log-level=" + logLevel; return *this; }; + + Locator &withMaxHeap(const std::string maxHeap) { + command_ += " --max-heap=" + maxHeap; + return *this; + }; }; class Server : public Command<void> { @@ -149,6 +153,11 @@ class Gfsh { command_ += " --log-level=" + logLevel; return *this; }; + + Server &withMaxHeap(const std::string maxHeap) { + command_ += " --max-heap=" + maxHeap; + return *this; + }; }; private: diff --git a/cppcache/integration-test-2/framework/GfshExecute.h b/cppcache/integration-test-2/framework/GfshExecute.h index 014adac..46d2f46 100644 --- a/cppcache/integration-test-2/framework/GfshExecute.h +++ b/cppcache/integration-test-2/framework/GfshExecute.h @@ -25,7 +25,9 @@ #include <algorithm> #include <regex> +#pragma error_messages(off, oklambdaretmulti, wvarhidemem, w_constexprnonlitret, explctspectypename) #include <boost/process.hpp> +#pragma error_messages(on, oklambdaretmulti, wvarhidemem, w_constexprnonlitret, explctspectypename) #include <boost/log/trivial.hpp> #include "Gfsh.h" diff --git a/cppcache/integration-test/TallyLoader.hpp b/cppcache/integration-test/TallyLoader.hpp index 76e55eb..589f749 100644 --- a/cppcache/integration-test/TallyLoader.hpp +++ b/cppcache/integration-test/TallyLoader.hpp @@ -35,7 +35,7 @@ class TallyLoader : virtual public CacheLoader { m_loads(0) {} - virtual ~TallyLoader() {} + virtual ~TallyLoader() = default; std::shared_ptr<Cacheable> load(Region&, const std::shared_ptr<CacheableKey>&, const std::shared_ptr<Serializable>&) { diff --git a/cppcache/integration-test/ThinClientListenerInit.hpp b/cppcache/integration-test/ThinClientListenerInit.hpp index cafa20f..118041f 100644 --- a/cppcache/integration-test/ThinClientListenerInit.hpp +++ b/cppcache/integration-test/ThinClientListenerInit.hpp @@ -52,7 +52,7 @@ class ThinClientTallyLoader : public TallyLoader { public: ThinClientTallyLoader() : TallyLoader() {} - virtual ~ThinClientTallyLoader() {} + virtual ~ThinClientTallyLoader() = default; std::shared_ptr<Cacheable> load( Region& rp, diff --git a/cppcache/integration-test/ThinClientLocalCacheLoader.hpp b/cppcache/integration-test/ThinClientLocalCacheLoader.hpp index a4a7b84..79be570 100644 --- a/cppcache/integration-test/ThinClientLocalCacheLoader.hpp +++ b/cppcache/integration-test/ThinClientLocalCacheLoader.hpp @@ -39,7 +39,7 @@ class ThinClientTallyLoader : public TallyLoader { public: ThinClientTallyLoader() : TallyLoader() {} - virtual ~ThinClientTallyLoader() {} + virtual ~ThinClientTallyLoader() = default; std::shared_ptr<Cacheable> load( Region& rp, diff --git a/cryptoimpl/CMakeLists.txt b/cryptoimpl/CMakeLists.txt index 5b327e5..fc3d820 100644 --- a/cryptoimpl/CMakeLists.txt +++ b/cryptoimpl/CMakeLists.txt @@ -38,7 +38,7 @@ set_target_properties(cryptoImpl PROPERTIES target_link_libraries(cryptoImpl PRIVATE ACE_SSL - _WarningsAsError + _WarningsAsError PUBLIC apache-geode crypto diff --git a/cryptoimpl/SSLImpl.hpp b/cryptoimpl/SSLImpl.hpp index b4180f6..a7dd1fd 100644 --- a/cryptoimpl/SSLImpl.hpp +++ b/cryptoimpl/SSLImpl.hpp @@ -24,6 +24,10 @@ #pragma warning(disable : 4311) #pragma warning(disable : 4302) #pragma pack(push) + + +#pragma error_messages(off, macroredef) + #include <ace/OS.h> #include <ace/INET_Addr.h> #include <ace/SOCK_IO.h> @@ -32,6 +36,9 @@ #include <ace/OS.h> #include <ace/Recursive_Thread_Mutex.h> #include <ace/Time_Value.h> + +#pragma error_messages(on, macroredef) + #pragma pack(pop) #include "cryptoimpl_export.h" diff --git a/templates/security/PkcsAuthInit.cpp b/templates/security/PkcsAuthInit.cpp index 7602210..b739320 100644 --- a/templates/security/PkcsAuthInit.cpp +++ b/templates/security/PkcsAuthInit.cpp @@ -26,6 +26,10 @@ #include "securityimpl_export.h" +#include <geode/Properties.hpp> +#include <geode/CacheableBuiltins.hpp> +#include <geode/ExceptionTypes.hpp> + namespace apache { namespace geode { namespace client { diff --git a/templates/security/PkcsAuthInit.hpp b/templates/security/PkcsAuthInit.hpp index 6e193cc..2fbbe92 100644 --- a/templates/security/PkcsAuthInit.hpp +++ b/templates/security/PkcsAuthInit.hpp @@ -17,15 +17,15 @@ #ifndef __PKCSAUTHINIT__ #define __PKCSAUTHINIT__ -#include "geode/AuthInitialize.hpp" + #include <cstdio> #include <cstdlib> + +#pragma error_messages(off, macroredef) + #include <openssl/pem.h> #include <openssl/err.h> #include <openssl/pkcs12.h> -//#include <unistd.h> -//#include <netinet/in.h> -//#include <fcntl.h> #include <openssl/evp.h> #include <openssl/rsa.h> #include <openssl/evp.h> @@ -33,9 +33,12 @@ #include <openssl/x509.h> #include <openssl/pem.h> #define KSSL_H 1 -//#define OPENSSL_NO_KRB5 1 #include <openssl/ssl.h> +#pragma error_messages(on, macroredef) + +#include <geode/AuthInitialize.hpp> + /** * @file */ diff --git a/tests/cpp/security/PkcsAuthInit.hpp b/tests/cpp/security/PkcsAuthInit.hpp index 5a7307d..b059855 100644 --- a/tests/cpp/security/PkcsAuthInit.hpp +++ b/tests/cpp/security/PkcsAuthInit.hpp @@ -1,8 +1,3 @@ -#pragma once - -#ifndef GEODE_SECURITY_PKCSAUTHINIT_H_ -#define GEODE_SECURITY_PKCSAUTHINIT_H_ - /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -20,15 +15,19 @@ * limitations under the License. */ -#include <geode/AuthInitialize.hpp> +#pragma once + +#ifndef GEODE_SECURITY_PKCSAUTHINIT_H_ +#define GEODE_SECURITY_PKCSAUTHINIT_H_ + #include <cstdio> #include <cstdlib> + +#pragma error_messages(off, macroredef) + #include <openssl/pem.h> #include <openssl/err.h> #include <openssl/pkcs12.h> -//#include <unistd.h> -//#include <netinet/in.h> -//#include <fcntl.h> #include <openssl/evp.h> #include <openssl/rsa.h> #include <openssl/evp.h> @@ -36,9 +35,12 @@ #include <openssl/x509.h> #include <openssl/pem.h> #define KSSL_H 1 -//#define OPENSSL_NO_KRB5 1 #include <openssl/ssl.h> +#pragma error_messages(on, macroredef) + +#include <geode/AuthInitialize.hpp> + /** * @file */ diff --git a/tests/cpp/testobject/InvalidPdxUsage.cpp b/tests/cpp/testobject/InvalidPdxUsage.cpp index 60aef03..0cf465a 100644 --- a/tests/cpp/testobject/InvalidPdxUsage.cpp +++ b/tests/cpp/testobject/InvalidPdxUsage.cpp @@ -76,16 +76,16 @@ void InvalidPdxUsage::toData(PdxWriter& pw) const { LOGINFO(" NILKANTH InvalidPdxUsage::toData() Start exceptionCounter = %d ", toDataexceptionCounter); - int* lengthArr = new int[2]; + int* lengths = new int[2]; - lengthArr[0] = 1; - lengthArr[1] = 2; + lengths[0] = 1; + lengths[1] = 2; // TestCase: writeArrayOfByteArrays with empty field name, // IllegalStateException is expected try { - pw.writeArrayOfByteArrays("", m_byteByteArray, 2, lengthArr); + pw.writeArrayOfByteArrays("", m_byteByteArray, 2, lengths); } catch (IllegalStateException& excpt) { toDataexceptionCounter++; LOGINFO("writeArrayOfByteArrays():: Got expected Exception :: %s ", diff --git a/tests/cpp/testobject/PdxType.cpp b/tests/cpp/testobject/PdxType.cpp index 3e371d7..4ce0ba2 100644 --- a/tests/cpp/testobject/PdxType.cpp +++ b/tests/cpp/testobject/PdxType.cpp @@ -74,11 +74,11 @@ bool PdxTests::PdxType::generic2DCompare(T1** value1, T2** value2, int length, void PdxTests::PdxType::toData(PdxWriter& pw) const { // TODO:delete it later - int* lengthArr = new int[2]; + int* lengths = new int[2]; - lengthArr[0] = 1; - lengthArr[1] = 2; - pw.writeArrayOfByteArrays("m_byteByteArray", m_byteByteArray, 2, lengthArr); + lengths[0] = 1; + lengths[1] = 2; + pw.writeArrayOfByteArrays("m_byteByteArray", m_byteByteArray, 2, lengths); pw.writeChar("m_char", m_char); pw.markIdentityField("m_char"); pw.writeBoolean("m_bool", m_bool); // 1 diff --git a/tests/cpp/testobject/PdxVersioned1.cpp b/tests/cpp/testobject/PdxVersioned1.cpp index a8b72cf..362fc8f 100644 --- a/tests/cpp/testobject/PdxVersioned1.cpp +++ b/tests/cpp/testobject/PdxVersioned1.cpp @@ -237,11 +237,11 @@ void PdxVersioned1::init(const char* key) { void PdxTests::PdxVersioned1::toData(PdxWriter& pw) const { // TODO:delete it later - int* lengthArr = new int[2]; + int* lengths = new int[2]; - lengthArr[0] = 1; - lengthArr[1] = 2; - pw.writeArrayOfByteArrays("m_byteByteArray", m_byteByteArray, 2, lengthArr); + lengths[0] = 1; + lengths[1] = 2; + pw.writeArrayOfByteArrays("m_byteByteArray", m_byteByteArray, 2, lengths); pw.writeChar("m_char", m_char); pw.writeBoolean("m_bool", m_bool); // 1 pw.writeBooleanArray("m_boolArray", m_boolArray); diff --git a/tests/cpp/testobject/PdxVersioned2.cpp b/tests/cpp/testobject/PdxVersioned2.cpp index f7d9b1d..e657ce1 100644 --- a/tests/cpp/testobject/PdxVersioned2.cpp +++ b/tests/cpp/testobject/PdxVersioned2.cpp @@ -265,11 +265,11 @@ void PdxVersioned2::init(const char* key) { void PdxTests::PdxVersioned2::toData(PdxWriter& pw) const { // TODO:delete it later - int* lengthArr = new int[2]; + int* lengths = new int[2]; - lengthArr[0] = 1; - lengthArr[1] = 2; - pw.writeArrayOfByteArrays("m_byteByteArray", m_byteByteArray, 2, lengthArr); + lengths[0] = 1; + lengths[1] = 2; + pw.writeArrayOfByteArrays("m_byteByteArray", m_byteByteArray, 2, lengths); pw.writeChar("m_char", m_char); pw.writeBoolean("m_bool", m_bool); // 1 pw.writeBooleanArray("m_boolArray", m_boolArray); -- To stop receiving notification emails like this one, please contact jbarr...@apache.org.