All of lore.kernel.org
 help / color / mirror / Atom feed
From: Masahiro Yamada <yamada.masahiro@socionext.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/4] Kbuild: support W=[N, ]err for passing '-Werror' to the compiler
Date: Fri, 26 Jan 2018 10:09:57 +0900	[thread overview]
Message-ID: <CAK7LNAR_wdpQVbQYT0RQhXYR9TcKqmCfwNMwkMb0oFKzzoNFHA@mail.gmail.com> (raw)
In-Reply-To: <20180125172127.17825-2-daniel.schwierzeck@gmail.com>

Hi Daniel,


2018-01-26 2:21 GMT+09:00 Daniel Schwierzeck <daniel.schwierzeck@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@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...



-- 
Best Regards
Masahiro Yamada

  reply	other threads:[~2018-01-26  1:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-25 17:21 [U-Boot] [PATCH 0/4] Add support for treating compiler warnings as errors Daniel Schwierzeck
2018-01-25 17:21 ` [U-Boot] [PATCH 1/4] Kbuild: support W=[N, ]err for passing '-Werror' to the compiler Daniel Schwierzeck
2018-01-26  1:09   ` Masahiro Yamada [this message]
2018-01-26 13:30     ` Daniel Schwierzeck
2018-01-25 17:21 ` [U-Boot] [PATCH 2/4] buildman: add option -E for treating compiler warnings as errors Daniel Schwierzeck
2018-02-04 13:39   ` Simon Glass
2018-01-25 17:21 ` [U-Boot] [PATCH 3/4] travis.yml: fix 'set +e' in build script Daniel Schwierzeck
2018-02-04 13:39   ` Simon Glass
2018-01-25 17:21 ` [U-Boot] [PATCH 4/4] travis.yml: run buildman with option -E Daniel Schwierzeck
2018-02-04 13:39   ` Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAK7LNAR_wdpQVbQYT0RQhXYR9TcKqmCfwNMwkMb0oFKzzoNFHA@mail.gmail.com \
    --to=yamada.masahiro@socionext.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.