Skip to content

Commit ae6ee6a

Browse files
committed
lib/mpi: Fix unused variable warnings
This patch removes a number of unused variables and marks others as unused in order to silence compiler warnings about them. Fixes: a8ea8bd ("lib/mpi: Extend the MPI library") Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Tested-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent 4a0c1de commit ae6ee6a

4 files changed

Lines changed: 3 additions & 10 deletions

File tree

‎lib/mpi/mpi-div.c‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ void mpi_tdiv_qr(MPI quot, MPI rem, MPI num, MPI den)
9292
unsigned int normalization_steps;
9393
mpi_limb_t q_limb;
9494
mpi_ptr_t marker[5];
95-
unsigned int marker_nlimbs[5];
9695
int markidx = 0;
9796

9897
/* Ensure space is enough for quotient and remainder.
@@ -152,7 +151,6 @@ void mpi_tdiv_qr(MPI quot, MPI rem, MPI num, MPI den)
152151
* numerator would be gradually overwritten by the quotient limbs.
153152
*/
154153
if (qp == np) { /* Copy NP object to temporary space. */
155-
marker_nlimbs[markidx] = nsize;
156154
np = marker[markidx++] = mpi_alloc_limb_space(nsize);
157155
MPN_COPY(np, qp, nsize);
158156
}
@@ -173,7 +171,6 @@ void mpi_tdiv_qr(MPI quot, MPI rem, MPI num, MPI den)
173171
* the most significant word. Use temporary storage not to clobber
174172
* the original contents of the denominator.
175173
*/
176-
marker_nlimbs[markidx] = dsize;
177174
tp = marker[markidx++] = mpi_alloc_limb_space(dsize);
178175
mpihelp_lshift(tp, dp, dsize, normalization_steps);
179176
dp = tp;
@@ -195,7 +192,6 @@ void mpi_tdiv_qr(MPI quot, MPI rem, MPI num, MPI den)
195192
if (dp == rp || (quot && (dp == qp))) {
196193
mpi_ptr_t tp;
197194

198-
marker_nlimbs[markidx] = dsize;
199195
tp = marker[markidx++] = mpi_alloc_limb_space(dsize);
200196
MPN_COPY(tp, dp, dsize);
201197
dp = tp;

‎lib/mpi/mpi-internal.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ typedef int mpi_size_t; /* (must be a signed type) */
114114
*/
115115
#define UDIV_QRNND_PREINV(q, r, nh, nl, d, di) \
116116
do { \
117-
mpi_limb_t _ql; \
117+
mpi_limb_t _ql __maybe_unused; \
118118
mpi_limb_t _q, _r; \
119119
mpi_limb_t _xh, _xl; \
120120
umul_ppmm(_q, _ql, (nh), (di)); \

‎lib/mpi/mpi-mul.c‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ void mpi_mul(MPI w, MPI u, MPI v)
2121
int usign, vsign, sign_product;
2222
int assign_wp = 0;
2323
mpi_ptr_t tmp_limb = NULL;
24-
unsigned int tmp_limb_nlimbs = 0;
2524

2625
if (u->nlimbs < v->nlimbs) {
2726
/* Swap U and V. */
@@ -55,7 +54,6 @@ void mpi_mul(MPI w, MPI u, MPI v)
5554
} else { /* Make U and V not overlap with W. */
5655
if (wp == up) {
5756
/* W and U are identical. Allocate temporary space for U. */
58-
tmp_limb_nlimbs = usize;
5957
up = tmp_limb = mpi_alloc_limb_space(usize);
6058
/* Is V identical too? Keep it identical with U. */
6159
if (wp == vp)
@@ -64,7 +62,6 @@ void mpi_mul(MPI w, MPI u, MPI v)
6462
MPN_COPY(up, wp, usize);
6563
} else if (wp == vp) {
6664
/* W and V are identical. Allocate temporary space for V. */
67-
tmp_limb_nlimbs = vsize;
6865
vp = tmp_limb = mpi_alloc_limb_space(vsize);
6966
/* Copy to the temporary space. */
7067
MPN_COPY(vp, wp, vsize);

‎lib/mpi/mpih-div.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ mpihelp_mod_1(mpi_ptr_t dividend_ptr, mpi_size_t dividend_size,
3131
{
3232
mpi_size_t i;
3333
mpi_limb_t n1, n0, r;
34-
mpi_limb_t dummy;
34+
mpi_limb_t dummy __maybe_unused;
3535

3636
/* Botch: Should this be handled at all? Rely on callers? */
3737
if (!dividend_size)
@@ -382,7 +382,7 @@ mpihelp_divmod_1(mpi_ptr_t quot_ptr,
382382
{
383383
mpi_size_t i;
384384
mpi_limb_t n1, n0, r;
385-
mpi_limb_t dummy;
385+
mpi_limb_t dummy __maybe_unused;
386386

387387
if (!dividend_size)
388388
return 0;

0 commit comments

Comments
 (0)