[U-Boot] [PATCH 1/4] Kbuild: support W=[N, ]err for passing '-Werror' to the compiler

Daniel Schwierzeck daniel.schwierzeck at gmail.com
Fri Jan 26 13:30:09 UTC 2018


Hi Masahiro,

On 26.01.2018 02:09, Masahiro Yamada wrote:
> Hi Daniel,
> 
> 
> 2018-01-26 2:21 GMT+09:00 Daniel Schwierzeck <daniel.schwierzeck at gmail.com>:
>> Extend the Kbuild's W=N option with an optional 'err' value. This
>> will pass -Werror to the compiler to treat all warnings as errors.
>> This is useful to enforce a zero-warnings policy.
>>
>> The 'err' value can also be combined with the numerical values
>> like this:
>>
>>     make W=1
>>     make W=err
>>     make W=1,err
>>
>> Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck at gmail.com>
>> ---
>>
>>  scripts/Makefile.extrawarn | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
>> index 1d3a570594..d8d93b7fe1 100644
>> --- a/scripts/Makefile.extrawarn
>> +++ b/scripts/Makefile.extrawarn
>> @@ -48,9 +48,12 @@ warning-3 += -Wswitch-default
>>  warning-3 += $(call cc-option, -Wpacked-bitfield-compat)
>>  warning-3 += $(call cc-option, -Wvla)
>>
>> +warning-err := -Werror
>> +
>>  warning := $(warning-$(findstring 1, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)))
>>  warning += $(warning-$(findstring 2, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)))
>>  warning += $(warning-$(findstring 3, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)))
>> +warning += $(warning-$(findstring err, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)))
>>
>>  ifeq ("$(strip $(warning))","")
>>          $(error W=$(KBUILD_ENABLE_EXTRA_GCC_CHECKS) is unknown)
>> --
>> 2.16.1
> 
> 
> I saw a similar patch before in linux-kbuild ML.
> 
> 
> Kbuild provides a way to specify user-specific options.
> See the following lines in the top-level Makefile:
> 
> 
>   # Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments
>   KBUILD_CPPFLAGS += $(KCPPFLAGS)
>   KBUILD_AFLAGS += $(KAFLAGS)
>   KBUILD_CFLAGS += $(KCFLAGS)
> 
> 
> 
> "make W=err" is a shorthand of "make KCFLAGS=-Werror", right?
> 
> I tend to hesitate to add another way
> to do the same thing...
> 

I didn't noticed that possibility, thanks for the pointer. I'll withdraw
this patch and add a short pointer in the README instead.

-- 
- Daniel

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180126/b4535051/attachment.sig>


More information about the U-Boot mailing list