Skip to contentSkip to conversation

modpost: propagate W=1 build option to modpost

PATCH In review Masahiro Yamada 2 participants 4 messages Jun 6, 2023 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---

 scripts/Makefile.modpost | 1 +
 scripts/mod/modpost.c    | 7 ++++++-
 2 files changed, 7 insertions(+), 1 deletion(-)
scripts/Makefile.modpost +1 -0
index 0980c58d8afc..074e27c0c140 100644
@@ -47,6 +47,7 @@ modpost-args =										\
 	$(if $(KBUILD_MODPOST_WARN),-w)							\
 	$(if $(KBUILD_NSDEPS),-d $(MODULES_NSDEPS))					\
 	$(if $(CONFIG_MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS)$(KBUILD_NSDEPS),-N)	\
+	$(if $(findstring 1, $(KBUILD_EXTRA_WARN)),-W)					\
 	-o $@
 
 modpost-deps := $(MODPOST)
scripts/mod/modpost.c +6 -1
index d10f5bdcb753..3ea5eb2b1029 100644
@@ -42,6 +42,8 @@ static bool allow_missing_ns_imports;
 
 static bool error_occurred;
 
+static bool extra_warn;
+
 /*
  * Cut off the warnings when there are too many. This typically occurs when
  * vmlinux is missing. ('make modules' without building vmlinux.)
@@ -2199,7 +2201,7 @@ int main(int argc, char **argv)
 	LIST_HEAD(dump_lists);
 	struct dump_list *dl, *dl2;
 
-	while ((opt = getopt(argc, argv, "ei:mnT:o:awENd:")) != -1) {
+	while ((opt = getopt(argc, argv, "ei:mnT:o:aWwENd:")) != -1) {
 		switch (opt) {
 		case 'e':
 			external_module = true;
@@ -2224,6 +2226,9 @@ int main(int argc, char **argv)
 		case 'T':
 			files_source = optarg;
 			break;
+		case 'W':
+			extra_warn = true;
+			break;
 		case 'w':
 			warn_unresolved = true;
 			break;
Signature · 1 line
2.39.2
#1 lore raw
Quoted 11 lines · Masahiro Yamada

"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.

Patch seems fine, but without anyone reading extra_warn, I'm curious what new extra warnings you had in mind were?

Quoted 53 lines

---

 scripts/Makefile.modpost | 1 +
 scripts/mod/modpost.c    | 7 ++++++-
 2 files changed, 7 insertions(+), 1 deletion(-)
scripts/Makefile.modpost +1 -0
index 0980c58d8afc..074e27c0c140 100644
@@ -47,6 +47,7 @@ modpost-args =                                                                                \
        $(if $(KBUILD_MODPOST_WARN),-w)                                                 \
        $(if $(KBUILD_NSDEPS),-d $(MODULES_NSDEPS))                                     \
        $(if $(CONFIG_MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS)$(KBUILD_NSDEPS),-N)       \
+       $(if $(findstring 1, $(KBUILD_EXTRA_WARN)),-W)                                  \
        -o $@
 
 modpost-deps := $(MODPOST)
scripts/mod/modpost.c +6 -2
index d10f5bdcb753..3ea5eb2b1029 100644
@@ -42,6 +42,8 @@ static bool allow_missing_ns_imports;
 
 static bool error_occurred;
 
+static bool extra_warn;
+
 /*
  * Cut off the warnings when there are too many. This typically occurs when
  * vmlinux is missing. ('make modules' without building vmlinux.)
@@ -2199,7 +2201,7 @@ int main(int argc, char **argv)
        LIST_HEAD(dump_lists);
        struct dump_list *dl, *dl2;
 
-       while ((opt = getopt(argc, argv, "ei:mnT:o:awENd:")) != -1) {
+       while ((opt = getopt(argc, argv, "ei:mnT:o:aWwENd:")) != -1) {
                switch (opt) {
                case 'e':
                        external_module = true;
@@ -2224,6 +2226,9 @@ int main(int argc, char **argv)
                case 'T':
                        files_source = optarg;
                        break;
+               case 'W':
+                       extra_warn = true;
+                       break;
                case 'w':
                        warn_unresolved = true;
                        break;
--

2.39.2

Signature · 2 lines
Thanks,
~Nick Desaulniers
#2 lore raw
Quoted 9 lines · Nick Desaulniers
Quoted 7 lines · Masahiro Yamada

"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.

Quoted 7 lines
Quoted 4 lines

This commit allows modpost to show extra warnings only when W=1 (or KBUILD_EXTRA_WARN=1) is given.

Patch seems fine, but without anyone reading extra_warn, I'm curious what new extra warnings you had in mind were?

This one.

https://lore.kernel.org/linux-kbuild/CAK7LNAR0uMvf+k7LPXtMjigKFPeNu5m5EhAkvk2RVRHkdjdbdg@mail.gmail.com/T/#m0f41f2c8fe843133ce8100088443491a51d496af

Quoted 58 lines
Quoted 51 lines

---

 scripts/Makefile.modpost | 1 +
 scripts/mod/modpost.c    | 7 ++++++-
 2 files changed, 7 insertions(+), 1 deletion(-)
scripts/Makefile.modpost +1 -0
index 0980c58d8afc..074e27c0c140 100644
@@ -47,6 +47,7 @@ modpost-args =                                                                                \
        $(if $(KBUILD_MODPOST_WARN),-w)                                                 \
        $(if $(KBUILD_NSDEPS),-d $(MODULES_NSDEPS))                                     \
        $(if $(CONFIG_MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS)$(KBUILD_NSDEPS),-N)       \
+       $(if $(findstring 1, $(KBUILD_EXTRA_WARN)),-W)                                  \
        -o $@
 
 modpost-deps := $(MODPOST)
scripts/mod/modpost.c +6 -2
index d10f5bdcb753..3ea5eb2b1029 100644
@@ -42,6 +42,8 @@ static bool allow_missing_ns_imports;
 
 static bool error_occurred;
 
+static bool extra_warn;
+
 /*
  * Cut off the warnings when there are too many. This typically occurs when
  * vmlinux is missing. ('make modules' without building vmlinux.)
@@ -2199,7 +2201,7 @@ int main(int argc, char **argv)
        LIST_HEAD(dump_lists);
        struct dump_list *dl, *dl2;
 
-       while ((opt = getopt(argc, argv, "ei:mnT:o:awENd:")) != -1) {
+       while ((opt = getopt(argc, argv, "ei:mnT:o:aWwENd:")) != -1) {
                switch (opt) {
                case 'e':
                        external_module = true;
@@ -2224,6 +2226,9 @@ int main(int argc, char **argv)
                case 'T':
                        files_source = optarg;
                        break;
+               case 'W':
+                       extra_warn = true;
+                       break;
                case 'w':
                        warn_unresolved = true;
                        break;
--
Quoted 2 lines

2.39.2

--
Thanks,
~Nick Desaulniers

Signature · 2 lines
Best Regards
Masahiro Yamada
Reviewed-by
#3 lore raw
Quoted 16 lines · Masahiro Yamada
Quoted 14 lines · Nick Desaulniers
Quoted 11 lines · Masahiro Yamada

"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.

Quoted 7 lines
Quoted 2 lines

Patch seems fine, but without anyone reading extra_warn, I'm curious what new extra warnings you had in mind were?

This one.

https://lore.kernel.org/linux-kbuild/CAK7LNAR0uMvf+k7LPXtMjigKFPeNu5m5EhAkvk2RVRHkdjdbdg@mail.gmail.com/T/#m0f41f2c8fe843133ce8100088443491a51d496af

Yeah, ok so we'll guard that warning on this extra_warn then? Seems fine.

Quoted 66 lines
Quoted 52 lines
Quoted 52 lines

---

 scripts/Makefile.modpost | 1 +
 scripts/mod/modpost.c    | 7 ++++++-
 2 files changed, 7 insertions(+), 1 deletion(-)
scripts/Makefile.modpost +1 -0
index 0980c58d8afc..074e27c0c140 100644
@@ -47,6 +47,7 @@ modpost-args =                                                                                \
        $(if $(KBUILD_MODPOST_WARN),-w)                                                 \
        $(if $(KBUILD_NSDEPS),-d $(MODULES_NSDEPS))                                     \
        $(if $(CONFIG_MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS)$(KBUILD_NSDEPS),-N)       \
+       $(if $(findstring 1, $(KBUILD_EXTRA_WARN)),-W)                                  \
        -o $@
 
 modpost-deps := $(MODPOST)
scripts/mod/modpost.c +6 -1
index d10f5bdcb753..3ea5eb2b1029 100644
@@ -42,6 +42,8 @@ static bool allow_missing_ns_imports;
 
 static bool error_occurred;
 
+static bool extra_warn;
+
 /*
  * Cut off the warnings when there are too many. This typically occurs when
  * vmlinux is missing. ('make modules' without building vmlinux.)
@@ -2199,7 +2201,7 @@ int main(int argc, char **argv)
        LIST_HEAD(dump_lists);
        struct dump_list *dl, *dl2;
 
-       while ((opt = getopt(argc, argv, "ei:mnT:o:awENd:")) != -1) {
+       while ((opt = getopt(argc, argv, "ei:mnT:o:aWwENd:")) != -1) {
                switch (opt) {
                case 'e':
                        external_module = true;
@@ -2224,6 +2226,9 @@ int main(int argc, char **argv)
                case 'T':
                        files_source = optarg;
                        break;
+               case 'W':
+                       extra_warn = true;
+                       break;
                case 'w':
                        warn_unresolved = true;
                        break;
Quoted 8 lines
Quoted 3 lines

--
2.39.2

--
Thanks,
~Nick Desaulniers

--
Best Regards
Masahiro Yamada

Signature · 2 lines
Thanks,
~Nick Desaulniers