From 8f59d9af3598927cd83ac0582abc0a977395f049 Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Sun, 19 Jul 2015 10:22:16 -0400 Subject: [PATCH] Cleared unused variable and function warnings --- 3way.cpp | 2 +- asn.cpp | 3 +++ datatest.cpp | 2 +- filters.cpp | 2 +- fipstest.cpp | 1 + hkdf.h | 9 +++++++++ network.cpp | 2 ++ rijndael.cpp | 9 +++++++++ rw.cpp | 2 ++ validat1.cpp | 1 + xtr.cpp | 4 ++-- zinflate.cpp | 2 +- 12 files changed, 33 insertions(+), 6 deletions(-) diff --git a/3way.cpp b/3way.cpp index 725b682e..b4e1e22c 100644 --- a/3way.cpp +++ b/3way.cpp @@ -15,7 +15,7 @@ void ThreeWay_TestInstantiations() static const word32 START_E = 0x0b0b; // round constant of first encryption round static const word32 START_D = 0xb1b1; // round constant of first decryption round -static const word32 RC_MODULUS = 0x11011; +// static const word32 RC_MODULUS = 0x11011; static inline word32 reverseBits(word32 a) { diff --git a/asn.cpp b/asn.cpp index 27b49d9b..9a0c257b 100644 --- a/asn.cpp +++ b/asn.cpp @@ -348,6 +348,9 @@ void EncodedObjectFilter::Put(const byte *inString, size_t length) if (m_lengthRemaining == 0) m_state = IDENTIFIER; + + case TAIL: case ALL_DONE: ;; + default: ;; } if (m_state == IDENTIFIER && m_level == 0) diff --git a/datatest.cpp b/datatest.cpp index 7a1a9cfa..31ed1e4d 100644 --- a/datatest.cpp +++ b/datatest.cpp @@ -640,7 +640,7 @@ void OutputPair(const NameValuePairs &v, const char *name) { Integer x; bool b = v.GetValue(name, x); - assert(b); + assert(b); CRYPTOPP_UNUSED(b); cout << name << ": \\\n "; x.Encode(HexEncoder(new FileSink(cout), false, 64, "\\\n ").Ref(), x.MinEncodedSize()); cout << endl; diff --git a/filters.cpp b/filters.cpp index deed638f..aec869db 100644 --- a/filters.cpp +++ b/filters.cpp @@ -817,7 +817,7 @@ void HashVerificationFilter::FirstPut(const byte *inString) { m_expectedHash.New(m_digestSize); - if(inString) + if (inString) memcpy(m_expectedHash, inString, m_expectedHash.size()); if (m_flags & PUT_HASH) AttachedTransformation()->Put(inString, m_expectedHash.size()); diff --git a/fipstest.cpp b/fipstest.cpp index 20bc8c8b..27d9979f 100644 --- a/fipstest.cpp +++ b/fipstest.cpp @@ -26,6 +26,7 @@ extern "C" {_CRTIMP void __cdecl _CRT_DEBUGGER_HOOK(int);} #if GCC_DIAGNOSTIC_AWARE # pragma GCC diagnostic ignored "-Wunused-value" # pragma GCC diagnostic ignored "-Wunused-variable" +# pragma GCC diagnostic ignored "-Wunneeded-internal-declaration" #endif NAMESPACE_BEGIN(CryptoPP) diff --git a/hkdf.h b/hkdf.h index 711f250c..3a5df13b 100644 --- a/hkdf.h +++ b/hkdf.h @@ -10,6 +10,11 @@ #include +#if GCC_DIAGNOSTIC_AWARE +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wunused-variable" +#endif + NAMESPACE_BEGIN(CryptoPP) //! abstract base class for key derivation function @@ -84,4 +89,8 @@ unsigned int HKDF::DeriveKey(byte *derived, size_t derivedLen, const byte *se NAMESPACE_END +#if GCC_DIAGNOSTIC_AWARE +# pragma GCC diagnostic pop +#endif + #endif // CRYPTOPP_HASH_KEY_DERIVATION_FUNCTION_H diff --git a/network.cpp b/network.cpp index 1eb12fc1..aecf29ca 100644 --- a/network.cpp +++ b/network.cpp @@ -16,6 +16,8 @@ lword LimitedBandwidth::ComputeCurrentTransceiveLimit() return ULONG_MAX; double curTime = GetCurTimeAndCleanUp(); + CRYPTOPP_UNUSED(curTime); + lword total = 0; for (OpQueue::size_type i=0; i!=m_ops.size(); ++i) total += m_ops[i].second; diff --git a/rijndael.cpp b/rijndael.cpp index 56432ad4..c872104f 100644 --- a/rijndael.cpp +++ b/rijndael.cpp @@ -73,6 +73,11 @@ being unloaded from L1 cache, until that round is finished. #include "misc.h" #include "cpu.h" +#if GCC_DIAGNOSTIC_AWARE +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wunused-function" +#endif + NAMESPACE_BEGIN(CryptoPP) #ifdef CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS @@ -1259,5 +1264,9 @@ size_t Rijndael::Dec::AdvancedProcessBlocks(const byte *inBlocks, const byte *xo NAMESPACE_END +#if GCC_DIAGNOSTIC_AWARE +# pragma GCC diagnostic pop +#endif + #endif #endif diff --git a/rw.cpp b/rw.cpp index 8e07f577..87146d08 100644 --- a/rw.cpp +++ b/rw.cpp @@ -11,7 +11,9 @@ #ifndef CRYPTOPP_IMPORTS +#ifdef _OPENMP static const bool CRYPTOPP_RW_USE_OMP = false; +#endif NAMESPACE_BEGIN(CryptoPP) diff --git a/validat1.cpp b/validat1.cpp index 013a86b6..5bb62a77 100644 --- a/validat1.cpp +++ b/validat1.cpp @@ -286,6 +286,7 @@ bool TestOS_RNG() RandomNumberSource test(*rng, UINT_MAX, false, new Deflator(new Redirector(meter))); unsigned long total=0, length=0; time_t t = time(NULL), t1 = 0; + CRYPTOPP_UNUSED(length); // check that it doesn't take too long to generate a reasonable amount of randomness while (total < 16 && (t1 < 10 || total*8 > (unsigned long)t1)) diff --git a/xtr.cpp b/xtr.cpp index 67390705..0257f64d 100644 --- a/xtr.cpp +++ b/xtr.cpp @@ -27,9 +27,9 @@ void XTR_FindPrimesAndGenerator(RandomNumberGenerator &rng, Integer &p, Integer do { bool qFound = q.Randomize(rng, minQ, maxQ, Integer::PRIME, 7, 12); - assert(qFound); + assert(qFound); CRYPTOPP_UNUSED(qFound); bool solutionsExist = SolveModularQuadraticEquation(r1, r2, 1, -1, 1, q); - assert(solutionsExist); + assert(solutionsExist); CRYPTOPP_UNUSED(solutionsExist); } while (!p.Randomize(rng, minP, maxP, Integer::PRIME, CRT(rng.GenerateBit()?r1:r2, q, 2, 3, EuclideanMultiplicativeInverse(p, 3)), 3*q)); assert(((p.Squared() - p + 1) % q).IsZero()); diff --git a/zinflate.cpp b/zinflate.cpp index 4018e115..75175472 100644 --- a/zinflate.cpp +++ b/zinflate.cpp @@ -36,7 +36,7 @@ inline bool LowFirstBitReader::FillBuffer(unsigned int length) inline unsigned long LowFirstBitReader::PeekBits(unsigned int length) { bool result = FillBuffer(length); - assert(result); + assert(result); CRYPTOPP_UNUSED(result); return m_buffer & (((unsigned long)1 << length) - 1); }