summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2012-10-23 11:59:04 +0100
committerPádraig Brady <P@draigBrady.com>2012-10-23 13:03:09 +0100
commit22ba81b2526cb55b4f0d860dcc471872031a7fa8 (patch)
treefdb4198b0d67cce3a667ba7f35e8be50d1a226f8
parent0bf808356e0d05245b3e913cdd9bae31954579a0 (diff)
downloadcoreutils-22ba81b2526cb55b4f0d860dcc471872031a7fa8.tar.xz
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.
-rw-r--r--src/factor.c17
-rw-r--r--src/longlong.h4
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