* [U-Boot] [PATCH v2 0/4] Add support for treating compiler warnings as errors
@ 2018-01-26 15:31 Daniel Schwierzeck
2018-01-26 15:31 ` [U-Boot] [PATCH v2 1/4] README: add doc for how to supply user specific compiler flags to Kbuild Daniel Schwierzeck
` (3 more replies)
0 siblings, 4 replies; 10+ messages in thread
From: Daniel Schwierzeck @ 2018-01-26 15:31 UTC (permalink / raw)
To: u-boot
To enforce a zero-warnings policy (e.g. in CI builds), all compiler
warnings have to be treated as errors.
Extend Kbuild and buildman with according options to achieve this.
Enable these new options in all Travis CI builds. All builds with
compiler warnings will now fail. Only DTC warnings are still being
ignored.
Example build which failed due to a compiler warning:
https://travis-ci.org/danielschwierzeck/u-boot/jobs/333349371#L936
The patch which fixes the warning above:
https://patchwork.ozlabs.org/patch/866009/
Changes in v2:
- new patch
- replace 'W=err' with 'KCFLAGS=-Werror'
Daniel Schwierzeck (4):
README: add doc for how to supply user specific compiler flags to
Kbuild
buildman: add option -E for treating compiler warnings as errors
travis.yml: fix 'set +e' in build script
travis.yml: run buildman with option -E
.travis.yml | 5 ++---
README | 5 +++++
tools/buildman/builder.py | 5 ++++-
tools/buildman/builderthread.py | 2 ++
tools/buildman/cmdline.py | 2 ++
tools/buildman/control.py | 3 ++-
6 files changed, 17 insertions(+), 5 deletions(-)
--
2.16.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [U-Boot] [PATCH v2 1/4] README: add doc for how to supply user specific compiler flags to Kbuild
2018-01-26 15:31 [U-Boot] [PATCH v2 0/4] Add support for treating compiler warnings as errors Daniel Schwierzeck
@ 2018-01-26 15:31 ` Daniel Schwierzeck
2018-02-05 21:47 ` [U-Boot] [U-Boot, v2, " Tom Rini
2018-01-26 15:31 ` [U-Boot] [PATCH v2 2/4] buildman: add option -E for treating compiler warnings as errors Daniel Schwierzeck
` (2 subsequent siblings)
3 siblings, 1 reply; 10+ messages in thread
From: Daniel Schwierzeck @ 2018-01-26 15:31 UTC (permalink / raw)
To: u-boot
Probably not all users are aware of this possibility, thus add a
pointer to the README. Also add a useful example.
Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
---
Changes in v2:
- new patch
README | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/README b/README
index b53ea7dfe3..b055ae7ef2 100644
--- a/README
+++ b/README
@@ -3719,6 +3719,11 @@ this behavior and build U-Boot to some external directory:
Note that the command line "O=" setting overrides the KBUILD_OUTPUT environment
variable.
+User specific CPPFLAGS, AFLAGS and CFLAGS can be passed to the compiler by
+setting the according environment variables KCPPFLAGS, KAFLAGS and KCFLAGS.
+For example to treat all compiler warnings as errors:
+
+ make KCFLAGS=-Werror
Please be aware that the Makefiles assume you are using GNU make, so
for instance on NetBSD you might need to use "gmake" instead of
--
2.16.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [U-Boot] [PATCH v2 2/4] buildman: add option -E for treating compiler warnings as errors
2018-01-26 15:31 [U-Boot] [PATCH v2 0/4] Add support for treating compiler warnings as errors Daniel Schwierzeck
2018-01-26 15:31 ` [U-Boot] [PATCH v2 1/4] README: add doc for how to supply user specific compiler flags to Kbuild Daniel Schwierzeck
@ 2018-01-26 15:31 ` Daniel Schwierzeck
2018-02-05 21:47 ` [U-Boot] [U-Boot, v2, " Tom Rini
2018-01-26 15:31 ` [U-Boot] [PATCH v2 3/4] travis.yml: fix 'set +e' in build script Daniel Schwierzeck
2018-01-26 15:31 ` [U-Boot] [PATCH v2 4/4] travis.yml: run buildman with option -E Daniel Schwierzeck
3 siblings, 1 reply; 10+ messages in thread
From: Daniel Schwierzeck @ 2018-01-26 15:31 UTC (permalink / raw)
To: u-boot
Add a new option '-E' for treating all compiler warnings as errors.
Eventually this will pass 'KCFLAGS=-Werror' to Kbuild.
Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
---
Changes in v2:
- replace 'W=err' with 'KCFLAGS=-Werror'
tools/buildman/builder.py | 5 ++++-
tools/buildman/builderthread.py | 2 ++
tools/buildman/cmdline.py | 2 ++
tools/buildman/control.py | 3 ++-
4 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py
index acb0810457..4e72b7d60d 100644
--- a/tools/buildman/builder.py
+++ b/tools/buildman/builder.py
@@ -212,7 +212,8 @@ class Builder:
gnu_make='make', checkout=True, show_unknown=True, step=1,
no_subdirs=False, full_path=False, verbose_build=False,
incremental=False, per_board_out_dir=False,
- config_only=False, squash_config_y=False):
+ config_only=False, squash_config_y=False,
+ warnings_as_errors=False):
"""Create a new Builder object
Args:
@@ -237,6 +238,7 @@ class Builder:
board rather than a thread-specific directory
config_only: Only configure each build, don't build it
squash_config_y: Convert CONFIG options with the value 'y' to '1'
+ warnings_as_errors: Treat all compiler warnings as errors
"""
self.toolchains = toolchains
self.base_dir = base_dir
@@ -270,6 +272,7 @@ class Builder:
if not self.squash_config_y:
self.config_filenames += EXTRA_CONFIG_FILENAMES
+ self.warnings_as_errors = warnings_as_errors
self.col = terminal.Color()
self._re_function = re.compile('(.*): In function.*')
diff --git a/tools/buildman/builderthread.py b/tools/buildman/builderthread.py
index 9e8ca80c5b..9ac101a5a4 100644
--- a/tools/buildman/builderthread.py
+++ b/tools/buildman/builderthread.py
@@ -216,6 +216,8 @@ class BuilderThread(threading.Thread):
args.append('-s')
if self.builder.num_jobs is not None:
args.extend(['-j', str(self.builder.num_jobs)])
+ if self.builder.warnings_as_errors:
+ args.append('KCFLAGS=-Werror')
config_args = ['%s_defconfig' % brd.target]
config_out = ''
args.extend(self.builder.toolchains.GetMakeArguments(brd))
diff --git a/tools/buildman/cmdline.py b/tools/buildman/cmdline.py
index 74247f0aff..6949d6bf2c 100644
--- a/tools/buildman/cmdline.py
+++ b/tools/buildman/cmdline.py
@@ -32,6 +32,8 @@ def ParseArgs():
help="Don't build, just configure each commit")
parser.add_option('-e', '--show_errors', action='store_true',
default=False, help='Show errors and warnings')
+ parser.add_option('-E', '--warnings-as-errors', action='store_true',
+ default=False, help='Treat all compiler warnings as errors')
parser.add_option('-f', '--force-build', dest='force_build',
action='store_true', default=False,
help='Force build of boards even if already built')
diff --git a/tools/buildman/control.py b/tools/buildman/control.py
index 73b1a14fb6..3cac9f7cf6 100644
--- a/tools/buildman/control.py
+++ b/tools/buildman/control.py
@@ -263,7 +263,8 @@ def DoBuildman(options, args, toolchains=None, make_func=None, boards=None,
incremental=options.incremental,
per_board_out_dir=options.per_board_out_dir,
config_only=options.config_only,
- squash_config_y=not options.preserve_config_y)
+ squash_config_y=not options.preserve_config_y,
+ warnings_as_errors=options.warnings_as_errors)
builder.force_config_on_failure = not options.quick
if make_func:
builder.do_make = make_func
--
2.16.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [U-Boot] [PATCH v2 3/4] travis.yml: fix 'set +e' in build script
2018-01-26 15:31 [U-Boot] [PATCH v2 0/4] Add support for treating compiler warnings as errors Daniel Schwierzeck
2018-01-26 15:31 ` [U-Boot] [PATCH v2 1/4] README: add doc for how to supply user specific compiler flags to Kbuild Daniel Schwierzeck
2018-01-26 15:31 ` [U-Boot] [PATCH v2 2/4] buildman: add option -E for treating compiler warnings as errors Daniel Schwierzeck
@ 2018-01-26 15:31 ` Daniel Schwierzeck
2018-01-26 15:58 ` Tom Rini
2018-02-05 21:48 ` [U-Boot] [U-Boot, v2, " Tom Rini
2018-01-26 15:31 ` [U-Boot] [PATCH v2 4/4] travis.yml: run buildman with option -E Daniel Schwierzeck
3 siblings, 2 replies; 10+ messages in thread
From: Daniel Schwierzeck @ 2018-01-26 15:31 UTC (permalink / raw)
To: u-boot
The build script should not manipulate shell flags (especially '-e').
A non-zero exit value can also be catched with 'cmd || ret=$?'.
Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
---
Changes in v2: None
.travis.yml | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 2a98c4bb11..1e55e1b7f1 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -101,9 +101,8 @@ script:
#
# Exit code 129 means warnings only.
- if [[ "${BUILDMAN}" != "" ]]; then
- set +e;
- tools/buildman/buildman -P ${BUILDMAN};
- ret=$?;
+ ret=0;
+ tools/buildman/buildman -P ${BUILDMAN} || ret=$?;
if [[ $ret -ne 0 && $ret -ne 129 ]]; then
tools/buildman/buildman -sdeP ${BUILDMAN};
exit $ret;
--
2.16.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [U-Boot] [PATCH v2 4/4] travis.yml: run buildman with option -E
2018-01-26 15:31 [U-Boot] [PATCH v2 0/4] Add support for treating compiler warnings as errors Daniel Schwierzeck
` (2 preceding siblings ...)
2018-01-26 15:31 ` [U-Boot] [PATCH v2 3/4] travis.yml: fix 'set +e' in build script Daniel Schwierzeck
@ 2018-01-26 15:31 ` Daniel Schwierzeck
2018-02-05 21:48 ` [U-Boot] [U-Boot, v2, " Tom Rini
3 siblings, 1 reply; 10+ messages in thread
From: Daniel Schwierzeck @ 2018-01-26 15:31 UTC (permalink / raw)
To: u-boot
This forces all compiler warnings to be treated as errors.
Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
---
Changes in v2: None
.travis.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.travis.yml b/.travis.yml
index 1e55e1b7f1..59d1dd99e8 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -102,7 +102,7 @@ script:
# Exit code 129 means warnings only.
- if [[ "${BUILDMAN}" != "" ]]; then
ret=0;
- tools/buildman/buildman -P ${BUILDMAN} || ret=$?;
+ tools/buildman/buildman -P -E ${BUILDMAN} || ret=$?;
if [[ $ret -ne 0 && $ret -ne 129 ]]; then
tools/buildman/buildman -sdeP ${BUILDMAN};
exit $ret;
--
2.16.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [U-Boot] [PATCH v2 3/4] travis.yml: fix 'set +e' in build script
2018-01-26 15:31 ` [U-Boot] [PATCH v2 3/4] travis.yml: fix 'set +e' in build script Daniel Schwierzeck
@ 2018-01-26 15:58 ` Tom Rini
2018-02-05 21:48 ` [U-Boot] [U-Boot, v2, " Tom Rini
1 sibling, 0 replies; 10+ messages in thread
From: Tom Rini @ 2018-01-26 15:58 UTC (permalink / raw)
To: u-boot
On Fri, Jan 26, 2018 at 04:31:06PM +0100, Daniel Schwierzeck wrote:
> The build script should not manipulate shell flags (especially '-e').
> A non-zero exit value can also be catched with 'cmd || ret=$?'.
>
> Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180126/f79f4873/attachment.sig>
^ permalink raw reply [flat|nested] 10+ messages in thread
* [U-Boot] [U-Boot, v2, 1/4] README: add doc for how to supply user specific compiler flags to Kbuild
2018-01-26 15:31 ` [U-Boot] [PATCH v2 1/4] README: add doc for how to supply user specific compiler flags to Kbuild Daniel Schwierzeck
@ 2018-02-05 21:47 ` Tom Rini
0 siblings, 0 replies; 10+ messages in thread
From: Tom Rini @ 2018-02-05 21:47 UTC (permalink / raw)
To: u-boot
On Fri, Jan 26, 2018 at 04:31:04PM +0100, Daniel Schwierzeck wrote:
> Probably not all users are aware of this possibility, thus add a
> pointer to the README. Also add a useful example.
>
> Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Applied to u-boot/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180205/01f952b0/attachment.sig>
^ permalink raw reply [flat|nested] 10+ messages in thread
* [U-Boot] [U-Boot, v2, 2/4] buildman: add option -E for treating compiler warnings as errors
2018-01-26 15:31 ` [U-Boot] [PATCH v2 2/4] buildman: add option -E for treating compiler warnings as errors Daniel Schwierzeck
@ 2018-02-05 21:47 ` Tom Rini
0 siblings, 0 replies; 10+ messages in thread
From: Tom Rini @ 2018-02-05 21:47 UTC (permalink / raw)
To: u-boot
On Fri, Jan 26, 2018 at 04:31:05PM +0100, Daniel Schwierzeck wrote:
> Add a new option '-E' for treating all compiler warnings as errors.
> Eventually this will pass 'KCFLAGS=-Werror' to Kbuild.
>
> Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Applied to u-boot/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180205/405f2da5/attachment.sig>
^ permalink raw reply [flat|nested] 10+ messages in thread
* [U-Boot] [U-Boot, v2, 3/4] travis.yml: fix 'set +e' in build script
2018-01-26 15:31 ` [U-Boot] [PATCH v2 3/4] travis.yml: fix 'set +e' in build script Daniel Schwierzeck
2018-01-26 15:58 ` Tom Rini
@ 2018-02-05 21:48 ` Tom Rini
1 sibling, 0 replies; 10+ messages in thread
From: Tom Rini @ 2018-02-05 21:48 UTC (permalink / raw)
To: u-boot
On Fri, Jan 26, 2018 at 04:31:06PM +0100, Daniel Schwierzeck wrote:
> The build script should not manipulate shell flags (especially '-e').
> A non-zero exit value can also be catched with 'cmd || ret=$?'.
>
> Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
> Reviewed-by: Tom Rini <trini@konsulko.com>
Applied to u-boot/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180205/8cc99f42/attachment.sig>
^ permalink raw reply [flat|nested] 10+ messages in thread
* [U-Boot] [U-Boot, v2, 4/4] travis.yml: run buildman with option -E
2018-01-26 15:31 ` [U-Boot] [PATCH v2 4/4] travis.yml: run buildman with option -E Daniel Schwierzeck
@ 2018-02-05 21:48 ` Tom Rini
0 siblings, 0 replies; 10+ messages in thread
From: Tom Rini @ 2018-02-05 21:48 UTC (permalink / raw)
To: u-boot
On Fri, Jan 26, 2018 at 04:31:07PM +0100, Daniel Schwierzeck wrote:
> This forces all compiler warnings to be treated as errors.
>
> Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Applied to u-boot/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180205/d259f4c4/attachment.sig>
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2018-02-05 21:48 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-26 15:31 [U-Boot] [PATCH v2 0/4] Add support for treating compiler warnings as errors Daniel Schwierzeck
2018-01-26 15:31 ` [U-Boot] [PATCH v2 1/4] README: add doc for how to supply user specific compiler flags to Kbuild Daniel Schwierzeck
2018-02-05 21:47 ` [U-Boot] [U-Boot, v2, " Tom Rini
2018-01-26 15:31 ` [U-Boot] [PATCH v2 2/4] buildman: add option -E for treating compiler warnings as errors Daniel Schwierzeck
2018-02-05 21:47 ` [U-Boot] [U-Boot, v2, " Tom Rini
2018-01-26 15:31 ` [U-Boot] [PATCH v2 3/4] travis.yml: fix 'set +e' in build script Daniel Schwierzeck
2018-01-26 15:58 ` Tom Rini
2018-02-05 21:48 ` [U-Boot] [U-Boot, v2, " Tom Rini
2018-01-26 15:31 ` [U-Boot] [PATCH v2 4/4] travis.yml: run buildman with option -E Daniel Schwierzeck
2018-02-05 21:48 ` [U-Boot] [U-Boot, v2, " Tom Rini
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.