From 601b95ee41414a547ef0c80cf81dd344e6ac0e79 Mon Sep 17 00:00:00 2001 From: terik23 Date: Tue, 26 Mar 2019 12:03:53 +0500 Subject: [PATCH] fix build and install gcc-9 --- .travis.yml | 17 +++++++++++------ include/nameof.hpp | 4 ++-- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index fc5e261..7f9324b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,12 +33,6 @@ matrix: - os: linux compiler: g++ - addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - g++-9 env: - CXX_COMPILER=g++-9 CC_COMPILER=gcc-9 @@ -123,6 +117,17 @@ install: export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${LLVM_INSTALL}/lib" fi + - | + # If linux and gcc-9 install gcc-9. + if [[ "${CXX_COMPILER}" == "g++-9" ]]; then + wget http://kayari.org/gcc-latest/gcc-latest.deb + sudo dpkg -i gcc-latest.deb + sudo ln -s /opt/gcc-latest/bin/gcc /usr/bin/gcc-9 + sudo ln -s /opt/gcc-latest/bin/g++ /usr/bin/g++-9 + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 90 --slave /usr/bin/g++ g++ /usr/bin/g++-9 + sudo ldconfig /opt/gcc-latest/lib64 + fi + before_script: - rm -rf build - mkdir -p build diff --git a/include/nameof.hpp b/include/nameof.hpp index fc2890a..1bb9b43 100644 --- a/include/nameof.hpp +++ b/include/nameof.hpp @@ -167,11 +167,11 @@ template constexpr auto suffix = sizeof("]") - 1; #elif defined(__GNUC__) std::string_view name{__PRETTY_FUNCTION__}; - constexpr auto prefix = sizeof("constexpr std::string_view nameof::detail::nameof_enum_impl() [with E = ") + nameof_type_impl>().length() + sizeof("; V = "); # if __GNUC__ < 9 - constexpr auto suffix = sizeof("; std::string_view = std::basic_string_view]") - 1; + constexpr auto prefix = sizeof("constexpr std::string_view nameof::detail::nameof_enum_impl() [with E = ") + nameof_type_impl>().length() + sizeof("; V = "); name.remove_prefix(prefix); # endif + constexpr auto suffix = sizeof("; std::string_view = std::basic_string_view]") - 1; #elif defined(_MSC_VER) std::string_view name{__FUNCSIG__}; constexpr auto suffix = sizeof(">(void) noexcept") - 1;