summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--algebra.h5
-rw-r--r--cryptlib.h14
-rw-r--r--misc.h1
-rw-r--r--modarith.h3
-rw-r--r--secblock.h28
-rw-r--r--simple.h11
6 files changed, 50 insertions, 12 deletions
diff --git a/algebra.h b/algebra.h
index 13038bd8..ffa660a7 100644
--- a/algebra.h
+++ b/algebra.h
@@ -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;
diff --git a/cryptlib.h b/cryptlib.h
index 89d52bab..93a2015a 100644
--- a/cryptlib.h
+++ b/cryptlib.h
@@ -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
diff --git a/misc.h b/misc.h
index 0349324f..f478f563 100644
--- a/misc.h
+++ b/misc.h
@@ -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)
diff --git a/modarith.h b/modarith.h
index 0911f027..a03790df 100644
--- a/modarith.h
+++ b/modarith.h
@@ -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 ) ) ;
}
diff --git a/secblock.h b/secblock.h
index 40cce334..39d0c913 100644
--- a/secblock.h
+++ b/secblock.h
@@ -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
diff --git a/simple.h b/simple.h
index 35fd65ae..926ae5f6 100644
--- a/simple.h
+++ b/simple.h
@@ -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