Bruno Haible wrote:
When building a testdir of all of gnulib with clang 9 on a glibc system, I see these compilation errors:
Good work on the clang support, but it looks like you have not tried clang-cl with the Microsoft 'Windows-Kit' headers. Microsoft added support for 'clang/clang-cl' in it's headers some time ago. For most of the 'tests/test-std*.c' programs to work, one has to add '-D_CRT_USE_BUILTIN_OFFSETOF' to the CFLAGS. I fail to see where/how the 'm4' macros does that. If not using '-D_CRT_USE_BUILTIN_OFFSETOF', there are all kinds of errors occurs. Like: test-stddef.c(47,9): error: static_assert expression is not an integral constant expression verify (offsetof (struct d, f) == 1); ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~ f:/ProgramFiler-x86/WindowsKits/include/10.0.19041.0/ucrt/stddef.h(49,31): note: expanded from macro 'offsetof' #define offsetof(s,m) ((size_t)&(((s*)0)->m)) ^ ../lib\verify.h(283,32): note: expanded from macro 'verify' # define verify(R) _GL_VERIFY (R, "verify (" #R ")", -) ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ ../lib\verify.h(216,57): note: expanded from macro '_GL_VERIFY' # define _GL_VERIFY(R, DIAGNOSTIC, ...) _Static_assert (R, DIAGNOSTIC) ^ test-stddef.c(47,9): note: cast that performs the conversions of a reinterpret_cast is not allowed in a constant expression f:/ProgramFiler-x86/WindowsKits/include/10.0.19041.0/ucrt/stddef.h(49,32): note: expanded from macro 'offsetof' #define offsetof(s,m) ((size_t)&(((s*)0)->m)) ^ ------------- But (unrelated to the above) I still get this error: test-stdbool.c(67,8): error: 'd' declared as an array with a negative size char d[(bool) 0.5 == true ? 1 : -1]; ^~~~~~~~~~~~~~~~~~~~~~~~~~~ test-stdbool.c(73,6): warning: incompatible pointer to integer conversion initializing 'signed char' with an expression of type 'struct s *' [-Wint-conversion] bool e = &s; ^ ~~ test-stdbool.c(73,10): error: initializer element is not a compile-time constant bool e = &s; ^~ 'test-stdbool.c' compiles fine with MSVC-2019 (?!) -- --gv