bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: improve clang support (20)


From: Gisle Vanem
Subject: Re: improve clang support (20)
Date: Mon, 10 Aug 2020 11:24:36 +0200
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]