[U-Boot] [RFC 06/10] cc-option: make it work with clang

Jeroen Hofstee dasuboot at myspectrum.nl
Sat Jul 5 15:34:17 CEST 2014


Hello Masahiro,

On 10-06-14 10:39, Masahiro Yamada wrote:
> Hi Jeroen,
>
>
> On Sat, 31 May 2014 22:32:20 +0200
> Jeroen Hofstee <jeroen at myspectrum.nl> wrote:
>
>> By default clang will return echo a warning if an option is unknown.
>> Therefore turn warnings into errors when polling for options.
> As far as I tested with clang 3.5 on Ubuntu 14.04,
> it looks different.
>
> $ clang -fno-delete-null-pointer-checks  helloworld.c
> clang: error: unknown argument: '-fno-delete-null-pointer-checks'
> $ echo $?
> 1

Yes it seems to be restricted to warning options. The -Werror=date-time
causes a lot of noise e.g. when building with clang 3.4. With 3.5 this 
option
seems to be added, but behavior for unrecognized warnings flags remained
the same, see below.

Regards,
Jeroen

[jeroen at freebsd /usr/home/jeroen]$ clang -v
FreeBSD clang version 3.4.1 (tags/RELEASE_34/dot1-final 208032) 20140512
Target: x86_64-unknown-freebsd11.0
Thread model: posix
Selected GCC installation:
[jeroen at freebsd /usr/home/jeroen]$ clang -Werror=date-time a.c
warning: unknown warning option '-Werror=date-time' 
[-Wunknown-warning-option]
1 warning generated.
[jeroen at freebsd /usr/home/jeroen]$ echo $?
0
[jeroen at freebsd /usr/home/jeroen]$ clang -Werror -Werror=date-time a.c
error: unknown warning option '-Werror=date-time' 
[-Werror,-Wunknown-warning-option]
[jeroen at freebsd /usr/home/jeroen]$ echo $?
1

jeroen at yellow:~$ clang -v
clang version 3.5.0 (git at github.com:jhofstee/clang.git 
f533fd477a50467a0d96293d116f4059aa806b65) 
(git at github.com:jhofstee/llvm.git 6b7ff6be9c1bcf8ce440c7f1c7646fbf059562e4)
Target: x86_64-unknown-linux-gnu
Thread model: posix
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.8.1
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.1
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Candidate multilib: .;@m64
Selected multilib: .;@m64
jeroen at yellow:~$ clang -Werror=date-time a.c
jeroen at yellow:~$ clang -Werror=date-time-newer a.c
warning: unknown warning option '-Werror=date-time-newer'; did you mean 
'-Werror=date-time'? [-Wunknown-warning-option]
1 warning generated.
jeroen at yellow:~$ echo $?
0
jeroen at yellow:~$ clang -Werror -Werror=date-time-newer a.c
error: unknown warning option '-Werror=date-time-newer'; did you mean 
'-Werror=date-time'? [-Werror,-Wunknown-warning-option]
jeroen at yellow:~$ echo $?
1


More information about the U-Boot mailing list