diff --git a/include/fmt/core.h b/include/fmt/core.h index 187bce4b..3e8bb719 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -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 diff --git a/include/fmt/format-inl.h b/include/fmt/format-inl.h index 2f895497..38a0e9cc 100644 --- a/include/fmt/format-inl.h +++ b/include/fmt/format-inl.h @@ -188,8 +188,8 @@ template 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. @@ -203,7 +203,7 @@ template 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] = {