From 20e652abbb934fdee6a5ecf79fe1b036691c60a8 Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Thu, 23 Jul 2015 20:14:15 -0400 Subject: [PATCH] Cleared "unused parameter" warning with GCC 5.1 and -Wextra --- algebra.h | 4 ++-- asn.cpp | 8 ++++---- factory.h | 12 ++++++++++++ fips140.cpp | 7 +++++++ gf256.h | 4 ++-- gf2_32.h | 5 +++-- xtr.cpp | 1 + 7 files changed, 31 insertions(+), 10 deletions(-) diff --git a/algebra.h b/algebra.h index ffa660a7..136bbeda 100644 --- a/algebra.h +++ b/algebra.h @@ -49,7 +49,7 @@ public: AbstractRing() {m_mg.m_pRing = this;} AbstractRing(const AbstractRing &source) : AbstractGroup(source) {m_mg.m_pRing = this;} - AbstractRing& operator=(const AbstractRing &source) {CRYTPOPP_UNUSED(source);return *this;} + AbstractRing& operator=(const AbstractRing &source) {CRYPTOPP_UNUSED(source);return *this;} virtual bool IsUnit(const Element &a) const =0; virtual const Element& MultiplicativeIdentity() const =0; @@ -209,7 +209,7 @@ public: {Element::Divide(r, q, a, d);} bool operator==(const EuclideanDomainOf &rhs) const - {return true;} + {CRYPTOPP_UNUSED(rhs);return true;} private: mutable Element result; diff --git a/asn.cpp b/asn.cpp index 3f88582c..19caf82c 100644 --- a/asn.cpp +++ b/asn.cpp @@ -405,12 +405,12 @@ void BERGeneralDecoder::Init(byte asnTag) BERGeneralDecoder::~BERGeneralDecoder() { - try // avoid throwing in constructor + try // avoid throwing in desstructor { if (!m_finished) MessageEnd(); } - catch (...) + catch (const Exception&) { } } @@ -496,12 +496,12 @@ DERGeneralEncoder::DERGeneralEncoder(DERGeneralEncoder &outQueue, byte asnTag) DERGeneralEncoder::~DERGeneralEncoder() { - try // avoid throwing in constructor + try // avoid throwing in destructor { if (!m_finished) MessageEnd(); } - catch (...) + catch (const Exception&) { } } diff --git a/factory.h b/factory.h index 5b65db3d..d837a022 100644 --- a/factory.h +++ b/factory.h @@ -2,9 +2,17 @@ #define CRYPTOPP_OBJFACT_H #include "cryptlib.h" +#include "misc.h" #include #include +#if GCC_DIAGNOSTIC_AWARE +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wunused-value" +# pragma GCC diagnostic ignored "-Wunused-variable" +# pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + NAMESPACE_BEGIN(CryptoPP) //! _ @@ -133,4 +141,8 @@ void RegisterAuthenticatedSymmetricCipherDefaultFactories(const char *name=NULL, NAMESPACE_END +#if GCC_DIAGNOSTIC_AWARE +# pragma GCC diagnostic push +#endif + #endif diff --git a/fips140.cpp b/fips140.cpp index 1fcf5901..17e91eee 100644 --- a/fips140.cpp +++ b/fips140.cpp @@ -5,8 +5,15 @@ #ifndef CRYPTOPP_IMPORTS #include "fips140.h" +#include "misc.h" #include "trdlocal.h" // needs to be included last for cygwin +#if GCC_DIAGNOSTIC_AWARE +# pragma GCC diagnostic ignored "-Wunused-value" +# pragma GCC diagnostic ignored "-Wunused-variable" +# pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + NAMESPACE_BEGIN(CryptoPP) // Define this to 1 to turn on FIPS 140-2 compliance features, including additional tests during diff --git a/gf256.h b/gf256.h index e0ea7482..b3ea71ee 100644 --- a/gf256.h +++ b/gf256.h @@ -15,7 +15,7 @@ public: GF256(byte modulus) : m_modulus(modulus) {} Element RandomElement(RandomNumberGenerator &rng, int ignored = 0) const - {return rng.GenerateByte();} + {CRYPTOPP_UNUSED(ignored);return rng.GenerateByte();} bool Equal(Element a, Element b) const {return a==b;} @@ -39,7 +39,7 @@ public: {return a^=b;} Element Double(Element a) const - {return 0;} + {CRYPTOPP_UNUSED(a);return 0;} Element One() const {return 1;} diff --git a/gf2_32.h b/gf2_32.h index 31713f4c..5a16f60a 100644 --- a/gf2_32.h +++ b/gf2_32.h @@ -2,6 +2,7 @@ #define CRYPTOPP_GF2_32_H #include "cryptlib.h" +#include "misc.h" NAMESPACE_BEGIN(CryptoPP) @@ -15,7 +16,7 @@ public: GF2_32(word32 modulus=0x0000008D) : m_modulus(modulus) {} Element RandomElement(RandomNumberGenerator &rng, int ignored = 0) const - {return rng.GenerateWord32();} + {CRYPTOPP_UNUSED(ignored);return rng.GenerateWord32();} bool Equal(Element a, Element b) const {return a==b;} @@ -39,7 +40,7 @@ public: {return a^=b;} Element Double(Element a) const - {return 0;} + {CRYPTOPP_UNUSED(a);return 0;} Element MultiplicativeIdentity() const {return 1;} diff --git a/xtr.cpp b/xtr.cpp index 0257f64d..3cf8d97f 100644 --- a/xtr.cpp +++ b/xtr.cpp @@ -2,6 +2,7 @@ #include "pch.h" #include "xtr.h" +#include "misc.h" #include "nbtheory.h" #include "algebra.cpp"