X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/9b1663a5574182a66c6de8ad2fce7b3e4cbf277b..23bbea75793621e6b21fbb13c00d8223113cf7b5:/math/mpint.h diff --git a/math/mpint.h b/math/mpint.h index f551980..e351b05 100644 --- a/math/mpint.h +++ b/math/mpint.h @@ -36,6 +36,8 @@ #include +#include + #ifndef CATACOMB_MP_H # include "mp.h" #endif @@ -46,21 +48,9 @@ * * GCC (at least) isn't clever enough to work out that the division in * @MP_FROMINT@ is actually safe (since it will only be executed if @_i > - * MPW_MAX@, which would prove that @(type)MPW_MAX + 1 != 0@). So here's - * some machinery to shut it up. + * MPW_MAX@, which would prove that @(type)MPW_MAX + 1 != 0@). */ -#if __GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) -# define MP_FROMINT_MUFFLE_WARNING(x) do { \ - _Pragma("GCC diagnostic push") \ - _Pragma("GCC diagnostic ignored \"-Wdiv-by-zero\"") \ - x \ - _Pragma("GCC diagnostic pop") \ - } while (0) -#else -# define MP_FROMINT_MUFFLE_WARNING(x) do { x } while (0) -#endif - /* --- @MP_FROMINT@ --- * * * Arguments: @d@ = destination multiprecision integer @@ -90,7 +80,9 @@ if (_i <= MPW_MAX) \ break; \ else \ - MP_FROMINT_MUFFLE_WARNING({ _i /= (type)MPW_MAX + 1; }); \ + MUFFLE_WARNINGS_STMT(GCC_WARNING("-Wdiv-by-zero"), { \ + _i /= (type)MPW_MAX + 1; \ + }); \ } \ } else { \ _d->f |= MP_NEG; \ @@ -103,7 +95,9 @@ if (_i >= -MPW_MAX) \ break; \ else \ - MP_FROMINT_MUFFLE_WARNING({ _i /= (type)MPW_MAX + 1; }); \ + MUFFLE_WARNINGS_STMT(GCC_WARNING("-Wdiv-by-zero"), { \ + _i /= (type)MPW_MAX + 1; \ + }); \ } \ } \ \