diff mbox series

Makefile.extrawarn: add -Wformat-insufficient-args for clang build

Message ID 20220716084532.2324050-1-youngmin.nam@samsung.com (mailing list archive)
State New, archived
Headers show
Series Makefile.extrawarn: add -Wformat-insufficient-args for clang build | expand

Commit Message

Youngmin Nam July 16, 2022, 8:45 a.m. UTC
The -Wformat-insufficient-args for clang is useful to detect the situation
when the total number is unmatched between format specifiers and arguments.

Originally, this option is enabled by default(Link[1]), but it is disabled by
-Wno-format explicitly so that we can't detect this unmatched situation.

We can enable it by adding this option after -Wno-format.

Link[1]: https://releases.llvm.org/13.0.0/tools/clang/docs/DiagnosticsReference.html#wformat-insufficient-args
Signed-off-by: Youngmin Nam <youngmin.nam@samsung.com>
---
 scripts/Makefile.extrawarn | 1 +
 1 file changed, 1 insertion(+)

Comments

Masahiro Yamada July 22, 2022, 4:20 a.m. UTC | #1
On Sat, Jul 16, 2022 at 5:17 PM Youngmin Nam <youngmin.nam@samsung.com> wrote:
>
> The -Wformat-insufficient-args for clang is useful to detect the situation
> when the total number is unmatched between format specifiers and arguments.
>
> Originally, this option is enabled by default(Link[1]), but it is disabled by
> -Wno-format explicitly so that we can't detect this unmatched situation.
>
> We can enable it by adding this option after -Wno-format.
>
> Link[1]: https://releases.llvm.org/13.0.0/tools/clang/docs/DiagnosticsReference.html#wformat-insufficient-args
> Signed-off-by: Youngmin Nam <youngmin.nam@samsung.com>
> ---


Please let me hold on this patch because
I'd rather go straight to the removal of  -Wno-format.

https://lore.kernel.org/linux-kbuild/CAFhGd8pk+0XEz0tMiJcwMM7B3NYF=yF4cHW8A-6-81SgpKFPNw@mail.gmail.com/T/#m4becf6ed91f25217b59a840ed1829f36e49fe347



>  scripts/Makefile.extrawarn | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
> index f5f0d6f09053..c23d7c286bad 100644
> --- a/scripts/Makefile.extrawarn
> +++ b/scripts/Makefile.extrawarn
> @@ -48,6 +48,7 @@ else
>  ifdef CONFIG_CC_IS_CLANG
>  KBUILD_CFLAGS += -Wno-initializer-overrides
>  KBUILD_CFLAGS += -Wno-format
> +KBUILD_CFLAGS += -Wformat-insufficient-args
>  KBUILD_CFLAGS += -Wno-sign-compare
>  KBUILD_CFLAGS += -Wno-format-zero-length
>  KBUILD_CFLAGS += $(call cc-disable-warning, pointer-to-enum-cast)
> --
> 2.34.0
>
Nick Desaulniers Aug. 19, 2022, 11:33 p.m. UTC | #2
On Thu, Jul 21, 2022 at 9:22 PM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> On Sat, Jul 16, 2022 at 5:17 PM Youngmin Nam <youngmin.nam@samsung.com> wrote:
> >
> > The -Wformat-insufficient-args for clang is useful to detect the situation
> > when the total number is unmatched between format specifiers and arguments.
> >
> > Originally, this option is enabled by default(Link[1]), but it is disabled by
> > -Wno-format explicitly so that we can't detect this unmatched situation.
> >
> > We can enable it by adding this option after -Wno-format.
> >
> > Link[1]: https://releases.llvm.org/13.0.0/tools/clang/docs/DiagnosticsReference.html#wformat-insufficient-args
> > Signed-off-by: Youngmin Nam <youngmin.nam@samsung.com>
> > ---
>
>
> Please let me hold on this patch because
> I'd rather go straight to the removal of  -Wno-format.
>
> https://lore.kernel.org/linux-kbuild/CAFhGd8pk+0XEz0tMiJcwMM7B3NYF=yF4cHW8A-6-81SgpKFPNw@mail.gmail.com/T/#m4becf6ed91f25217b59a840ed1829f36e49fe347

Let's see what the feedback on
https://reviews.llvm.org/D132266 is. If it lands, I will send a series
with this patch first, then wrap it in the else clause of a
conditional like: if clang version >= 16 then enable -Wformat else
enable -Wformat-insufficient-args.

>
>
>
> >  scripts/Makefile.extrawarn | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
> > index f5f0d6f09053..c23d7c286bad 100644
> > --- a/scripts/Makefile.extrawarn
> > +++ b/scripts/Makefile.extrawarn
> > @@ -48,6 +48,7 @@ else
> >  ifdef CONFIG_CC_IS_CLANG
> >  KBUILD_CFLAGS += -Wno-initializer-overrides
> >  KBUILD_CFLAGS += -Wno-format
> > +KBUILD_CFLAGS += -Wformat-insufficient-args
> >  KBUILD_CFLAGS += -Wno-sign-compare
> >  KBUILD_CFLAGS += -Wno-format-zero-length
> >  KBUILD_CFLAGS += $(call cc-disable-warning, pointer-to-enum-cast)
> > --
> > 2.34.0
> >
>
>
> --
> Best Regards
> Masahiro Yamada
diff mbox series

Patch

diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
index f5f0d6f09053..c23d7c286bad 100644
--- a/scripts/Makefile.extrawarn
+++ b/scripts/Makefile.extrawarn
@@ -48,6 +48,7 @@  else
 ifdef CONFIG_CC_IS_CLANG
 KBUILD_CFLAGS += -Wno-initializer-overrides
 KBUILD_CFLAGS += -Wno-format
+KBUILD_CFLAGS += -Wformat-insufficient-args
 KBUILD_CFLAGS += -Wno-sign-compare
 KBUILD_CFLAGS += -Wno-format-zero-length
 KBUILD_CFLAGS += $(call cc-disable-warning, pointer-to-enum-cast)