From 9ffbc17a0f9921717ea55c59532ed74d22758217 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 28 May 2020 20:04:24 +1200 Subject: [PATCH] Fix (deliberately) unused variable warning in rsa-ltm.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Seen on Ubuntu 18.04 with gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04) giving: rsa-ltm.c: In function ‘ltm_rsa_private_calculate’: rsa-ltm.c:135:9: error: variable ‘where’ set but not used [-Werror=unused-but-set-variable] int where = 0; /* Ignore the set-but-unused warning from this */ ^~~~~ rsa-ltm.c: In function ‘gen_p’: rsa-ltm.c:482:9: error: variable ‘where’ set but not used [-Werror=unused-but-set-variable] int where = 0; /* Ignore the set-but-unused warning from this */ ^~~~~ Signed-off-by: Andrew Bartlett --- .travis.yml | 2 +- lib/hcrypto/rsa-ltm.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 75996a852..5588f54da 100644 --- a/.travis.yml +++ b/.travis.yml @@ -44,7 +44,7 @@ install: else # This list of -Wno-error options should be reduced over time where possible if [ x"$TRAVIS_COMPILER" != x"clang" ]; then - CFLAGS="-Wno-error=empty-body -Wno-error=shadow -Wno-error=unused-value -Wno-error=unused-but-set-variable -Wno-error=bad-function-cast -Wno-error=unused-function -Wno-error=unused-result -Wno-error=deprecated-declarations" ../configure --enable-developer --srcdir=`dirname "$PWD"` --enable-maintainer-mode $COVERAGE + CFLAGS="-Wno-error=empty-body -Wno-error=shadow -Wno-error=unused-value -Wno-error=bad-function-cast -Wno-error=unused-function -Wno-error=unused-result -Wno-error=deprecated-declarations" ../configure --enable-developer --srcdir=`dirname "$PWD"` --enable-maintainer-mode $COVERAGE else CFLAGS="-Wno-error=shadow -Wno-error=bad-function-cast -Wno-error=unused-function -Wno-error=unused-result -Wno-error=deprecated-declarations" ../configure --enable-developer --srcdir=`dirname "$PWD"` --enable-maintainer-mode $COVERAGE fi diff --git a/lib/hcrypto/rsa-ltm.c b/lib/hcrypto/rsa-ltm.c index a52ad1391..2852bd4d6 100644 --- a/lib/hcrypto/rsa-ltm.c +++ b/lib/hcrypto/rsa-ltm.c @@ -132,7 +132,7 @@ ltm_rsa_private_calculate(mp_int * in, mp_int * p, mp_int * q, { mp_err ret; mp_int vp, vq, u; - int where = 0; /* Ignore the set-but-unused warning from this */ + int where HEIMDAL_UNUSED_ATTRIBUTE = 0; FIRST(mp_init_multi(&vp, &vq, &u, NULL)); @@ -479,7 +479,7 @@ gen_p(int bits, enum gen_pq_type pq_type, uint8_t nibble_pair, mp_int *p, mp_int size_t len = (bits + 7) / 8; int trials = mp_prime_rabin_miller_trials(bits); int counter = 0; - int where = 0; /* Ignore the set-but-unused warning from this */ + int where HEIMDAL_UNUSED_ATTRIBUTE = 0; FIRST(mp_init_multi(&t1, &t2, NULL));