diff options
-rw-r--r-- | algebra.h | 5 | ||||
-rw-r--r-- | cryptlib.h | 14 | ||||
-rw-r--r-- | misc.h | 1 | ||||
-rw-r--r-- | modarith.h | 3 | ||||
-rw-r--r-- | secblock.h | 28 | ||||
-rw-r--r-- | simple.h | 11 |
6 files changed, 50 insertions, 12 deletions
@@ -2,6 +2,7 @@ #define CRYPTOPP_ALGEBRA_H #include "config.h" +#include "misc.h" NAMESPACE_BEGIN(CryptoPP) @@ -47,8 +48,8 @@ public: typedef T Element; AbstractRing() {m_mg.m_pRing = this;} - AbstractRing(const AbstractRing &source) {m_mg.m_pRing = this;} - AbstractRing& operator=(const AbstractRing &source) {return *this;} + AbstractRing(const AbstractRing &source) : AbstractGroup<T>(source) {m_mg.m_pRing = this;} + AbstractRing& operator=(const AbstractRing &source) {CRYTPOPP_UNUSED(source);return *this;} virtual bool IsUnit(const Element &a) const =0; virtual const Element& MultiplicativeIdentity() const =0; @@ -82,6 +82,16 @@ and getting me started with this manual. #include "config.h" #include "stdcpp.h" +// We can't include "misc.h" due to circular references.... +#define GCC_DIAGNOSTIC_AWARE_X ((__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)) || defined(__clang__)) + +#if GCC_DIAGNOSTIC_AWARE_X +# 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) // forward declarations @@ -1673,4 +1683,8 @@ typedef AuthenticatedKeyAgreementDomain PK_AuthenticatedKeyAgreementDomain; NAMESPACE_END +#if GCC_DIAGNOSTIC_AWARE_X +# pragma GCC diagnostic pop +#endif + #endif @@ -60,6 +60,7 @@ # 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) @@ -100,7 +100,8 @@ public: Element RandomElement( RandomNumberGenerator &rng , const RandomizationParameter &ignore_for_now = 0 ) const // left RandomizationParameter arg as ref in case RandomizationParameter becomes a more complicated struct - { + { + CRYPTOPP_UNUSED(ignore_for_now); return Element( rng , Integer( (long) 0) , m_modulus - Integer( (long) 1 ) ) ; } @@ -5,7 +5,13 @@ #include "config.h" #include "misc.h" -#include <assert.h> + +#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) @@ -142,13 +148,13 @@ public: pointer allocate(size_type n, const void * = NULL) { - assert(false); + CRYPTOPP_ASSERT(false); return NULL; } void deallocate(void *p, size_type n) { - assert(false); + CRYPTOPP_ASSERT(false); } size_type max_size() const {return 0;} @@ -167,7 +173,7 @@ public: pointer allocate(size_type n) { - assert(IsAlignedOn(m_array, 8)); + CRYPTOPP_ASSERT(IsAlignedOn(m_array, 8)); if (n <= S && !m_allocated) { @@ -193,8 +199,8 @@ public: { if (p == GetAlignedArray()) { - assert(n <= S); - assert(m_allocated); + CRYPTOPP_ASSERT(n <= S); + CRYPTOPP_ASSERT(m_allocated); m_allocated = false; SecureWipeArray((pointer)p, n); } @@ -206,7 +212,7 @@ public: { if (p == GetAlignedArray() && newSize <= S) { - assert(oldSize <= S); + CRYPTOPP_ASSERT(oldSize <= S); if (oldSize > newSize) SecureWipeArray(p+newSize, oldSize-newSize); return p; @@ -282,10 +288,10 @@ public: // {return m_ptr+offset;} // T& operator[](size_type index) -// {assert(index >= 0 && index < m_size); return m_ptr[index];} +// {CRYPTOPP_ASSERT(index >= 0 && index < m_size); return m_ptr[index];} // const T& operator[](size_type index) const -// {assert(index >= 0 && index < m_size); return m_ptr[index];} +// {CRYPTOPP_ASSERT(index >= 0 && index < m_size); return m_ptr[index];} iterator begin() {return m_ptr;} @@ -464,4 +470,8 @@ __stl_alloc_rebind(CryptoPP::AllocatorWithCleanup<_Tp1>& __a, const _Tp2*) NAMESPACE_END +#if GCC_DIAGNOSTIC_AWARE +# pragma GCC diagnostic pop +#endif + #endif @@ -9,6 +9,13 @@ #include "cryptlib.h" #include "misc.h" +#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) //! _ @@ -206,4 +213,8 @@ public: NAMESPACE_END +#if GCC_DIAGNOSTIC_AWARE +# pragma GCC diagnostic push +#endif + #endif |