RFC sync scripts/Makefile.extrawarn with 6.1, enable WERROR for host tools
Get series with b4
b4 am [email protected] change-id 20260429-extrawarn-sync-504f65d2ff21Versions newest first
- v1 RFC Latest18 patches 47 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/18 | test/py: add pytest --make-args argument for additional Make argumentstest/ test/ test/ | +8 | 1 reply | |
| 2/18 | CI: pass clang HOSTCC and CC to pytest.gitlab-ci.yml | +2 | 4 replies | |
| 3/18 | scripts/Makefile.extrawarn: migrate -Wvla to a U-Boot-specific fileMakefile scripts/ scripts/ | +10 | 2 replies | |
| 4/18 | kbuild: re-enable int-in-bool-context warningMakefile | +0 | 2 replies | |
| 5/18 | kbuild: Don't try to add '-fcatch-undefined-behavior' flagMakefile | +0 | 2 replies | |
| 6/18 | Makefile: move deprecated-non-prototype to scripts/Makefile.extrawarn.u-bootMakefile scripts/ | +18 | 2 replies | |
| 7/18 | scripts/Makefile.extrawarn: handle CONFIG_WERROR in U-Boot-specific filescripts/ scripts/ | +3 | 2 replies | |
| 8/18 | scripts/Makefile.extrawarn: sync with 6.1Makefile scripts/ | +94 | 3 replies | |
| 9/18 | kbuild: support W=c and W=e shorthands for KconfigMakefile scripts/ scripts/ | +18 | 2 replies | |
| 10/18 | kbuild: align W=e with CONFIG_WERRORscripts/ | +1 | 2 replies | |
| 11/18 | kbuild: unify W=e and CONFIG_WERRORscripts/ | +2 | 2 replies | |
| 12/18 | scripts/Makefile.extrawarn.u-boot: remove redundant Werror handlingscripts/ | +0 | 2 replies | |
| 13/18 | kbuild: rust: move `-Dwarnings` handling to `Makefile.extrawarn`scripts/ | +1 | 2 replies | |
| 14/18 | kbuild: respect CONFIG_WERROR for linker and assemblerscripts/ | +2 | 2 replies | |
| 15/18 | kbuild: enable -Werror for hostprogsscripts/ | +5 | 5 replies | |
| 16/18 | scripts/Makefile.extrawarn: Respect CONFIG_WERROR / W=e for hostprogsscripts/ | +5 | 2 replies | |
| 17/18 | scripts/Makefile.build: do not run kernel-docs with warningsscripts/ | +4 | 1 reply | |
| 18/18 | buildman: set W flag to e to be consistent with CONFIG_WERRORtools/ | +1 | 3 replies |
Reviews trailers per patch
16 of 18 patches have a Reviewed-by or Acked-by.
| Patch | Simon Glass | Ilias Apalodimas |
|---|---|---|
| 1/18 | R-b | |
| 2/18 | R-b | |
| 3/18 | R-b | R-b |
| 4/18 | R-b | R-b |
| 5/18 | R-b | R-b |
| 6/18 | R-b | R-b |
| 7/18 | R-b | R-b |
| 8/18 | ||
| 9/18 | R-b | R-b |
| 10/18 | R-b | R-b |
| 11/18 | R-b | R-b |
| 12/18 | R-b | R-b |
| 13/18 | R-b | R-b |
| 14/18 | R-b | R-b |
| 15/18 | R-b | |
| 16/18 | R-b | R-b |
| 17/18 | R-b | |
| 18/18 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH RFC next 00/18] sync scripts/Makefile.extrawarn with 6.1, enable WERROR for host tools
I ended up being surprised host tools aren't compiled with -Werror even when CONFIG_WERROR is set.
While this is an issue for local builds, buildman (used in CI) adds -Werror to KCFLAGS and HOSTCFLAGS when passed -E (or --warnings-as-errors), which we do, see
'build all platforms in a single job' job and &buildman_and_testpy_dfn template.
It turns out that even though we claim to have synchronized our kbuild with Linux kernel v6.1, some of it was stuck to v5.1 +- some partial backports. This doesn't attempt to update everything that isn't in sync with 6.1 though!
The first two patches are for fixing pytest calling make directly on a "dirty" build directory as generated by buildman using the clang-20 toolchain, but pytest does not set HOSTCC and CC to clang-20, resulting in clang flags being used with gcc).
One can simply reproduce it (after backporting up to patch "scripts/Makefile.extrawarn: sync with 6.1") by doing so in the container:
make HOSTCC=clang-20 CC=clang-20 O=build/sandbox sandbox_defconfig make HOSTCC=clang-20 CC=clang-20 O=build/sandbox -j`nproc make O=build/sandbox u-boot-initial-env
It'll print:
gcc: error: unrecognized command-line option '-mno-global-merge'
gcc: error: unrecognized command-line option '-Wformat-invalid-specifier'
gcc: error: unrecognized command-line option '-Qunused-arguments'
This is essentially what's run within test_env_initial_env_file in test/py/tests/test_env.py.
While I'm not unhappy with the patches to pytest, it feels to me we may be missing something else for the u-boot-initial-env make target to update the kconfig symbol based on the toolchain being used when called.
While looking at the kernel git history for Makefile and scripts/Makefile.extrawarn I also saw a few flags being removed or reworked so I took the liberty of backporting some.
Then, scripts/Makefile.extrawarn is directly imported verbatim from v6.1 which is the version we've claimed to be synced with so far.
Also, patches to apply CONFIG_WERROR to the host tools as well as linker and assembler are backported.
kernel-doc is made to ignore KBUILD_EXTRA_WARN since we have too many warnings for now and it prevents us from being able to use W=e Make variable which is extremely convenient to essentially do the same as setting CONFIG_WERROR in Kconfig, just without needing to actually set it in the defconfig or in a .config. I don't like it but it is what it is. Our kernel-doc has a couple of patches on top of Linux kernel v5.11's. The kernel has moved to a Python script this year, so it's probably wise to migrate to that before trying to tackle kernel-doc warnings.
Finally, buildman is made to use W=e such that the same logic as CONFIG_WERROR is applied (instead of manually configuring KCFLAGS and HOSTCFLAGS which only modifies host and target cflags and not linker or assembler flags like CONFIG_WERROR now does).
RFC because I don't like the commenting of kernel-doc but I think it's worth it. RFC also because I think something must be broken in the handling of u-boot-initial-env make target which doesn't check the compiler vs what's in .config (or maybe some other issue, don't know but we shouldn't end up using clang flags with gcc or vice-versa).
CI pipeline here: https://source.denx.de/u-boot/contributors/qschulz/u-boot/-/pipelines/29975
Only change is:
# diff --git a/test/py/conftest.py b/test/py/conftest.py
# index 8852df2235e..a26aaee7b2f 100644
# --- a/test/py/conftest.py
# +++ b/test/py/conftest.py
# @@ -121,10 +121,9 @@ def run_build(config, source_dir, build_dir, board_type, log):
# o_opt = 'O=%s' % build_dir
# else:
# o_opt = ''
# - base_cmd = ['make', *config.getoption('make_args'), o_opt, '-s']
# cmds = (
# - base_cmd + [board_type + '_defconfig'],
# - base_cmd + ['-j{}'.format(os.cpu_count())],
# + ['make', *config.getoption('make_args'), o_opt, '-s', board_type + '_defconfig'],
# + ['make', *config.getoption('make_args'), o_opt, '-s', '-j{}'.format(os.cpu_count())],
# )
# name = 'make'because I changed my mind factoring out the start of the make cmds in run_build.
---
Quentin Schulz (18):
test/py: add pytest --make-args argument for additional Make arguments
CI: pass clang HOSTCC and CC to pytest scripts/Makefile.extrawarn: migrate -Wvla to a U-Boot-specific file
kbuild: re-enable int-in-bool-context warning
kbuild: Don't try to add '-fcatch-undefined-behavior' flag
Makefile: move deprecated-non-prototype to scripts/Makefile.extrawarn.u-boot scripts/Makefile.extrawarn: handle CONFIG_WERROR in U-Boot-specific file scripts/Makefile.extrawarn: sync with 6.1
kbuild: support W=c and W=e shorthands for Kconfig
kbuild: align W=e with CONFIG_WERROR
kbuild: unify W=e and CONFIG_WERROR scripts/Makefile.extrawarn.u-boot: remove redundant Werror handling
kbuild: rust: move -Dwarnings handling to Makefile.extrawarn
kbuild: respect CONFIG_WERROR for linker and assembler
kbuild: enable -Werror for hostprogs scripts/Makefile.extrawarn: Respect CONFIG_WERROR / W=e for hostprogs scripts/Makefile.build: do not run kernel-docs with warnings
buildman: set W flag to e to be consistent with CONFIG_WERROR
.gitlab-ci.yml | 2 + Makefile | 17 +++- scripts/Makefile.build | 5 +- scripts/Makefile.extrawarn | 175 +++++++++++++++++++++--------------- scripts/Makefile.extrawarn.u-boot | 27 ++++++ scripts/kconfig/Makefile | 8 ++ test/py/conftest.py | 6 +- test/py/tests/test_cleanup_build.py | 4 +- test/py/tests/test_env.py | 4 +- tools/buildman/builderthread.py | 1 + 10 files changed, 165 insertions(+), 84 deletions(-)
---
base-commit: bb0f3eebb3c196d9b6efbbd1e5aa9b16abbb9ad6
change-id: 20260429-extrawarn-sync-504f65d2ff21
Best regards,
Signature · 1 line
Quentin Schulz <[email protected]>