clang warning about mini-gmp.c when used in Emacs

Paul Eggert eggert at cs.ucla.edu
Sat Apr 9 01:24:38 CEST 2022


Mattias Engdegård reported that the Emacs master source currently 
generates the following warning when Emacs is built with mini-gmp.c 
under Clang 13:

> In file included from /Users/mattias/emacs/lib/mini-gmp-gnulib.c:47:
> /Users/mattias/emacs/lib/mini-gmp.c:1138:2: warning: unused variable '__cy' [-Wunused-variable]
>         gmp_assert_nocarry (mpn_rshift (np, np, dn, shift));
>         ^
> /Users/mattias/emacs/lib/mini-gmp.c:91:15: note: expanded from macro 'gmp_assert_nocarry'
>     mp_limb_t __cy = (x);          \

The problem occurs because assert(X) does not evaluate X when NDEBUG is 
defined. Proposed patch attached.

Another advantage of this patch is that any messages generated by 
assertion failures are more informative.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gmp-patch.diff
Type: text/x-patch
Size: 602 bytes
Desc: not available
URL: <https://gmplib.org/list-archives/gmp-bugs/attachments/20220408/82193c93/attachment.bin>


More information about the gmp-bugs mailing list