diff mbox series

[v2,28/28] perf: Do not treat maybe-uninitialized warnings as errors

Message ID 20250520-clang-toolchain-v2-28-db97c2eb3756@gmail.com
State Accepted, archived
Commit c587f473a4581d1640aa227a23d517c51b7ec3cc
Headers show
Series clang: Add clang C/C++ toolchain | expand

Commit Message

Khem Raj May 21, 2025, 6:20 a.m. UTC
Clang finds more warnings in kernel code, make clang happy to not treat
these extra warnings as errors

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-kernel/perf/perf.bb | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Ross Burton June 5, 2025, 10:05 a.m. UTC | #1
I just sent a patch to linux-yocto to silence this at root.

Ross

> On 21 May 2025, at 07:20, Khem Raj via lists.openembedded.org <raj.khem=gmail.com@lists.openembedded.org> wrote:
> 
> Clang finds more warnings in kernel code, make clang happy to not treat
> these extra warnings as errors
> 
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> ---
> meta/recipes-kernel/perf/perf.bb | 10 ++++++++++
> 1 file changed, 10 insertions(+)
> 
> diff --git a/meta/recipes-kernel/perf/perf.bb b/meta/recipes-kernel/perf/perf.bb
> index d06dd2fa5a2bb9b2982572081ef57e2dbafbd5da..0d19e1bdc222da26a5ad0a1d4964acca437a6692 100644
> --- a/meta/recipes-kernel/perf/perf.bb
> +++ b/meta/recipes-kernel/perf/perf.bb
> @@ -81,6 +81,16 @@ LDFLAGS = "-ldl -lutil"
> # avoiding the 'buildpaths' QA warning.
> TARGET_CC_ARCH += "${SELECTED_OPTIMIZATION} ${DEBUG_PREFIX_MAP}"
> 
> +#| libbpf.c: In function 'find_kernel_btf_id.constprop':
> +#| libbpf.c:10009:33: error: 'mod_len' may be used uninitialized [-Werror=maybe-uninitialized]
> +#| 10009 |                 if (mod_name && strncmp(mod->name, mod_name, mod_len) != 0)
> +#|       |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> +#| libbpf.c:9979:21: note: 'mod_len' was declared here
> +#|  9979 |         int ret, i, mod_len;
> +#|       |                     ^~~~~~~
> +#| cc1: all warnings being treated as errors
> +TARGET_CC_ARCH:append:toolchain-clang:arm = " -fno-error=maybe-uninitialized"
> +
> EXTRA_OEMAKE = '\
>     V=1 \
>     VF=1 \
> 
> -- 
> 2.49.0
> 
> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#216996): https://lists.openembedded.org/g/openembedded-core/message/216996
> Mute This Topic: https://lists.openembedded.org/mt/113225040/6875888
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ross.burton@arm.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Khem Raj June 5, 2025, 3:26 p.m. UTC | #2
On Thu, Jun 5, 2025 at 3:06 AM Ross Burton <Ross.Burton@arm.com> wrote:
>
> I just sent a patch to linux-yocto to silence this at root.
>

Thanks, we need to send a revert for this to OE-core as well once the
linux-yocto change is merged with link to it.

> Ross
>
> > On 21 May 2025, at 07:20, Khem Raj via lists.openembedded.org <raj.khem=gmail.com@lists.openembedded.org> wrote:
> >
> > Clang finds more warnings in kernel code, make clang happy to not treat
> > these extra warnings as errors
> >
> > Signed-off-by: Khem Raj <raj.khem@gmail.com>
> > ---
> > meta/recipes-kernel/perf/perf.bb | 10 ++++++++++
> > 1 file changed, 10 insertions(+)
> >
> > diff --git a/meta/recipes-kernel/perf/perf.bb b/meta/recipes-kernel/perf/perf.bb
> > index d06dd2fa5a2bb9b2982572081ef57e2dbafbd5da..0d19e1bdc222da26a5ad0a1d4964acca437a6692 100644
> > --- a/meta/recipes-kernel/perf/perf.bb
> > +++ b/meta/recipes-kernel/perf/perf.bb
> > @@ -81,6 +81,16 @@ LDFLAGS = "-ldl -lutil"
> > # avoiding the 'buildpaths' QA warning.
> > TARGET_CC_ARCH += "${SELECTED_OPTIMIZATION} ${DEBUG_PREFIX_MAP}"
> >
> > +#| libbpf.c: In function 'find_kernel_btf_id.constprop':
> > +#| libbpf.c:10009:33: error: 'mod_len' may be used uninitialized [-Werror=maybe-uninitialized]
> > +#| 10009 |                 if (mod_name && strncmp(mod->name, mod_name, mod_len) != 0)
> > +#|       |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > +#| libbpf.c:9979:21: note: 'mod_len' was declared here
> > +#|  9979 |         int ret, i, mod_len;
> > +#|       |                     ^~~~~~~
> > +#| cc1: all warnings being treated as errors
> > +TARGET_CC_ARCH:append:toolchain-clang:arm = " -fno-error=maybe-uninitialized"
> > +
> > EXTRA_OEMAKE = '\
> >     V=1 \
> >     VF=1 \
> >
> > --
> > 2.49.0
> >
> >
> > -=-=-=-=-=-=-=-=-=-=-=-
> > Links: You receive all messages sent to this group.
> > View/Reply Online (#216996): https://lists.openembedded.org/g/openembedded-core/message/216996
> > Mute This Topic: https://lists.openembedded.org/mt/113225040/6875888
> > Group Owner: openembedded-core+owner@lists.openembedded.org
> > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ross.burton@arm.com]
> > -=-=-=-=-=-=-=-=-=-=-=-
> >
>
diff mbox series

Patch

diff --git a/meta/recipes-kernel/perf/perf.bb b/meta/recipes-kernel/perf/perf.bb
index d06dd2fa5a2bb9b2982572081ef57e2dbafbd5da..0d19e1bdc222da26a5ad0a1d4964acca437a6692 100644
--- a/meta/recipes-kernel/perf/perf.bb
+++ b/meta/recipes-kernel/perf/perf.bb
@@ -81,6 +81,16 @@  LDFLAGS = "-ldl -lutil"
 # avoiding the 'buildpaths' QA warning.
 TARGET_CC_ARCH += "${SELECTED_OPTIMIZATION} ${DEBUG_PREFIX_MAP}"
 
+#| libbpf.c: In function 'find_kernel_btf_id.constprop':
+#| libbpf.c:10009:33: error: 'mod_len' may be used uninitialized [-Werror=maybe-uninitialized]
+#| 10009 |                 if (mod_name && strncmp(mod->name, mod_name, mod_len) != 0)
+#|       |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#| libbpf.c:9979:21: note: 'mod_len' was declared here
+#|  9979 |         int ret, i, mod_len;
+#|       |                     ^~~~~~~
+#| cc1: all warnings being treated as errors
+TARGET_CC_ARCH:append:toolchain-clang:arm = " -fno-error=maybe-uninitialized"
+
 EXTRA_OEMAKE = '\
     V=1 \
     VF=1 \