[flang-commits] [flang] 93248b5 - [flang] Unify return value of memcpy and memmove (#174048)
via flang-commits
flang-commits at lists.llvm.org
Wed Dec 31 10:34:30 PST 2025
Author: Valentin Clement (バレンタイン クレメン)
Date: 2025-12-31T18:34:26Z
New Revision: 93248b53276e24a9c9fd1b6db896e1c66804f0d8
URL: https://github.com/llvm/llvm-project/commit/93248b53276e24a9c9fd1b6db896e1c66804f0d8
DIFF: https://github.com/llvm/llvm-project/commit/93248b53276e24a9c9fd1b6db896e1c66804f0d8.diff
LOG: [flang] Unify return value of memcpy and memmove (#174048)
memcpy and memmove functions are not all returning a void*. Unify this
so it doesn't make other errors like in #172568
Added:
Modified:
flang/include/flang/Runtime/freestanding-tools.h
Removed:
################################################################################
diff --git a/flang/include/flang/Runtime/freestanding-tools.h b/flang/include/flang/Runtime/freestanding-tools.h
index 7ef7cc74f213b..8f0ae5b3761fa 100644
--- a/flang/include/flang/Runtime/freestanding-tools.h
+++ b/flang/include/flang/Runtime/freestanding-tools.h
@@ -117,9 +117,10 @@ using std::memset;
#endif
#if STD_MEMCPY_USE_BUILTIN
-static inline RT_API_ATTRS void memcpy(
+static inline RT_API_ATTRS void *memcpy(
void *dest, const void *src, std::size_t count) {
__builtin_memcpy(dest, src, count);
+ return dest;
}
#elif STD_MEMCPY_UNSUPPORTED
static inline RT_API_ATTRS void memcpy(
@@ -127,7 +128,7 @@ static inline RT_API_ATTRS void memcpy(
char *to{reinterpret_cast<char *>(dest)};
const char *from{reinterpret_cast<const char *>(src)};
if (to == from) {
- return;
+ return dest;
}
while (count--) {
*to++ = *from++;
@@ -138,9 +139,10 @@ using std::memcpy;
#endif
#if STD_MEMMOVE_USE_BUILTIN
-static inline RT_API_ATTRS void memmove(
+static inline RT_API_ATTRS void *memmove(
void *dest, const void *src, std::size_t count) {
__builtin_memmove(dest, src, count);
+ return dest;
}
#elif STD_MEMMOVE_UNSUPPORTED
// Provides alternative implementation for std::memmove(), if
More information about the flang-commits
mailing list