issue with Microsoft compiler
marc.glisse at inria.fr
Mon Feb 13 11:54:50 CET 2023
On Mon, 13 Feb 2023, Niels MÃ¶ller wrote:
> I got the impression that someone was building GMP with -Werror.
Then I agree that it is their problem.
> Getting this by just *using* gmp and including gmp.h is
> a different setting with different tradeoffs.
> It might make some sense to add something like
> #ifdef _MSC_VER
> # pragma warning(disable:4146)
> to the installed gmp.h, if that is deemed not too brittle (I don't know
> how stable warning numbers are, or if there's some better way). I got
> _MCS_VER from a quick look at
> Is the pragma a documented / recommended way to disable the warning?
The numbers seem stable, and the pragma is advertised by Microsoft
and used by many projects
You are supposed to use push/pop as well, though, in a header.
# pragma warning(push)
# pragma warning(disable:4146)
... code ...
# pragma warning(pop)
Another option, if it is just the one place in gmp.h, would be to replace
-X with 0-X (or the uglier ~X+1 but that does not seem necessary).
More information about the gmp-bugs