summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornoloader <noloader@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2015-06-29 06:44:27 +0000
committernoloader <noloader@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2015-06-29 06:44:27 +0000
commitfd7959295b8abdd5bf744312cb2fe6278401a184 (patch)
tree391087f1e05121a6c2f64a0ea085459660a26550
parentd8e91d1b6e172e8126683ed6688b09e654c24556 (diff)
downloadcryptopp-fd7959295b8abdd5bf744312cb2fe6278401a184.tar.gz
Added GCC_DIAGNOSTIC_AWARE to help suppress some warnings on contemporary compilers. The macro was needed to help with managing old compilers, like GCC 4.2.1, present on OpenBSD
git-svn-id: svn://svn.code.sf.net/p/cryptopp/code/trunk/c5@555 57ff6487-cd31-0410-9ec3-f628ee90f5f0
-rw-r--r--algparam.h10
-rw-r--r--basecode.cpp5
-rw-r--r--config.h4
-rw-r--r--cryptlib.cpp5
-rw-r--r--default.cpp5
-rw-r--r--filters.cpp5
-rw-r--r--fipstest.cpp5
-rw-r--r--idea.cpp5
-rw-r--r--integer.cpp5
-rw-r--r--misc.h10
-rw-r--r--randpool.cpp5
-rw-r--r--wake.cpp5
12 files changed, 69 insertions, 0 deletions
diff --git a/algparam.h b/algparam.h
index 6a22740..44e0ff3 100644
--- a/algparam.h
+++ b/algparam.h
@@ -5,6 +5,12 @@
#include "smartptr.h"
#include "secblock.h"
+#if GCC_DIAGNOSTIC_AWARE
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wunused-value"
+# pragma GCC diagnostic ignored "-Wunused-variable"
+#endif
+
NAMESPACE_BEGIN(CryptoPP)
//! used to pass byte array input as part of a NameValuePairs object
@@ -396,4 +402,8 @@ AlgorithmParameters MakeParameters(const char *name, const T &value, bool throwI
NAMESPACE_END
+#if GCC_DIAGNOSTIC_AWARE
+# pragma GCC diagnostic pop
+#endif
+
#endif
diff --git a/basecode.cpp b/basecode.cpp
index 0c98b22..62f9ee8 100644
--- a/basecode.cpp
+++ b/basecode.cpp
@@ -8,6 +8,11 @@
#include "fltrimpl.h"
#include <ctype.h>
+#if GCC_DIAGNOSTIC_AWARE
+# pragma GCC diagnostic ignored "-Wunused-value"
+# pragma GCC diagnostic ignored "-Wunused-variable"
+#endif
+
NAMESPACE_BEGIN(CryptoPP)
void BaseN_Encoder::IsolatedInitialize(const NameValuePairs &parameters)
diff --git a/config.h b/config.h
index 77c34b9..41e2242 100644
--- a/config.h
+++ b/config.h
@@ -456,4 +456,8 @@ NAMESPACE_END
#define CRYPTOPP_STATIC_TEMPLATE_CLASS CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS
#endif
+// Used to supress some warnings in some header and implmentation files.
+// GCC_DIAGNOSTIC_AWARE is used because some platforms, like OpenBSD, use old compilers.
+#define GCC_DIAGNOSTIC_AWARE (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)) || defined(__clang__)
+
#endif
diff --git a/cryptlib.cpp b/cryptlib.cpp
index df138dd..a9ed290 100644
--- a/cryptlib.cpp
+++ b/cryptlib.cpp
@@ -16,6 +16,11 @@
#include <memory>
+#if GCC_DIAGNOSTIC_AWARE
+# pragma GCC diagnostic ignored "-Wunused-value"
+# pragma GCC diagnostic ignored "-Wunused-variable"
+#endif
+
NAMESPACE_BEGIN(CryptoPP)
CRYPTOPP_COMPILE_ASSERT(sizeof(byte) == 1);
diff --git a/default.cpp b/default.cpp
index 7294078..9af80f4 100644
--- a/default.cpp
+++ b/default.cpp
@@ -6,6 +6,11 @@
#include <time.h>
#include <memory>
+#if GCC_DIAGNOSTIC_AWARE
+# pragma GCC diagnostic ignored "-Wunused-value"
+# pragma GCC diagnostic ignored "-Wunused-variable"
+#endif
+
NAMESPACE_BEGIN(CryptoPP)
static const unsigned int MASH_ITERATIONS = 200;
diff --git a/filters.cpp b/filters.cpp
index 083dfd3..09f9a95 100644
--- a/filters.cpp
+++ b/filters.cpp
@@ -11,6 +11,11 @@
#include <memory>
#include <functional>
+#if GCC_DIAGNOSTIC_AWARE
+# pragma GCC diagnostic ignored "-Wunused-value"
+# pragma GCC diagnostic ignored "-Wunused-variable"
+#endif
+
NAMESPACE_BEGIN(CryptoPP)
Filter::Filter(BufferedTransformation *attachment)
diff --git a/fipstest.cpp b/fipstest.cpp
index e882742..edb75dc 100644
--- a/fipstest.cpp
+++ b/fipstest.cpp
@@ -23,6 +23,11 @@ extern "C" {_CRTIMP void __cdecl _CRT_DEBUGGER_HOOK(int);}
#include <iostream>
+#if GCC_DIAGNOSTIC_AWARE
+# pragma GCC diagnostic ignored "-Wunused-value"
+# pragma GCC diagnostic ignored "-Wunused-variable"
+#endif
+
NAMESPACE_BEGIN(CryptoPP)
extern PowerUpSelfTestStatus g_powerUpSelfTestStatus;
diff --git a/idea.cpp b/idea.cpp
index 793f912..3161978 100644
--- a/idea.cpp
+++ b/idea.cpp
@@ -4,6 +4,11 @@
#include "idea.h"
#include "misc.h"
+#if GCC_DIAGNOSTIC_AWARE
+# pragma GCC diagnostic ignored "-Wunused-value"
+# pragma GCC diagnostic ignored "-Wunused-variable"
+#endif
+
NAMESPACE_BEGIN(CryptoPP)
static const int IDEA_KEYLEN=(6*IDEA::ROUNDS+4); // key schedule length in # of word16s
diff --git a/integer.cpp b/integer.cpp
index f07cce8..23c176e 100644
--- a/integer.cpp
+++ b/integer.cpp
@@ -30,6 +30,11 @@
#pragma message("You do not seem to have the Visual C++ Processor Pack installed, so use of SSE2 instructions will be disabled.")
#endif
+#if GCC_DIAGNOSTIC_AWARE
+# pragma GCC diagnostic ignored "-Wunused-value"
+# pragma GCC diagnostic ignored "-Wunused-variable"
+#endif
+
#define CRYPTOPP_INTEGER_SSE2 (CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE && CRYPTOPP_BOOL_X86)
NAMESPACE_BEGIN(CryptoPP)
diff --git a/misc.h b/misc.h
index 1998d0b..009c26e 100644
--- a/misc.h
+++ b/misc.h
@@ -41,6 +41,12 @@
#include <byteswap.h>
#endif
+#if GCC_DIAGNOSTIC_AWARE
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wunused-value"
+# pragma GCC diagnostic ignored "-Wunused-variable"
+#endif
+
NAMESPACE_BEGIN(CryptoPP)
// ************** compile-time assertion ***************
@@ -1279,4 +1285,8 @@ inline T SafeLeftShift(T value)
NAMESPACE_END
+#if GCC_DIAGNOSTIC_AWARE
+# pragma GCC diagnostic pop
+#endif
+
#endif
diff --git a/randpool.cpp b/randpool.cpp
index a063c89..ea7db55 100644
--- a/randpool.cpp
+++ b/randpool.cpp
@@ -14,6 +14,11 @@
#include "hrtimer.h"
#include <time.h>
+#if GCC_DIAGNOSTIC_AWARE
+# pragma GCC diagnostic ignored "-Wunused-value"
+# pragma GCC diagnostic ignored "-Wunused-variable"
+#endif
+
NAMESPACE_BEGIN(CryptoPP)
RandomPool::RandomPool()
diff --git a/wake.cpp b/wake.cpp
index e0f194e..0fd8ca3 100644
--- a/wake.cpp
+++ b/wake.cpp
@@ -3,6 +3,11 @@
#include "pch.h"
#include "wake.h"
+#if GCC_DIAGNOSTIC_AWARE
+# pragma GCC diagnostic ignored "-Wunused-value"
+# pragma GCC diagnostic ignored "-Wunused-variable"
+#endif
+
NAMESPACE_BEGIN(CryptoPP)
void WAKE_TestInstantiations()