logo

utils-std

Collection of commonly available Unix tools git clone https://anongit.hacktivis.me/git/utils-std.git/
commit: 7bc999d45c85a71ce760362f6c5e8a052efcc7d8
parent 3bf87210e4c41efda09e5059320e5f4eed9c214d
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Tue, 24 Dec 2024 00:22:14 +0100

lib/reallocarray.h: FreeBSD now wants _POSIX_C_SOURCE undefined

_BSD_VISIBLE is probably one of the worst macros in BSDs…

Diffstat:

Mlib/reallocarray.h2++
Mlib/tr_str.c6+++++-
2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/lib/reallocarray.h b/lib/reallocarray.h @@ -9,6 +9,8 @@ // pre-POSIX.1-2024 reallocarray fallback #if !defined(_POSIX_VERSION) || _POSIX_VERSION < 202405L #define _BSD_SOURCE +// FreeBSD +#undef _POSIX_C_SOURCE #if __NetBSD_Version__ < 1000000000 #define _OPENBSD_SOURCE #endif diff --git a/lib/tr_str.c b/lib/tr_str.c @@ -31,11 +31,15 @@ * SUCH DAMAGE. */ +// clang-format off #define _POSIX_C_SOURCE 202405L +// Needs to be the first included header due to this horrible BSD_VISIBLE macro +#include "./reallocarray.h" + #include "./tr_str.h" +// clang-format on #include "./err.h" -#include "./reallocarray.h" #include <assert.h> #include <ctype.h>