diff mbox series

[v2,25/28] seatd: Disable sign-compare warning as error on clang

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

Commit Message

Khem Raj May 21, 2025, 6:20 a.m. UTC
Make it build with clang+musl combo

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-core/seatd/seatd_0.9.1.bb | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Alexander Kanavin May 22, 2025, 10:17 a.m. UTC | #1
On Wed, 21 May 2025 at 08:20, Khem Raj via lists.openembedded.org
<raj.khem=gmail.com@lists.openembedded.org> wrote:
> +#../git/common/connection.c:154:55: error: comparison of integers of different signs: 'unsigned long' and 'long' [-Werror,-Wsign-compare]
> +#  154 |         for (cmsg = CMSG_FIRSTHDR(msg); cmsg != NULL; cmsg = CMSG_NXTHDR(msg, cmsg)) {
> +#      |                                                              ^~~~~~~~~~~~~~~~~~~~~~
> +#/mnt/b/yoe/master/sources/poky/build/tmp/work/riscv64-poky-linux-musl/seatd/0.9.1/recipe-sysroot/usr/include/sys/socket.h:358:44: note: expanded from macro 'CMSG_NXTHDR'
> +#  358 |         __CMSG_LEN(cmsg) + sizeof(struct cmsghdr) >= __MHDR_END(mhdr) - (unsigned char *)(cmsg) \
> +#      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> +#1 error generated.
> +CFLAGS:append:libc-musl:toolchain-clang = " -Wno-error=sign-compare"

This is silencing an error, and it would be better to fix the issue
instead. Also, why is it musl-specific?

Alex
Khem Raj May 22, 2025, 3:04 p.m. UTC | #2
On Thu, May 22, 2025 at 3:17 AM Alexander Kanavin
<alex.kanavin@gmail.com> wrote:
>
> On Wed, 21 May 2025 at 08:20, Khem Raj via lists.openembedded.org
> <raj.khem=gmail.com@lists.openembedded.org> wrote:
> > +#../git/common/connection.c:154:55: error: comparison of integers of different signs: 'unsigned long' and 'long' [-Werror,-Wsign-compare]
> > +#  154 |         for (cmsg = CMSG_FIRSTHDR(msg); cmsg != NULL; cmsg = CMSG_NXTHDR(msg, cmsg)) {
> > +#      |                                                              ^~~~~~~~~~~~~~~~~~~~~~
> > +#/mnt/b/yoe/master/sources/poky/build/tmp/work/riscv64-poky-linux-musl/seatd/0.9.1/recipe-sysroot/usr/include/sys/socket.h:358:44: note: expanded from macro 'CMSG_NXTHDR'
> > +#  358 |         __CMSG_LEN(cmsg) + sizeof(struct cmsghdr) >= __MHDR_END(mhdr) - (unsigned char *)(cmsg) \
> > +#      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > +#1 error generated.
> > +CFLAGS:append:libc-musl:toolchain-clang = " -Wno-error=sign-compare"
>
> This is silencing an error, and it would be better to fix the issue
> instead. Also, why is it musl-specific?

It does not look like a problem in the package but rather something in
system headers from musl since CMSG_NXTHDR is from sys/socket.h thats
why its done
the way it is. I am working with musl to see if this is the right
behavior for musl

>
> Alex
diff mbox series

Patch

diff --git a/meta/recipes-core/seatd/seatd_0.9.1.bb b/meta/recipes-core/seatd/seatd_0.9.1.bb
index 8ee43a3dc8f61eeb6f1c03dbd5a68585fa471424..87e1c3b67d69ba29cfde14caf17e3a2010046eac 100644
--- a/meta/recipes-core/seatd/seatd_0.9.1.bb
+++ b/meta/recipes-core/seatd/seatd_0.9.1.bb
@@ -15,6 +15,14 @@  inherit meson pkgconfig systemd update-rc.d useradd
 
 # https://www.openwall.com/lists/musl/2020/01/20/3
 CFLAGS:append:libc-musl:powerpc64le = " -Wno-error=overflow"
+#../git/common/connection.c:154:55: error: comparison of integers of different signs: 'unsigned long' and 'long' [-Werror,-Wsign-compare]
+#  154 |         for (cmsg = CMSG_FIRSTHDR(msg); cmsg != NULL; cmsg = CMSG_NXTHDR(msg, cmsg)) {
+#      |                                                              ^~~~~~~~~~~~~~~~~~~~~~
+#/mnt/b/yoe/master/sources/poky/build/tmp/work/riscv64-poky-linux-musl/seatd/0.9.1/recipe-sysroot/usr/include/sys/socket.h:358:44: note: expanded from macro 'CMSG_NXTHDR'
+#  358 |         __CMSG_LEN(cmsg) + sizeof(struct cmsghdr) >= __MHDR_END(mhdr) - (unsigned char *)(cmsg) \
+#      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#1 error generated.
+CFLAGS:append:libc-musl:toolchain-clang = " -Wno-error=sign-compare"
 
 PACKAGECONFIG ?= " \
 	${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)} \