Date: Mon, 15 Dec 2025 15:03:04 +0000 From: Ed Maste <emaste@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Cc: Alex Richardson <arichardson@FreeBSD.org> Subject: git: ca149d75e9bd - stable/15 - libc++: silence -Wnontrivial-memaccess warning with newer clang Message-ID: <69402328.3a8be.44f1a6d1@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch stable/15 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=ca149d75e9bd6455abc3c74e7db160464cfabbdb commit ca149d75e9bd6455abc3c74e7db160464cfabbdb Author: Alex Richardson <arichardson@FreeBSD.org> AuthorDate: 2025-09-15 22:14:18 +0000 Commit: Ed Maste <emaste@FreeBSD.org> CommitDate: 2025-12-15 15:02:09 +0000 libc++: silence -Wnontrivial-memaccess warning with newer clang Apply part of LLVM commit 71315698c91d0cda054b903da0594ca6f072c350 to silence the -Wnontrivial-memaccess warning that is triggered any time this function is instantiated by user code. This fixes another buildworld failure with Clang HEAD. Original commit message: [clang] Warn about memset/memcpy to NonTriviallyCopyable types (#111434) This implements a warning that's similar to what GCC does in that context: both memcpy and memset require their first and second operand to be trivially copyable, let's warn if that's not the case. Reviewed by: emaste, dim MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D52534 (cherry picked from commit 34a006eaa39ceb6b0a96fa386c9b9b8a44681979) --- .../llvm-project/libcxx/include/__memory/uninitialized_algorithms.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/llvm-project/libcxx/include/__memory/uninitialized_algorithms.h b/contrib/llvm-project/libcxx/include/__memory/uninitialized_algorithms.h index 7475ef5cf85d..79cab80dcf73 100644 --- a/contrib/llvm-project/libcxx/include/__memory/uninitialized_algorithms.h +++ b/contrib/llvm-project/libcxx/include/__memory/uninitialized_algorithms.h @@ -642,7 +642,8 @@ __uninitialized_allocator_relocate(_Alloc& __alloc, _Tp* __first, _Tp* __last, _ __guard.__complete(); std::__allocator_destroy(__alloc, __first, __last); } else { - __builtin_memcpy(const_cast<__remove_const_t<_Tp>*>(__result), __first, sizeof(_Tp) * (__last - __first)); + // Casting to void* to suppress clang complaining that this is technically UB. + __builtin_memcpy(static_cast<void*>(const_cast<__remove_const_t<_Tp>*>(__result)), __first, sizeof(_Tp) * (__last - __first)); } }help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69402328.3a8be.44f1a6d1>
