[glibc] Fix -Wconstant-logical-operand error for Hurd
Joseph Myers via Glibc-cvs <[email protected]> Wed, 10 Jun 2026 18:50:22 +0000 (GMT)
| Newsgroups | gmane.comp.lib.glibc.cvs |
|---|---|
| Message-ID | <[email protected]> |
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=8ae37adb211a71a685f0ef3f9b9e18beb439198f commit 8ae37adb211a71a685f0ef3f9b9e18beb439198f Author: Joseph Myers <[email protected]> Date: Wed Jun 10 18:49:53 2026 +0000 Fix -Wconstant-logical-operand error for Hurd Building for Hurd with GCC mainline produces an error in pt-block.c (here MSG_OPTIONS is a macro that may be defined before pt-block.c is included by another source file): In file included from ../sysdeps/mach/htl/pt-block-intr.c:6: ../sysdeps/mach/htl/pt-block.c: In function '__pthread_block_intr': ../sysdeps/mach/htl/pt-block.c:49:42: error: use of logical '&&' with constant operand '1024' [-Werror=constant-logical-operand] 49 | if ((MSG_OPTIONS & MACH_RCV_INTERRUPT) && err == MACH_RCV_INTERRUPTED) | ^~ ../sysdeps/mach/htl/pt-block.c:49:42: note: use '&' for bitwise operation 49 | if ((MSG_OPTIONS & MACH_RCV_INTERRUPT) && err == MACH_RCV_INTERRUPTED) | ^~ | & Fix this, and a similar error in pt-timedblock.c, with an explicit != 0. Tested with build-many-glibcs.py (compilers and glibcs builds) for i686-gnu and x86_64-gnu. Diff: --- sysdeps/mach/htl/pt-block.c | 2 +- sysdeps/mach/htl/pt-timedblock.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sysdeps/mach/htl/pt-block.c b/sysdeps/mach/htl/pt-block.c index 40f65130bb..efc58059f0 100644 --- a/sysdeps/mach/htl/pt-block.c +++ b/sysdeps/mach/htl/pt-block.c @@ -46,7 +46,7 @@ __pthread_block (struct __pthread *thread) err = __mach_msg (&msg, MACH_RCV_MSG | MSG_OPTIONS, 0, sizeof msg, thread->wakeupmsg.msgh_remote_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); - if ((MSG_OPTIONS & MACH_RCV_INTERRUPT) && err == MACH_RCV_INTERRUPTED) + if ((MSG_OPTIONS & MACH_RCV_INTERRUPT) != 0 && err == MACH_RCV_INTERRUPTED) RETURN(EINTR); assert_perror (err); RETURN(0); diff --git a/sysdeps/mach/htl/pt-timedblock.c b/sysdeps/mach/htl/pt-timedblock.c index 99fdcd0dec..06244bde6c 100644 --- a/sysdeps/mach/htl/pt-timedblock.c +++ b/sysdeps/mach/htl/pt-timedblock.c @@ -63,7 +63,7 @@ __pthread_timedblock (struct __pthread *thread, timeout, MACH_PORT_NULL); if (err == EMACH_RCV_TIMED_OUT) return ETIMEDOUT; - if ((MSG_OPTIONS & MACH_RCV_INTERRUPT) && err == MACH_RCV_INTERRUPTED) + if ((MSG_OPTIONS & MACH_RCV_INTERRUPT) != 0 && err == MACH_RCV_INTERRUPTED) return EINTR; assert_perror (err);