From d0dfac71ba057600daaceb4def6edde662293e4e Mon Sep 17 00:00:00 2001 From: arkpar Date: Mon, 16 Mar 2015 22:31:31 +0100 Subject: [PATCH] supported building with clang and GNU gold linker on linux --- cmake/EthCompilerSettings.cmake | 15 +++++++++++++++ libdevcore/Common.h | 2 +- test/SolidityEndToEndTest.cpp | 2 +- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/cmake/EthCompilerSettings.cmake b/cmake/EthCompilerSettings.cmake index 6f2d1ad6c..a0d5a50c1 100755 --- a/cmake/EthCompilerSettings.cmake +++ b/cmake/EthCompilerSettings.cmake @@ -25,6 +25,10 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -DETH_DEBUG") set(ETH_SHARED 1) + if ("${CMAKE_SYSTEM_NAME}" MATCHES "Linux") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libstdc++ -fcolor-diagnostics -Qunused-arguments -DBOOST_ASIO_HAS_CLANG_LIBCXX") + endif() + elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") # enable parallel compilation @@ -47,3 +51,14 @@ else () message(WARNING "Your compiler is not tested, if you run into any issues, we'd welcome any patches.") endif () +if (("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")) + option(USE_LD_GOLD "Use GNU gold linker" ON) + if (USE_LD_GOLD) + execute_process(COMMAND ${CMAKE_C_COMPILER} -fuse-ld=gold -Wl,--version ERROR_QUIET OUTPUT_VARIABLE LD_VERSION) + if ("${LD_VERSION}" MATCHES "GNU gold") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fuse-ld=gold") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fuse-ld=gold") + endif () + endif () +endif () + diff --git a/libdevcore/Common.h b/libdevcore/Common.h index 90b51627e..bf9699b2f 100644 --- a/libdevcore/Common.h +++ b/libdevcore/Common.h @@ -87,7 +87,7 @@ using strings = std::vector; // Fixed-length string types. using string32 = std::array; -static const string32 ZeroString32 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +static const string32 ZeroString32 = {{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }}; // Null/Invalid values for convenience. static const u256 Invalid256 = ~(u256)0; diff --git a/test/SolidityEndToEndTest.cpp b/test/SolidityEndToEndTest.cpp index 8ccf9b3fe..cfb8fc668 100644 --- a/test/SolidityEndToEndTest.cpp +++ b/test/SolidityEndToEndTest.cpp @@ -421,7 +421,7 @@ BOOST_AUTO_TEST_CASE(short_circuiting) auto short_circuiting_cpp = [](u256 n) -> u256 { - n == 0 || (n = 8) > 0; + (void)(n == 0 || (n = 8) > 0); return n; };