diff --git a/CMakeLists.txt b/CMakeLists.txt index def3695cb8c..c1136ace531 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,13 +49,18 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.0) message(FATAL_ERROR "GCC version must be at least 6.0!") endif() -elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + if ("${CMAKE_GENERATOR}" STREQUAL "Ninja") + add_compile_options(-fdiagnostics-color=always) + endif() +elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang") if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.0) message(FATAL_ERROR "Clang version must be at least 4.0!") endif() + if ("${CMAKE_GENERATOR}" STREQUAL "Ninja") + add_compile_options(-fcolor-diagnostics) + endif() endif() - set(CMAKE_EXPORT_COMPILE_COMMANDS "ON") set(BUILD_DOXYGEN FALSE CACHE BOOL "Build doxygen documentation on every make") set(BUILD_MONGO_DB_PLUGIN FALSE CACHE BOOL "Build mongo database plugin") diff --git a/CMakeModules/EosioTester.cmake.in b/CMakeModules/EosioTester.cmake.in index f47743fe5cb..741ee5f0e84 100644 --- a/CMakeModules/EosioTester.cmake.in +++ b/CMakeModules/EosioTester.cmake.in @@ -8,6 +8,15 @@ set(EOSIO_VERSION "@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@") enable_testing() +if (UNIX) + if (APPLE) + if (LLVM_DIR STREQUAL "" OR NOT LLVM_DIR) + set(LLVM_DIR "/usr/local/opt/llvm@4/lib/cmake/llvm") + endif() + endif() +endif() + + find_package( Gperftools QUIET ) if( GPERFTOOLS_FOUND ) message( STATUS "Found gperftools; compiling tests with TCMalloc") diff --git a/CMakeModules/EosioTesterBuild.cmake.in b/CMakeModules/EosioTesterBuild.cmake.in index 5618fe0d149..04ac7da6fe5 100644 --- a/CMakeModules/EosioTesterBuild.cmake.in +++ b/CMakeModules/EosioTesterBuild.cmake.in @@ -8,6 +8,15 @@ set(EOSIO_VERSION "@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@") enable_testing() +if (UNIX) + if (APPLE) + if (LLVM_DIR STREQUAL "" OR NOT LLVM_DIR) + set(LLVM_DIR "/usr/local/opt/llvm@4/lib/cmake/llvm") + endif() + endif() +endif() + + find_package( Gperftools QUIET ) if( GPERFTOOLS_FOUND ) message( STATUS "Found gperftools; compiling tests with TCMalloc") diff --git a/plugins/chain_plugin/chain_plugin.cpp b/plugins/chain_plugin/chain_plugin.cpp index 61093adfef2..2603a87178b 100644 --- a/plugins/chain_plugin/chain_plugin.cpp +++ b/plugins/chain_plugin/chain_plugin.cpp @@ -1060,31 +1060,32 @@ uint64_t read_only::get_table_index_name(const read_only::get_table_rows_params& template<> uint64_t convert_to_type(const string& str, const string& desc) { - uint64_t value = 0; + try { - value = boost::lexical_cast(str.c_str(), str.size()); - } catch( ... ) { + return boost::lexical_cast(str.c_str(), str.size()); + } catch( ... ) { } + + try { + auto trimmed_str = str; + boost::trim(trimmed_str); + name s(trimmed_str); + return s.value; + } catch( ... ) { } + + if (str.find(',') != string::npos) { // fix #6274 only match formats like 4,EOS try { - auto trimmed_str = str; - boost::trim(trimmed_str); - name s(trimmed_str); - value = s.value; - } catch( ... ) { - try { - auto symb = eosio::chain::symbol::from_string(str); - value = symb.value(); - } catch( ... ) { - try { - value = ( eosio::chain::string_to_symbol( 0, str.c_str() ) >> 8 ); - } catch( ... ) { - EOS_ASSERT( false, chain_type_exception, "Could not convert ${desc} string '${str}' to any of the following: " - "uint64_t, valid name, or valid symbol (with or without the precision)", - ("desc", desc)("str", str)); - } - } - } + auto symb = eosio::chain::symbol::from_string(str); + return symb.value(); + } catch( ... ) { } + } + + try { + return ( eosio::chain::string_to_symbol( 0, str.c_str() ) >> 8 ); + } catch( ... ) { + EOS_ASSERT( false, chain_type_exception, "Could not convert ${desc} string '${str}' to any of the following: " + "uint64_t, valid name, or valid symbol (with or without the precision)", + ("desc", desc)("str", str)); } - return value; } abi_def get_abi( const controller& db, const name& account ) { diff --git a/programs/cleos/httpc.cpp b/programs/cleos/httpc.cpp index b0b8acd574e..5503c8fe8ec 100644 --- a/programs/cleos/httpc.cpp +++ b/programs/cleos/httpc.cpp @@ -198,12 +198,12 @@ namespace eosio { namespace client { namespace http { request_stream << "content-length: " << postjson.size() << "\r\n"; request_stream << "Accept: */*\r\n"; request_stream << "Connection: close\r\n"; - request_stream << "\r\n"; // append more customized headers std::vector::iterator itr; for (itr = cp.headers.begin(); itr != cp.headers.end(); itr++) { request_stream << *itr << "\r\n"; } + request_stream << "\r\n"; request_stream << postjson; if ( print_request ) {