[U-Boot] [PATCH v2 2/4] buildman: add option -E for treating compiler warnings as errors

Daniel Schwierzeck daniel.schwierzeck at gmail.com
Fri Jan 26 15:31:05 UTC 2018


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



More information about the U-Boot mailing list