Avoid loplugin:redundantcast on macOS with recent LLVM 21 trunk

...including
<b6b0257972>
"Fix the signature for __builtin___clear_cache (#134376)", which now caused

> bridges/source/cpp_uno/gcc3_linux_aarch64/cpp2uno.cxx:601:9: error: redundant reinterpret_cast, result is implicitly cast to void pointer [loplugin:redundantcast]
>   601 |         reinterpret_cast<char *>(const_cast<unsigned char *>(begin)),
>       |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> bridges/source/cpp_uno/gcc3_linux_aarch64/cpp2uno.cxx:602:9: error: redundant reinterpret_cast, result is implicitly cast to void pointer [loplugin:redundantcast]
>   602 |         reinterpret_cast<char *>(const_cast<unsigned char *>(end)));
>       |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Change-Id: I38e230af517a71016a7afaea4b72ffc91b00ef3d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184499
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
This commit is contained in:
Stephan Bergmann
2025-04-23 13:17:21 +02:00
parent d39e1b0463
commit 28e542dc61

View File

@@ -588,7 +588,7 @@ void bridges::cpp_uno::shared::VtableFactory::flushCode(
= (void (*)(unsigned char const *, unsigned char const *)) dlsym(
RTLD_DEFAULT, "__clear_cache");
(*clear_cache)(begin, end);
#else
#elif defined __clang_major__ && __clang_major__ < 21
// GCC clarified with
// <http://gcc.gnu.org/git/?p=gcc.git;a=commit;h=a90b0cdd444f6dde1084a439862cf507f6d3b2ae>
// "extend.texi (__clear_cache): Correct signature" that __builtin___clear_cache takes void*
@@ -600,6 +600,8 @@ void bridges::cpp_uno::shared::VtableFactory::flushCode(
__builtin___clear_cache(
reinterpret_cast<char *>(const_cast<unsigned char *>(begin)),
reinterpret_cast<char *>(const_cast<unsigned char *>(end)));
#else
__builtin___clear_cache(const_cast<unsigned char *>(begin), const_cast<unsigned char *>(end));
#endif
}