bridges/source/cpp_uno/gcc3_linux_aarch64/cpp2uno.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 1ccb2ecd4e3e883e7a715b0b0f13c2e57d120b45
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Tue Oct 14 12:09:35 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Tue Oct 14 17:42:20 2025 +0200

    linux_aarch64: Fix Android build with NDK 29
    
    An Android build including autogen options
    
        --with-android-ndk=$HOME/Android/Sdk/ndk/29.0.14206865
        --with-distro=LibreOfficeAndroidAarch64
    
    failed like this:
    
        .../bridges/source/cpp_uno/gcc3_linux_aarch64/cpp2uno.cxx:604:29: 
error: cannot initialize a parameter of type 'char *' with an rvalue of type 
'unsigned char *'
          604 |     __builtin___clear_cache(const_cast<unsigned char *>(begin), 
const_cast<unsigned char *>(end));
              |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        1 error generated.
    
    Tweak the version check introduced in
    
        commit 28e542dc61d408f5807e8c94ed48c273146edbda
        Date:   Wed Apr 23 13:17:21 2025 +0200
    
            Avoid loplugin:redundantcast on macOS with recent LLVM 21 trunk
    
            ...including
            
<https://github.com/llvm/llvm-project/commit/b6b025797245a5e5416b522df041252e3c4ff868>
            "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)));
            >       |         
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    to not expect the new signature for Android NDK <= 29,
    for which __clang_major__ is 21, but which doesn't have the
    relevant commit mentioned in the commit message quoted above.
    
    The NDK 29 release notes mention [1]:
    
    > Updated LLVM to clang-r563880c. See clang_source_info.md in the toolchain
    > directory for version information.
    
    
~/Android/Sdk/ndk/29.0.14206865/toolchains/llvm/prebuilt/linux-x86_64/clang_source_info.md
    contains this:
    
    > Base revision: 
[386af4a5c64ab75eaee2448dc38f2e34a40bfed0](https://github.com/llvm/llvm-project/commits/386af4a5c64ab75eaee2448dc38f2e34a40bfed0)
    
    That referenced llvm-projects commit
    386af4a5c64ab75eaee2448dc38f2e34a40bfed0 is indeed before
    the b6b025797245a5e5416b522df041252e3c4ff868 one mentioned
    above.
    
    [1] https://github.com/android/ndk/wiki/Changelog-r29
    
    Change-Id: I88419d0d8d47563d6d0d236dc17806979e56c831
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192378
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/bridges/source/cpp_uno/gcc3_linux_aarch64/cpp2uno.cxx 
b/bridges/source/cpp_uno/gcc3_linux_aarch64/cpp2uno.cxx
index 8b41a9ae1119..e4f7029e667b 100644
--- a/bridges/source/cpp_uno/gcc3_linux_aarch64/cpp2uno.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_aarch64/cpp2uno.cxx
@@ -588,7 +588,7 @@ void bridges::cpp_uno::shared::VtableFactory::flushCode(
         = reinterpret_cast<void (*)(unsigned char const *, unsigned char const 
*)>
             (dlsym(RTLD_DEFAULT, "__clear_cache"));
     (*clear_cache)(begin, end);
-#elif defined __clang_major__ && __clang_major__ < 21
+#elif (defined __clang_major__ && __clang_major__ < 21) || (defined ANDROID && 
__NDK_MAJOR__ <= 29)
     // 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*

Reply via email to