From f8155f0b945c5cfb3600d7c146a5d86870ed09d2 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Tue, 8 Oct 2024 03:51:44 +0200 Subject: Run various C versions in the CI --- tests/Makefile | 5 ++++- tests/common.h | 3 +++ tests/test_compile.c | 2 +- tests/test_fread_overwrite_dynamic.c | 3 +-- tests/test_fread_overwrite_static.c | 3 +-- tests/test_fwrite_overwrite_dynamic.c | 3 +-- tests/test_fwrite_overwrite_static.c | 3 +-- tests/test_getdomainname_dynamic.c | 5 +++-- tests/test_getdomainname_static.c | 5 +++-- tests/test_mbstowcs_dynamic.c | 2 +- tests/test_mbstowcs_static.c | 2 +- 11 files changed, 20 insertions(+), 16 deletions(-) (limited to 'tests') diff --git a/tests/Makefile b/tests/Makefile index 333f088..a8c7ac5 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -159,7 +159,10 @@ clang: CFLAGS+=-I../x86_64-linux-musl-native/include/ clang: CFLAGS+=-Ix86_64-linux-musl-native/include/ clang: CFLAGS+=-nostdinc clang: CXX=clang++ -clang: CXXFLAGS=$(CFLAGS) +clang: CXXFLAGS+=-I/usr/include/x86_64-linux-musl +clang: CXXFLAGS+=-I../x86_64-linux-musl-native/include/ +clang: CXXFLAGS+=-Ix86_64-linux-musl-native/include/ +clang: CXXFLAGS+=-nostdinc clang: comptime $(RUNTIME_TARGETS) cpp coverage: CFLAGS += -fprofile-arcs -ftest-coverage diff --git a/tests/common.h b/tests/common.h index 4c34862..6a30739 100644 --- a/tests/common.h +++ b/tests/common.h @@ -15,6 +15,9 @@ License along with the GNU C Library; if not, see . */ +#define _POSIX_C_SOURCE 1 +#define _XOPEN_SOURCE 700 + #include #include #include diff --git a/tests/test_compile.c b/tests/test_compile.c index edbbb27..b794306 100644 --- a/tests/test_compile.c +++ b/tests/test_compile.c @@ -12,7 +12,7 @@ #include #include -// Check that all headers are compiling. +/* Check that all headers are compiling.*/ int main(int argc, char** argv) { return 0; } diff --git a/tests/test_fread_overwrite_dynamic.c b/tests/test_fread_overwrite_dynamic.c index 74953d6..b108dc5 100644 --- a/tests/test_fread_overwrite_dynamic.c +++ b/tests/test_fread_overwrite_dynamic.c @@ -1,7 +1,6 @@ -#include - #include "common.h" +#include #include int main(int argc, char** argv) { diff --git a/tests/test_fread_overwrite_static.c b/tests/test_fread_overwrite_static.c index e9de2ce..16a5e30 100644 --- a/tests/test_fread_overwrite_static.c +++ b/tests/test_fread_overwrite_static.c @@ -1,7 +1,6 @@ -#include - #include "common.h" +#include #include int main(int argc, char** argv) { diff --git a/tests/test_fwrite_overwrite_dynamic.c b/tests/test_fwrite_overwrite_dynamic.c index a7f2b1b..7da64ab 100644 --- a/tests/test_fwrite_overwrite_dynamic.c +++ b/tests/test_fwrite_overwrite_dynamic.c @@ -1,7 +1,6 @@ -#include - #include "common.h" +#include #include int main(int argc, char** argv) { diff --git a/tests/test_fwrite_overwrite_static.c b/tests/test_fwrite_overwrite_static.c index 492fb47..f844af8 100644 --- a/tests/test_fwrite_overwrite_static.c +++ b/tests/test_fwrite_overwrite_static.c @@ -1,7 +1,6 @@ -#include - #include "common.h" +#include #include int main(int argc, char** argv) { diff --git a/tests/test_getdomainname_dynamic.c b/tests/test_getdomainname_dynamic.c index a7882ba..3c15b8e 100644 --- a/tests/test_getdomainname_dynamic.c +++ b/tests/test_getdomainname_dynamic.c @@ -1,6 +1,7 @@ -#include "common.h" - #define _GNU_SOURCE +#define _DEFAULT_SOURCE + +#include "common.h" #include diff --git a/tests/test_getdomainname_static.c b/tests/test_getdomainname_static.c index a7671c4..478a274 100644 --- a/tests/test_getdomainname_static.c +++ b/tests/test_getdomainname_static.c @@ -1,6 +1,7 @@ -#include "common.h" - #define _GNU_SOURCE +#define _DEFAULT_SOURCE + +#include "common.h" #include diff --git a/tests/test_mbstowcs_dynamic.c b/tests/test_mbstowcs_dynamic.c index 1465bfd..fd02ed9 100644 --- a/tests/test_mbstowcs_dynamic.c +++ b/tests/test_mbstowcs_dynamic.c @@ -3,7 +3,7 @@ #include int main(int argc, char** argv) { - const char* mbstr = "z\u00df\u6c34\U0001f34c"; // or u8"zß水🍌" + const char* mbstr = "z\u00df\u6c34\U0001f34c"; /* or u8"zß水🍌" */ wchar_t wstr[5]; mbstowcs(wstr, mbstr, 4); diff --git a/tests/test_mbstowcs_static.c b/tests/test_mbstowcs_static.c index a15c4d6..847fcf7 100644 --- a/tests/test_mbstowcs_static.c +++ b/tests/test_mbstowcs_static.c @@ -3,7 +3,7 @@ #include int main(int argc, char** argv) { - const char* mbstr = "z\u00df\u6c34\U0001f34c"; // or u8"zß水🍌" + const char* mbstr = "z\u00df\u6c34\U0001f34c"; /* or u8"zß水🍌" */ wchar_t wstr[5]; mbstowcs(wstr, mbstr, 4); -- cgit v1.3