unused macro MPN_PTR_SWAP in mini-gmp.c

Paul Eggert eggert at cs.ucla.edu
Sat Mar 19 18:19:38 CET 2022


On 3/19/22 04:44, Niels Möller wrote:
> Paul Eggert <eggert at cs.ucla.edu> writes:
> 
>> In libgmp 6.2.1, mini-gmp.c defines a macro without using it, causing
>> the command "gcc -Wunused-macros -Werror" to fail with the following
>> diagnostic:
> 
> I haven't used -Wunused-macros before, I take it it warns only about
> macros defined in .c files? Since it's perfectly normal that macros
> defined in .h files are unused in some of the compilation units
> including the .h file?

Yes, that's right.


> mini-gmp.c is a bit special, in that one more-or-less recommended
> usecase is to #include this file into some other compilation unit. E.g.,
> like in https://gmplib.org/repo/gmp/file/tip/bootstrap.c#l33.
> 
> But probably still shouln't define macros not used within mini-gmp.c;
> any additional utility macros should probably go in mini-gmp.h, and be
> compatible with public macros from gmp.h.

MPN_PTR_SWAP is an internal macro, though, and I expect you don't want 
it to be public.

A couple of days ago Marco gave a simple fix that looks like a win, as 
it also makes mini-gmp.c shorter and easier to read; please see 
attachment. Could you please install that? Thanks.
-------------- next part --------------
An embedded message was scrubbed...
From: Marco Bodrato <bodrato at mail.dm.unipi.it>
Subject: Re: unused macro MPN_PTR_SWAP in mini-gmp.c
Date: Thu, 17 Mar 2022 19:32:10 +0100
Size: 3318
URL: <https://gmplib.org/list-archives/gmp-bugs/attachments/20220319/f0c160b0/attachment.eml>


More information about the gmp-bugs mailing list