Skip to content

Commit

Permalink
Workaround gcc _Pragma bug 59884
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaut committed Oct 2, 2021
1 parent d6590e3 commit 012cc70
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
11 changes: 9 additions & 2 deletions include/fmt/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,17 @@

#if defined(__GNUC__) && !defined(__clang__) && !defined(__INTEL_COMPILER)
# define FMT_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__)
# define FMT_GCC_PRAGMA(arg) _Pragma(arg)
#else
# define FMT_GCC_VERSION 0
# define FMT_GCC_PRAGMA(arg)
#endif

#ifndef FMT_GCC_PRAGMA
// Workaround _Pragma bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59884.
# if FMT_GCC_VERSION >= 504
# define FMT_GCC_PRAGMA(arg) _Pragma(arg)
# else
# define FMT_GCC_PRAGMA(arg)
# endif
#endif

#ifdef __ICL
Expand Down
6 changes: 3 additions & 3 deletions include/fmt/format-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ template <typename T = void> struct basic_impl_data {
};

#if FMT_GCC_VERSION && FMT_GCC_VERSION < 409
FMT_GCC_PRAGMA("GCC diagnostic push")
FMT_GCC_PRAGMA("GCC diagnostic ignored \"-Wnarrowing\"")
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wnarrowing"
#endif
// Binary exponents of pow(10, k), for k = -348, -340, ..., 340, corresponding
// to significands above.
Expand All @@ -203,7 +203,7 @@ template <typename T = void> struct basic_impl_data {
534, 561, 588, 614, 641, 667, 694, 720, 747, 774, 800,
827, 853, 880, 907, 933, 960, 986, 1013, 1039, 1066};
#if FMT_GCC_VERSION && FMT_GCC_VERSION < 409
FMT_GCC_PRAGMA("GCC diagnostic pop")
# pragma GCC diagnostic pop
#endif

static constexpr uint64_t power_of_10_64[20] = {
Expand Down

0 comments on commit 012cc70

Please sign in to comment.