bug-gnulib
[Top][All Lists]
Advanced

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

Re: improve clang support (20)


From: Bruno Haible
Subject: Re: improve clang support (20)
Date: Tue, 11 Aug 2020 19:30:05 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-186-generic; KDE/5.18.0; x86_64; ; )

Hi Gisle,

> Good work on the clang support, but it looks like you have not
> tried clang-cl with the Microsoft 'Windows-Kit' headers.

I'm using the 'clang' program with the Microsoft 'Windows-Kit' headers.
As I wrote in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-08/msg00038.html>,
the 'clang-cl' program just provides different command-line options.

> For most of the 'tests/test-std*.c' programs to
> work, one has to add '-D_CRT_USE_BUILTIN_OFFSETOF' to the CFLAGS.

With the MSVC 14 (2015) headers that I have, a testdir produced by
$ ./gnulib-tool --create-testdir --dir=../testdir --single-configure stddef 
stdbool
builds fine and passes all tests.

> 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'

For me, clang uses the stddef.h from
C:\Program Files\LLVM\lib\clang\4.0.0\include\stddef.h
(or similarly for the other versions).
Did you download and install the entire package of Windows binaries from
https://releases.llvm.org/ ?

> 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;
>       ^   ~~

Seems to be related:
It shouldn't say 'signed char' if it was using clang's genuine <stdbool.h>,
because that file defines bool as '_Bool', not as 'signed char'.

Bruno




reply via email to

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