mailing list of musl libc
 help / color / mirror / code / Atom feed
* [musl] [PATCH] Avoid compiler warning for dead code
@ 2024-11-26 10:36 Marcus Haehnel
  0 siblings, 0 replies; only message in thread
From: Marcus Haehnel @ 2024-11-26 10:36 UTC (permalink / raw)
  To: musl; +Cc: Marcus Haehnel

When compiling with -Wunreachable-code using clang the code after the
return in the __GNUC__ case triggers a warning. Use #else to avoid the
warning since the code is only useful in non __GNUC__ cases.
---
 src/string/memcpy.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/string/memcpy.c b/src/string/memcpy.c
index 06e88742..f7a6fcd9 100644
--- a/src/string/memcpy.c
+++ b/src/string/memcpy.c
@@ -117,8 +117,8 @@ void *memcpy(void *restrict dest, const void *restrict src, size_t n)
 		*d = *s;
 	}
 	return dest;
-#endif
-
+#else
 	for (; n; n--) *d++ = *s++;
 	return dest;
+#endif
 }
-- 
2.46.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-11-26 10:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-26 10:36 [musl] [PATCH] Avoid compiler warning for dead code Marcus Haehnel

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).