From db496b47c1c5abe963f1dddcd52e26aff7b5910b Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Sat, 31 Aug 2024 08:52:25 -0700 Subject: [PATCH] Remove old gcc hack --- .github/workflows/linux.yml | 17 +++++++---------- include/fmt/base.h | 29 ++++++++++++----------------- 2 files changed, 19 insertions(+), 27 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 5b4e213a..29b2a6e9 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -10,12 +10,12 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - cxx: [g++-4.8, g++-10, clang++-9] + cxx: [g++-4.9, g++-10, clang++-9] build_type: [Debug, Release] std: [11] include: - - cxx: g++-4.8 - install: sudo apt install g++-4.8 + - cxx: g++-4.9 + install: sudo apt install g++-4.9 - cxx: g++-8 build_type: Debug std: 14 @@ -64,13 +64,10 @@ jobs: - name: Add repositories for older GCC run: | - # Below two repos provide GCC 4.8, 5.5 and 6.4 - sudo apt-add-repository 'deb http://azure.archive.ubuntu.com/ubuntu/ bionic main' - sudo apt-add-repository 'deb http://azure.archive.ubuntu.com/ubuntu/ bionic universe' - # Below two repos additionally update GCC 6 to 6.5 - # sudo apt-add-repository 'deb http://azure.archive.ubuntu.com/ubuntu/ bionic-updates main' - # sudo apt-add-repository 'deb http://azure.archive.ubuntu.com/ubuntu/ bionic-updates universe' - if: ${{ matrix.cxx == 'g++-4.8' }} + # Below repo provides GCC 4.9. + sudo apt-add-repository 'deb http://azure.archive.ubuntu.com/ubuntu/ xenial main' + sudo apt-add-repository 'deb http://azure.archive.ubuntu.com/ubuntu/ xenial universe' + if: ${{ matrix.cxx == 'g++-4.9' }} - name: Add repositories for newer GCC run: | diff --git a/include/fmt/base.h b/include/fmt/base.h index 4c3233be..017d582b 100644 --- a/include/fmt/base.h +++ b/include/fmt/base.h @@ -3012,6 +3012,16 @@ template struct runtime_format_string { basic_string_view str; }; +/** + * Creates a runtime format string. + * + * **Example**: + * + * // Check format string at runtime instead of compile-time. + * fmt::print(fmt::runtime("{:d}"), "I am not a number"); + */ +inline auto runtime(string_view s) -> runtime_format_string<> { return {{s}}; } + /// A compile-time format string. template class basic_format_string { private: @@ -3053,23 +3063,8 @@ template class basic_format_string { auto get() const -> basic_string_view { return str_; } }; -#if FMT_GCC_VERSION && FMT_GCC_VERSION < 409 -// Workaround broken conversion on older gcc. -template using format_string = string_view; -inline auto runtime(string_view s) -> string_view { return s; } -#else -template -using format_string = basic_format_string...>; -/** - * Creates a runtime format string. - * - * **Example**: - * - * // Check format string at runtime instead of compile-time. - * fmt::print(fmt::runtime("{:d}"), "I am not a number"); - */ -inline auto runtime(string_view s) -> runtime_format_string<> { return {{s}}; } -#endif +template +using format_string = basic_format_string...>; /// Formats a string and writes the output to `out`. template