From 69f3470538981b4884c6ac40f83c80f83d5a5f82 Mon Sep 17 00:00:00 2001 From: "nilesh.kale" Date: Tue, 2 Apr 2024 18:10:39 +0530 Subject: [PATCH] Fixed issue of redefination warning messages for _GNU_SOURCE This commit addresses redefinition warning messages encountered during compilation by adding a pre-check before declaring _GNU_SOURCE. --- library/entropy_poll.c | 4 +++- library/sha256.c | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/library/entropy_poll.c b/library/entropy_poll.c index 794ee03a8..611768cd8 100644 --- a/library/entropy_poll.c +++ b/library/entropy_poll.c @@ -5,10 +5,12 @@ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ -#if defined(__linux__) || defined(__midipix__) && !defined(_GNU_SOURCE) +#if defined(__linux__) || defined(__midipix__) /* Ensure that syscall() is available even when compiling with -std=c99 */ +#if !defined(_GNU_SOURCE) #define _GNU_SOURCE #endif +#endif #include "common.h" diff --git a/library/sha256.c b/library/sha256.c index 87889817a..8b2c34526 100644 --- a/library/sha256.c +++ b/library/sha256.c @@ -44,7 +44,9 @@ #endif /* defined(__clang__) && (__clang_major__ >= 4) */ /* Ensure that SIG_SETMASK is defined when -std=c99 is used. */ +#if !defined(_GNU_SOURCE) #define _GNU_SOURCE +#endif #include "common.h"