From 3945f27f6d4fd7bcc803ff4a36fc5db239ce2eac Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Tue, 12 Apr 2016 23:52:34 +0100 Subject: [PATCH] Problem: pragma diagnostic is new in GCC 4.2 Solution: check for GCC version before using pragma diagnostic in tweetnacl to avoid an additional warning. --- tweetnacl/contrib/randombytes/randombytes.h | 2 +- tweetnacl/src/tweetnacl_base.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tweetnacl/contrib/randombytes/randombytes.h b/tweetnacl/contrib/randombytes/randombytes.h index d724f4a2..68407d3e 100644 --- a/tweetnacl/contrib/randombytes/randombytes.h +++ b/tweetnacl/contrib/randombytes/randombytes.h @@ -11,7 +11,7 @@ Public domain. Disable warnings for this source only, rather than for the whole codebase when building with C99 or with Microsoft's compiler */ -#if defined __GNUC__ && __STDC_VERSION__ < 201112L +#if defined __GNUC__ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2)) && __STDC_VERSION__ < 201112L # pragma GCC diagnostic ignored "-Wsign-compare" #elif defined _MSC_VER # pragma warning (disable:4018 4244 4146) diff --git a/tweetnacl/src/tweetnacl_base.h b/tweetnacl/src/tweetnacl_base.h index 42b99726..7d38af8f 100644 --- a/tweetnacl/src/tweetnacl_base.h +++ b/tweetnacl/src/tweetnacl_base.h @@ -5,7 +5,7 @@ Disable warnings for this source only, rather than for the whole codebase when building with C99 or with Microsoft's compiler */ -#if defined __GNUC__ && __STDC_VERSION__ < 201112L +#if defined __GNUC__ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2)) && __STDC_VERSION__ < 201112L # pragma GCC diagnostic ignored "-Wsign-compare" #elif defined _MSC_VER # pragma warning (disable:4018 4244 4146)