From 22ba81b2526cb55b4f0d860dcc471872031a7fa8 Mon Sep 17 00:00:00 2001 From: Pádraig Brady Date: Tue, 23 Oct 2012 11:59:04 +0100 Subject: build: avoid warnings about unused variables and macros src/factor.c (__GMP_DECLSPEC): Move back from longlong.h to treat consistently with other stub macros. (__GMP_GNUC_PREREQ): Reference to avoid -Wunused-macros warning. (__GMP_DECLSPEC): Likewise. (ASSERT): Likewise. (__clz_tab): Likewise. (factor_using_division): Mark a variable as unused. (mulredc): Likewise. (mulredc2): Likewise. (divexact_21): Likewise. --- src/factor.c | 17 +++++++++++++---- src/longlong.h | 4 ---- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/factor.c b/src/factor.c index 539a686e2..d38c5838c 100644 --- a/src/factor.c +++ b/src/factor.c @@ -148,10 +148,19 @@ typedef unsigned long int UDItype; # endif # define LONGLONG_STANDALONE /* Don't require GMP's longlong.h mdep files */ # define ASSERT(x) /* FIXME make longlong.h really standalone */ +# define __GMP_DECLSPEC /* FIXME make longlong.h really standalone */ # define __clz_tab factor_clz_tab /* Rename to avoid glibc collision */ # ifndef __GMP_GNUC_PREREQ # define __GMP_GNUC_PREREQ(a,b) 1 # endif + +/* These stub macros are only used in longlong.h in certain system compiler + combinations, so ensure usage to avoid -Wunused-macros warnings. */ +# if __GMP_GNUC_PREREQ (1,1) && defined __clz_tab +ASSERT (1) +__GMP_DECLSPEC +# endif + # if _ARCH_PPC # define HAVE_HOST_CPU_FAMILY_powerpc 1 # endif @@ -751,7 +760,7 @@ factor_using_division (uintmax_t *t1p, uintmax_t t1, uintmax_t t0, { for (;;) { - uintmax_t q1, q0, hi, lo; + uintmax_t q1, q0, hi, lo ATTRIBUTE_UNUSED; q0 = t0 * primes_dtab[i].binv; umul_ppmm (hi, lo, q0, p); @@ -893,7 +902,7 @@ static const unsigned char binvert_table[128] = _q0 = (u0) * _di; \ if ((u1) >= (d)) \ { \ - uintmax_t _p1, _p0; \ + uintmax_t _p1, _p0 ATTRIBUTE_UNUSED; \ umul_ppmm (_p1, _p0, _q0, d); \ (q1) = ((u1) - _p1) * _di; \ (q0) = _q0; \ @@ -941,7 +950,7 @@ static const unsigned char binvert_table[128] = static inline uintmax_t mulredc (uintmax_t a, uintmax_t b, uintmax_t m, uintmax_t mi) { - uintmax_t rh, rl, q, th, tl, xh; + uintmax_t rh, rl, q, th, tl ATTRIBUTE_UNUSED, xh; umul_ppmm (rh, rl, a, b); q = rl * mi; @@ -961,7 +970,7 @@ mulredc2 (uintmax_t *r1p, uintmax_t a1, uintmax_t a0, uintmax_t b1, uintmax_t b0, uintmax_t m1, uintmax_t m0, uintmax_t mi) { - uintmax_t r1, r0, q, p1, p0, t1, t0, s1, s0; + uintmax_t r1, r0, q, p1, p0 ATTRIBUTE_UNUSED, t1, t0, s1, s0; mi = -mi; assert ( (a1 >> (W_TYPE_SIZE - 1)) == 0); assert ( (b1 >> (W_TYPE_SIZE - 1)) == 0); diff --git a/src/longlong.h b/src/longlong.h index 173afb920..8d7161113 100644 --- a/src/longlong.h +++ b/src/longlong.h @@ -2055,10 +2055,6 @@ extern UWtype mpn_udiv_qrnnd_r (UWtype, UWtype, UWtype, UWtype *); __GMP_DECLSPEC UWtype __MPN(udiv_w_sdiv) (UWtype *, UWtype, UWtype, UWtype); #endif -#ifndef __GMP_DECLSPEC -#define __GMP_DECLSPEC /* empty */ -#endif - /* If udiv_qrnnd was not defined for this processor, use __udiv_qrnnd_c. */ #if !defined (udiv_qrnnd) #define UDIV_NEEDS_NORMALIZATION 1 -- cgit v1.2.3-54-g00ecf