[PATCH 2/4] ell: Fix rawmemchr implementation warning in Alpine/clang
Bastien Nocera <[email protected]> Tue, 17 Mar 2026 15:28:55 +0100
| Newsgroups | dev.linux.lists.ell |
|---|---|
| Message-ID | <[email protected]> |
rawmemchr() is not available under Alpine, it's a glibc function, which
means our local implementation is used. That implementation tried to
disable GCC specific warnings which aren't available under clang, so
disable the pragma statements to disable the warnings when run under
clang.
In file included from ../ell/random.c:20:
../ell/missing.h:61:1: warning: unknown warning group '-Wstringop-overflow=', ignored [-Wunknown-warning-option]
61 | _Pragma("GCC diagnostic ignored \"-Wstringop-overflow=\"")
| ^
<scratch space>:20:25: note: expanded from here
20 | GCC diagnostic ignored "-Wstringop-overflow="
| ^
1 warning generated.
[repeated many times]
---
ell/missing.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/ell/missing.h b/ell/missing.h
index b1ee0f147538..5b4f31675361 100644
--- a/ell/missing.h
+++ b/ell/missing.h
@@ -56,9 +56,13 @@ static inline void explicit_bzero(void *s, size_t n)
#ifndef HAVE_RAWMEMCHR
static inline void *rawmemchr(const void *s, int c)
{
+#if defined(__GNUC__) && !defined(__clang__)
_Pragma("GCC diagnostic push")
_Pragma("GCC diagnostic ignored \"-Wstringop-overflow=\"")
+#endif /* gcc && !clang */
return memchr(s, c, PTRDIFF_MAX);
+#if defined(__GNUC__) && !defined(__clang__)
_Pragma("GCC diagnostic pop")
+#endif /* gcc && !clang */
}
#endif
--
2.53.0