Skip to content

Commit 20ff368

Browse files
committed
modpost: propagate W=1 build option to modpost
"No build warning" is a strong requirement these days, so you must fix all issues before enabling a new warning flag. We often add a new warning to W=1 first so that the kbuild test robot blocks new breakages. This commit allows modpost to show extra warnings only when W=1 (or KBUILD_EXTRA_WARN=1) is given. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
1 parent 7f8256a commit 20ff368

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

scripts/Makefile.modpost

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ modpost-args = \
4747
$(if $(KBUILD_MODPOST_WARN),-w) \
4848
$(if $(KBUILD_NSDEPS),-d $(MODULES_NSDEPS)) \
4949
$(if $(CONFIG_MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS)$(KBUILD_NSDEPS),-N) \
50+
$(if $(findstring 1, $(KBUILD_EXTRA_WARN)),-W) \
5051
-o $@
5152

5253
modpost-deps := $(MODPOST)

scripts/mod/modpost.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ static bool allow_missing_ns_imports;
4242

4343
static bool error_occurred;
4444

45+
static bool extra_warn;
46+
4547
/*
4648
* Cut off the warnings when there are too many. This typically occurs when
4749
* vmlinux is missing. ('make modules' without building vmlinux.)
@@ -2199,7 +2201,7 @@ int main(int argc, char **argv)
21992201
LIST_HEAD(dump_lists);
22002202
struct dump_list *dl, *dl2;
22012203

2202-
while ((opt = getopt(argc, argv, "ei:mnT:o:awENd:")) != -1) {
2204+
while ((opt = getopt(argc, argv, "ei:mnT:o:aWwENd:")) != -1) {
22032205
switch (opt) {
22042206
case 'e':
22052207
external_module = true;
@@ -2224,6 +2226,9 @@ int main(int argc, char **argv)
22242226
case 'T':
22252227
files_source = optarg;
22262228
break;
2229+
case 'W':
2230+
extra_warn = true;
2231+
break;
22272232
case 'w':
22282233
warn_unresolved = true;
22292234
break;

0 commit comments

Comments
 (0)