[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 3/3] build: avoid warnings about unused variables and macros
From: |
Pádraig Brady |
Subject: |
[PATCH 3/3] build: avoid warnings about unused variables and macros |
Date: |
Tue, 23 Oct 2012 12:23:15 +0100 |
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 variable as unused.
(mulredc): Likewise.
(mulredc2): Likewise.
(divexact_21): Likewise.
---
src/factor.c | 18 +++++++++++++-----
src/longlong.h | 4 ----
2 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/src/factor.c b/src/factor.c
index 539a686..db7fd95 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
@@ -168,7 +177,6 @@ const unsigned char factor_clz_tab[129] =
# endif
#else /* not USE_LONGLONG_H */
-
# define W_TYPE_SIZE (8 * sizeof (uintmax_t))
# define __ll_B ((uintmax_t) 1 << (W_TYPE_SIZE / 2))
# define __ll_lowpart(t) ((uintmax_t) (t) & (__ll_B - 1))
@@ -751,7 +759,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 +901,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 +949,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 +969,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 173afb9..8d71611 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
--
1.7.6.4
- Re: more compile warnings with new factor, (continued)
- Re: more compile warnings with new factor, Pádraig Brady, 2012/10/23
- [PATCH 1/3] build: avoid build failure on some sparc systems, Pádraig Brady, 2012/10/23
- Re: [PATCH 1/3] build: avoid build failure on some sparc systems, Jim Meyering, 2012/10/23
- [PATCH 2/3] build: avoid compile warnings in factor.c on some systems, Pádraig Brady, 2012/10/23
- Re: [PATCH 2/3] build: avoid compile warnings in factor.c on some systems, Jim Meyering, 2012/10/23
- Re: [PATCH 2/3] build: avoid compile warnings in factor.c on some systems, Pádraig Brady, 2012/10/23
- Re: [PATCH 2/3] build: avoid compile warnings in factor.c on some systems, Jim Meyering, 2012/10/23
- [PATCH 3/3] build: avoid warnings about unused variables and macros,
Pádraig Brady <=
- Re: [PATCH 3/3] build: avoid warnings about unused variables and macros, Jim Meyering, 2012/10/23