build: do not define _POSIX_C_SOURCE on NetBSD (#4196)

It leads to missing symbols, see #4180.

(cherry picked from commit 2bf04d1f04)

---------

Co-authored-by: Thomas Klausner <wiz@gatalith.at>
This commit is contained in:
tree-sitter-ci-bot[bot] 2025-03-02 23:46:23 +01:00 committed by GitHub
parent 781dc0570d
commit 6f2dbaab5f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 14 additions and 1 deletions

View file

@ -18,16 +18,20 @@
#if defined(HAVE_ENDIAN_H) || \
defined(__linux__) || \
defined(__GNU__) || \
defined(__NetBSD__) || \
defined(__OpenBSD__) || \
defined(__CYGWIN__) || \
defined(__MSYS__) || \
defined(__EMSCRIPTEN__)
#if defined(__NetBSD__)
#define _NETBSD_SOURCE 1
#endif
# include <endian.h>
#elif defined(HAVE_SYS_ENDIAN_H) || \
defined(__FreeBSD__) || \
defined(__NetBSD__) || \
defined(__DragonFly__)
# include <sys/endian.h>

View file

@ -1,3 +1,12 @@
/*
* On NetBSD, defining standard requirements like this removes symbols
* from the namespace; however, we need non-standard symbols for
* endian.h.
*/
#if defined(__NetBSD__) && defined(_POSIX_C_SOURCE)
#undef _POSIX_C_SOURCE
#endif
#include "tree_sitter/api.h"
#include "./alloc.h"
#include "./array.h"