Building a testdir of all of gnulib on Android, in Termux, I see these compilation errors:
../gllib/string.h:2066:19: error: use of undeclared identifier 'strerrorname_np'; did you mean 'gnulib::strerrorname_np'? ../gllib/string.h:974:19: error: use of undeclared identifier 'memset_explicit'; did you mean 'gnulib::memset_explicit'? ../gllib/time.h:726:19: error: use of undeclared identifier 'timespec_getres'; did you mean 'gnulib::timespec_getres'? ../gllib/unistd.h:1006:19: error: use of undeclared identifier 'copy_file_range'; did you mean 'gnulib::copy_file_range'? This patch should fix them. 2025-03-20 Bruno Haible <br...@clisp.org> Fix compilation errors in C++ mode on Android. * lib/string.in.h (memset_explicit, strerrorname_np): Disable _GL_CXXALIASWARN invocation on non-glibc systems. * lib/time.in.h (timespec_getres): Likewise. * lib/unistd.in.h (copy_file_range): Likewise. diff --git a/lib/string.in.h b/lib/string.in.h index 0093fea096..e6bf675151 100644 --- a/lib/string.in.h +++ b/lib/string.in.h @@ -434,7 +434,9 @@ _GL_FUNCDECL_SYS (memset_explicit, void *, # endif _GL_CXXALIAS_SYS (memset_explicit, void *, (void *__dest, int __c, size_t __n)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (memset_explicit); +# endif #elif defined GNULIB_POSIXCHECK # undef memset_explicit # if HAVE_RAW_DECL_MEMSET_EXPLICIT @@ -1526,7 +1528,9 @@ _GL_FUNCDECL_SYS (strerrorname_np, const char *, (int errnum), ); # endif _GL_CXXALIAS_SYS (strerrorname_np, const char *, (int errnum)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (strerrorname_np); +# endif #elif defined GNULIB_POSIXCHECK # undef strerrorname_np # if HAVE_RAW_DECL_STRERRORNAME_NP diff --git a/lib/time.in.h b/lib/time.in.h index 60801c972c..3ff16e3b3e 100644 --- a/lib/time.in.h +++ b/lib/time.in.h @@ -186,7 +186,9 @@ _GL_FUNCDECL_SYS (timespec_getres, int, (struct timespec *ts, int base), # endif _GL_CXXALIAS_SYS (timespec_getres, int, (struct timespec *ts, int base)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (timespec_getres); +# endif # elif defined GNULIB_POSIXCHECK # undef timespec_getres # if HAVE_RAW_DECL_TIMESPEC_GETRES diff --git a/lib/unistd.in.h b/lib/unistd.in.h index bfb4817726..56cc84f379 100644 --- a/lib/unistd.in.h +++ b/lib/unistd.in.h @@ -466,7 +466,9 @@ _GL_CXXALIAS_SYS (copy_file_range, ssize_t, (int ifd, off_t *ipos, int ofd, off_t *opos, size_t len, unsigned flags)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (copy_file_range); +# endif #elif defined GNULIB_POSIXCHECK # undef copy_file_range # if HAVE_RAW_DECL_COPY_FILE_RANGE