diff mbox series

modpost: propagate W=1 build option to modpost

Message ID 20230606094159.1910369-1-masahiroy@kernel.org (mailing list archive)
State New, archived
Headers show
Series modpost: propagate W=1 build option to modpost | expand

Commit Message

Masahiro Yamada June 6, 2023, 9:41 a.m. UTC
"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>
---

 scripts/Makefile.modpost | 1 +
 scripts/mod/modpost.c    | 7 ++++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

Comments

Nick Desaulniers June 6, 2023, 4:56 p.m. UTC | #1
On Tue, Jun 6, 2023 at 2:42 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> "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>

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

> ---
>
>  scripts/Makefile.modpost | 1 +
>  scripts/mod/modpost.c    | 7 ++++++-
>  2 files changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost
> index 0980c58d8afc..074e27c0c140 100644
> --- a/scripts/Makefile.modpost
> +++ b/scripts/Makefile.modpost
> @@ -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)
> diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
> index d10f5bdcb753..3ea5eb2b1029 100644
> --- a/scripts/mod/modpost.c
> +++ b/scripts/mod/modpost.c
> @@ -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
>
Masahiro Yamada June 6, 2023, 5:21 p.m. UTC | #2
On Wed, Jun 7, 2023 at 1:56 AM Nick Desaulniers <ndesaulniers@google.com> wrote:
>
> On Tue, Jun 6, 2023 at 2:42 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
> >
> > "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>
>
> 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


> > ---
> >
> >  scripts/Makefile.modpost | 1 +
> >  scripts/mod/modpost.c    | 7 ++++++-
> >  2 files changed, 7 insertions(+), 1 deletion(-)
> >
> > diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost
> > index 0980c58d8afc..074e27c0c140 100644
> > --- a/scripts/Makefile.modpost
> > +++ b/scripts/Makefile.modpost
> > @@ -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)
> > diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
> > index d10f5bdcb753..3ea5eb2b1029 100644
> > --- a/scripts/mod/modpost.c
> > +++ b/scripts/mod/modpost.c
> > @@ -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
> >
>
>
> --
> Thanks,
> ~Nick Desaulniers
Nick Desaulniers June 6, 2023, 6:38 p.m. UTC | #3
On Tue, Jun 6, 2023 at 10:21 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> On Wed, Jun 7, 2023 at 1:56 AM Nick Desaulniers <ndesaulniers@google.com> wrote:
> >
> > On Tue, Jun 6, 2023 at 2:42 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
> > >
> > > "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>
> >
> > 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.

Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

>
>
> > > ---
> > >
> > >  scripts/Makefile.modpost | 1 +
> > >  scripts/mod/modpost.c    | 7 ++++++-
> > >  2 files changed, 7 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost
> > > index 0980c58d8afc..074e27c0c140 100644
> > > --- a/scripts/Makefile.modpost
> > > +++ b/scripts/Makefile.modpost
> > > @@ -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)
> > > diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
> > > index d10f5bdcb753..3ea5eb2b1029 100644
> > > --- a/scripts/mod/modpost.c
> > > +++ b/scripts/mod/modpost.c
> > > @@ -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
> > >
> >
> >
> > --
> > Thanks,
> > ~Nick Desaulniers
>
>
>
> --
> Best Regards
> Masahiro Yamada
diff mbox series

Patch

diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost
index 0980c58d8afc..074e27c0c140 100644
--- a/scripts/Makefile.modpost
+++ b/scripts/Makefile.modpost
@@ -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)
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index d10f5bdcb753..3ea5eb2b1029 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -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;