summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjvoisin2023-06-25 18:35:23 +0200
committerjvoisin2023-06-25 18:35:23 +0200
commit8848bca36ef19c15b071939e69bec77603d64ca1 (patch)
tree2c51874ecfaadaa319eee7c0927c7d5f184c7e5d
parentfe149628eaae9748be08815d726cc56e8e492c73 (diff)
Fix clang support
-rw-r--r--include/fortify-headers.h2
-rw-r--r--tests/Makefile17
-rw-r--r--tests/test_poll.c2
3 files changed, 16 insertions, 5 deletions
diff --git a/include/fortify-headers.h b/include/fortify-headers.h
index 42c8317..6ab5e74 100644
--- a/include/fortify-headers.h
+++ b/include/fortify-headers.h
@@ -52,6 +52,8 @@
52 52
53#if defined __has_attribute && __has_attribute (access) 53#if defined __has_attribute && __has_attribute (access)
54#define __access(...) __attribute__ ((access (__VA_ARGS__))) 54#define __access(...) __attribute__ ((access (__VA_ARGS__)))
55#else
56#define __access(...)
55#endif 57#endif
56 58
57#endif 59#endif
diff --git a/tests/Makefile b/tests/Makefile
index ee43a93..48374bf 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -1,5 +1,3 @@
1CC=../x86_64-linux-musl-native/bin/gcc
2GCOV=../x86_64-linux-musl-native/bin/gcov
3CFLAGS=-I../include/ -D_FORTIFY_SOURCE=3 -static -O2 1CFLAGS=-I../include/ -D_FORTIFY_SOURCE=3 -static -O2
4 2
5TARGETS= \ 3TARGETS= \
@@ -36,7 +34,18 @@ TARGETS= \
36 test_poll \ 34 test_poll \
37 test_ppoll \ 35 test_ppoll \
38 36
39.SILENT: 37#.SILENT:
38
39gcc: CC=../x86_64-linux-musl-native/bin/gcc
40gcc: GCOV=../x86_64-linux-musl-native/bin/gcov
41gcc: clean all
42
43clang: CC=clang
44clang: GCOV=gcov
45clang: CFLAGS+=-I/usr/include/x86_64-linux-musl
46clang: CLFAGS+=-nostdlib
47clang: clean all
48
40 49
41all: $(TARGETS) run 50all: $(TARGETS) run
42 51
@@ -51,7 +60,7 @@ $(TARGETS): %: %.c
51 60
52run: $(TARGETS) 61run: $(TARGETS)
53 $(foreach EXE, $(TARGETS), \ 62 $(foreach EXE, $(TARGETS), \
54 ./$(EXE) 1 2 3 4 5 6 7 8 9 0 >/dev/null && echo "$(EXE) OK" || echo "$(EXE) FAIL" ; \ 63 timeout 1s ./$(EXE) 1 2 3 4 5 6 7 8 9 0 >/dev/null && echo "$(EXE) OK" || echo "$(EXE) FAIL" ; \
55 ) 64 )
56 65
57clean: 66clean:
diff --git a/tests/test_poll.c b/tests/test_poll.c
index 397aa3d..06237aa 100644
--- a/tests/test_poll.c
+++ b/tests/test_poll.c
@@ -6,7 +6,7 @@ int main(int argc, char** argv) {
6 struct pollfd buffer[12] = {0}; 6 struct pollfd buffer[12] = {0};
7 7
8 CHK_FAIL_START 8 CHK_FAIL_START
9 poll(buffer, 14, NULL); 9 poll(buffer, 14, 0);
10 CHK_FAIL_END 10 CHK_FAIL_END
11 11
12 puts(buffer); 12 puts(buffer);