diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2022-10-26 12:57:29 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2022-10-26 12:57:29 +0200 |
commit | 54993165a6c0cf301850436d2f641d96a4d68d81 (patch) | |
tree | 43c27ed1e4c5f17e522248d72ce8331f6d0f0b7f /compat/assert.hpp | |
parent | f9a0eb3a124713cd086ace10d818a8f457e5abbb (diff) |
add _Pragma against printf -Wdouble-promotion
Diffstat (limited to 'compat/assert.hpp')
-rw-r--r-- | compat/assert.hpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/compat/assert.hpp b/compat/assert.hpp index 0acaa613..29b6d081 100644 --- a/compat/assert.hpp +++ b/compat/assert.hpp @@ -7,6 +7,13 @@ #ifdef __GNUG__ # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Wunused-macros" +#define FM_KILL_WARN_double_promotion1() \ + _Pragma( "GCC diagnostic push" ) \ + _Pragma( "GCC diagnostic ignored \"-Wdouble-promotion\"" ) +#define FM_KILL_WARN_double_promotion2() _Pragma( "GCC diagnostic pop" ) +#else +#define FM_KILL_WARN_double_promotion1() +#define FM_KILL_WARN_double_promotion2() #endif #define fm_EMIT_DEBUG(pfx, ...) \ @@ -14,10 +21,9 @@ if (!std::is_constant_evaluated()) { \ if constexpr (sizeof(pfx) > 1) \ std::fputs((pfx), stderr); \ - _Pragma( "GCC diagnostic push" ) \ - _Pragma( "GCC diagnostic ignored \"-Wdouble-promotion\"" ) \ + FM_KILL_WARN_double_promotion1() \ std::fprintf(stderr, __VA_ARGS__); \ - _Pragma( "GCC diagnostic pop" ) \ + FM_KILL_WARN_double_promotion2() \ std::fputc('\n', stderr); \ std::fflush(stderr); \ } \ |