From a3dd9e3d2f1bb55b60b9431298fd7d05e4cabcde Mon Sep 17 00:00:00 2001 From: Ka Ho Ng Date: Sat, 24 Apr 2021 02:32:13 +0800 Subject: [PATCH] common: Fix FreeBSD compilation when doing gmake _GNU_SOURCE is not for FreeBSD and defining it unconditionally lead to conflicts with -Wunused-macros. Wrap _GNU_SOURCE with !defined(__FreeBSD__) for now. For src/core/util_posix.c, includes signal.h also. --- src/common/file_posix.c | 2 ++ src/common/os_deep_linux.c | 2 ++ src/common/set.c | 2 +- src/common/set_badblocks.c | 2 ++ src/core/os_posix.c | 2 ++ src/core/os_thread_posix.c | 2 ++ src/core/util_posix.c | 1 + src/libpmemobj/lane.c | 2 +- 8 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/common/file_posix.c b/src/common/file_posix.c index 334f356747c..580604f7fab 100644 --- a/src/common/file_posix.c +++ b/src/common/file_posix.c @@ -5,8 +5,10 @@ * file_posix.c -- Posix versions of file APIs */ +#ifndef __FreeBSD__ /* for O_TMPFILE */ #define _GNU_SOURCE +#endif #include #include diff --git a/src/common/os_deep_linux.c b/src/common/os_deep_linux.c index 03599e50e09..7d63c77d4bc 100644 --- a/src/common/os_deep_linux.c +++ b/src/common/os_deep_linux.c @@ -5,7 +5,9 @@ * os_deep_linux.c -- Linux abstraction layer */ +#ifndef __FreeBSD__ #define _GNU_SOURCE +#endif #include #include diff --git a/src/common/set.c b/src/common/set.c index e3f8b6f63f8..f819515aad0 100644 --- a/src/common/set.c +++ b/src/common/set.c @@ -36,7 +36,7 @@ * set.c -- pool set utilities */ -#ifndef _GNU_SOURCE +#if !defined(_GNU_SOURCE) && !defined(__FreeBSD__) #define _GNU_SOURCE #endif diff --git a/src/common/set_badblocks.c b/src/common/set_badblocks.c index 1ee9687c3f5..b251df49b7f 100644 --- a/src/common/set_badblocks.c +++ b/src/common/set_badblocks.c @@ -4,7 +4,9 @@ /* * set_badblocks.c - common part of implementation of bad blocks API */ +#ifndef __FreeBSD__ #define _GNU_SOURCE +#endif #include #include diff --git a/src/core/os_posix.c b/src/core/os_posix.c index 485e8fb3f84..cd5173aeaf3 100644 --- a/src/core/os_posix.c +++ b/src/core/os_posix.c @@ -5,7 +5,9 @@ * os_posix.c -- abstraction layer for basic Posix functions */ +#ifndef __FreeBSD__ #define _GNU_SOURCE +#endif #include #include diff --git a/src/core/os_thread_posix.c b/src/core/os_thread_posix.c index 2d9b83b3cfb..166b574d2cd 100644 --- a/src/core/os_thread_posix.c +++ b/src/core/os_thread_posix.c @@ -5,7 +5,9 @@ * os_thread_posix.c -- Posix thread abstraction layer */ +#ifndef __FreeBSD__ #define _GNU_SOURCE +#endif #include #ifdef __FreeBSD__ #include diff --git a/src/core/util_posix.c b/src/core/util_posix.c index c8f6ccdf9ad..32029ca3f50 100644 --- a/src/core/util_posix.c +++ b/src/core/util_posix.c @@ -6,6 +6,7 @@ */ #include +#include #include #include #include diff --git a/src/libpmemobj/lane.c b/src/libpmemobj/lane.c index 350da814aa4..1c4c62cf61a 100644 --- a/src/libpmemobj/lane.c +++ b/src/libpmemobj/lane.c @@ -5,7 +5,7 @@ * lane.c -- lane implementation */ -#ifndef _GNU_SOURCE +#if !defined(_GNU_SOURCE) && !defined(__FreeBSD__) #define _GNU_SOURCE #endif