Skip to content

Commit 39bfcdf

Browse files
Patrick Thomsonmaxbrunsfeld
authored andcommitted
Fix build with MinGW tooling. (tree-sitter#514)
Courtesy of @Eli-Zaretskii, these fixes should unblock people from building tree-sitter with MinGW. I don't think this is an unreasonable maintenance burden, especially given the Emacs project's interest in using tree-sitter, but @maxbrunsfeld gets the final call.
1 parent 9a73277 commit 39bfcdf

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

lib/src/atomic.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ static inline size_t atomic_load(const volatile size_t *p) {
1212
}
1313

1414
static inline uint32_t atomic_inc(volatile uint32_t *p) {
15-
return InterlockedIncrement(p);
15+
return InterlockedIncrement((long volatile *)p);
1616
}
1717

1818
static inline uint32_t atomic_dec(volatile uint32_t *p) {
19-
return InterlockedDecrement(p);
19+
return InterlockedDecrement((long volatile *)p);
2020
}
2121

2222
#else

lib/src/bits.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ static inline uint32_t bitmask_for_index(uint16_t id) {
77
return (1u << (31 - id));
88
}
99

10-
#ifdef _WIN32
10+
#if defined _WIN32 && !defined __GNUC__
1111

1212
#include <intrin.h>
1313

lib/src/stack.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#define MAX_NODE_POOL_SIZE 50
1212
#define MAX_ITERATOR_COUNT 64
1313

14-
#ifdef _WIN32
14+
#if defined _WIN32 && !defined __GNUC__
1515
#define inline __forceinline
1616
#else
1717
#define inline static inline __attribute__((always_inline))

script/build-lib

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ fi
1010
${CC} \
1111
-c \
1212
-O3 \
13-
-std=c99 \
13+
-std=gnu99 \
1414
$CFLAGS \
1515
-I lib/src \
1616
-I lib/include \

0 commit comments

Comments
 (0)