Skip to content

Commit 5311904

Browse files
0-wiz-0amaanq
authored andcommitted
build: fix compilation on NetBSD a different way
1 parent 60b76c7 commit 5311904

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

lib/src/portable/endian.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,20 @@
1818
#if defined(HAVE_ENDIAN_H) || \
1919
defined(__linux__) || \
2020
defined(__GNU__) || \
21+
defined(__NetBSD__) || \
2122
defined(__OpenBSD__) || \
2223
defined(__CYGWIN__) || \
2324
defined(__MSYS__) || \
2425
defined(__EMSCRIPTEN__)
2526

27+
#if defined(__NetBSD__)
28+
#define _NETBSD_SOURCE 1
29+
#endif
30+
2631
# include <endian.h>
2732

2833
#elif defined(HAVE_SYS_ENDIAN_H) || \
2934
defined(__FreeBSD__) || \
30-
defined(__NetBSD__) || \
3135
defined(__DragonFly__)
3236

3337
# include <sys/endian.h>

lib/src/query.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
#if defined(__NetBSD__) && defined(_POSIX_C_SOURCE)
2+
#undef _POSIX_C_SOURCE
3+
#endif
4+
15
#include "tree_sitter/api.h"
26
#include "./alloc.h"
37
#include "./array.h"

0 commit comments

Comments
 (0)