[PATCH] Fix warning in memrchr.c
Federico Terraneo <[email protected]> Sun, 22 Mar 2026 14:40:38 +0100
| Newsgroups | gmane.comp.lib.newlib |
|---|---|
| Message-ID | <PAVPR08MB88458A36F367EDF9D1820E5AF94AA@PAVPR08MB8845.eurprd08.prod.outlook.com> |
Hi,
the following patch fixes the warning reproted below, introduced by our
previous patch.
Best regards,
Federico Terraneo
../../../newlib-4.6.0.20260123/newlib/libc/string/memrchr.c:50:26:
warning: suggest parentheses around '+' in operand of '&' [-Wparentheses]
50 | while (UNALIGNED_X(src + 1))
../../../newlib-4.6.0.20260123/newlib/libc/string/local.h:24:31: note:
in definition of macro 'UNALIGNED_X'
24 | #define UNALIGNED_X(X) ((long)X & (sizeof (long) - 1))
| ^
0001-libc-string-Fix-warning-in-memrchr.c.patch
(text/x-patch, 948 B)
From 990c134b82aae924bf6b7291aafdb28413f82da2 Mon Sep 17 00:00:00 2001 From: Terraneo Federico <[email protected]> Date: Sun, 22 Mar 2026 12:12:19 +0100 Subject: [PATCH] libc: string: Fix warning in memrchr.c --- newlib/libc/string/local.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/newlib/libc/string/local.h b/newlib/libc/string/local.h index 8cb43f8e3..012a30d16 100644 --- a/newlib/libc/string/local.h +++ b/newlib/libc/string/local.h @@ -21,7 +21,7 @@ int __wcwidth (wint_t); * This macro is used to skip a few bytes to find an aligned pointer. * It's better to keep it as is even if _HAVE_HW_MISALIGNED_ACCESS is enabled, * to avoid small performance penalties (if they are not zero). */ -#define UNALIGNED_X(X) ((long)X & (sizeof (long) - 1)) +#define UNALIGNED_X(X) ((long)(X) & (sizeof (long) - 1)) #ifdef _HAVE_HW_MISALIGNED_ACCESS /* Hardware performs unaligned operations with little -- 2.47.3