From 8848bca36ef19c15b071939e69bec77603d64ca1 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Sun, 25 Jun 2023 18:35:23 +0200 Subject: Fix clang support --- include/fortify-headers.h | 2 ++ tests/Makefile | 17 +++++++++++++---- tests/test_poll.c | 2 +- 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 @@ #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 index ee43a93..48374bf 100644 --- 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 index 397aa3d..06237aa 100644 --- 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); -- cgit v1.3