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

This commit is contained in:
Jeffrey Walton 2015-06-29 02:09:02 -04:00
parent 44a5c2c860
commit a14a5696e1
12 changed files with 69 additions and 0 deletions

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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);

View File

@ -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;

View File

@ -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)

View File

@ -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;

View File

@ -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

View File

@ -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)

10
misc.h
View File

@ -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

View File

@ -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()

View File

@ -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()