commit 8848bca36ef19c15b071939e69bec77603d64ca1
parent fe149628eaae9748be08815d726cc56e8e492c73
Author: jvoisin <julien.voisin@dustri.org>
Date: Sun, 25 Jun 2023 18:35:23 +0200
Fix clang support
Diffstat:
3 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/include/fortify-headers.h b/include/fortify-headers.h
@@ -52,6 +52,8 @@
#if defined __has_attribute && __has_attribute (access)
#define __access(...) __attribute__ ((access (__VA_ARGS__)))
+#else
+#define __access(...)
#endif
#endif
diff --git a/tests/Makefile b/tests/Makefile
@@ -1,5 +1,3 @@
-CC=../x86_64-linux-musl-native/bin/gcc
-GCOV=../x86_64-linux-musl-native/bin/gcov
CFLAGS=-I../include/ -D_FORTIFY_SOURCE=3 -static -O2
TARGETS= \
@@ -36,7 +34,18 @@ TARGETS= \
test_poll \
test_ppoll \
-.SILENT:
+#.SILENT:
+
+gcc: CC=../x86_64-linux-musl-native/bin/gcc
+gcc: GCOV=../x86_64-linux-musl-native/bin/gcov
+gcc: clean all
+
+clang: CC=clang
+clang: GCOV=gcov
+clang: CFLAGS+=-I/usr/include/x86_64-linux-musl
+clang: CLFAGS+=-nostdlib
+clang: clean all
+
all: $(TARGETS) run
@@ -51,7 +60,7 @@ $(TARGETS): %: %.c
run: $(TARGETS)
$(foreach EXE, $(TARGETS), \
- ./$(EXE) 1 2 3 4 5 6 7 8 9 0 >/dev/null && echo "$(EXE) OK" || echo "$(EXE) FAIL" ; \
+ timeout 1s ./$(EXE) 1 2 3 4 5 6 7 8 9 0 >/dev/null && echo "$(EXE) OK" || echo "$(EXE) FAIL" ; \
)
clean:
diff --git a/tests/test_poll.c b/tests/test_poll.c
@@ -6,7 +6,7 @@ int main(int argc, char** argv) {
struct pollfd buffer[12] = {0};
CHK_FAIL_START
- poll(buffer, 14, NULL);
+ poll(buffer, 14, 0);
CHK_FAIL_END
puts(buffer);