[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: time_rz.c and Android NDK r27
From: |
Bruno Haible |
Subject: |
Re: time_rz.c and Android NDK r27 |
Date: |
Wed, 04 Sep 2024 20:18:43 +0200 |
Hi Po Lu,
> This new release of the Android NDK defines timezone_t in time.h whether
> or not it defines the related tzalloc and localtime_rz extensions, which
> being new APIs are controlled by __ANDROID_API__ as expected.
> Consequently, when building for earlier Android releases with this NDK,
> Emacs compilation reports:
>
> CC nproc.o
> CC nstrftime.o
> In file included from nstrftime.c:19:
> ./strftime.c:1900:17: error: call to undeclared function 'mktime_z'; ISO C99
> and later do not support implicit function declarations
> [-Wimplicit-function-declaration]
> 1900 | t = mktime_z (tz, <m);
> | ^
> ./strftime.c:1900:17: note: did you mean 'mktime'?
> /opt/android/android-ndk-r27/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/time.h:159:8:
> note: 'mktime' declared here
> 159 | time_t mktime(struct tm* _Nonnull __tm);
> | ^
> 1 error generated.
Thanks for the report. The major mistake we've been doing here is to
assume that the presence of timezone_t is equivalent to the presence of the
functions tzalloc, tzfree, localtime_rz, mktime_z.
The following patches should fix it. Tested only on glibc systems and NetBSD.
If you could test it on Android, with
CC="clang -target armv7a-unknown-linux-android34"
and
CC="clang -target armv7a-unknown-linux-android35"
that would be welcome!
Bruno
2024-09-04 Bruno Haible <bruno@clisp.org>
Resolve conflicts for functions introduced in Android API level 35.
Reported by Po Lu <luangruo@yahoo.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-09/msg00024.html>.
* lib/time.in.h (timezone_t, tzalloc, tzfree): Don't require _GNU_SOURCE
to be defined. Define depending on HAVE_TZALLOC, not HAVE_TIMEZONE_T.
(localtime_rz, mktime_z): Likewise. Override if REPLACE_LOCALTIME_RZ or
REPLACE_MKTIME_Z is 1, respectively.
* lib/time_rz.c: If NEED_TIMEZONE_NULL_SUPPORT, define only localtime_rz
and mktime_z and only as wrappers around the system function.
* m4/time_h.m4 (gl_TIME_H_DEFAULTS): Initialize HAVE_TZALLOC,
REPLACE_LOCALTIME_RZ, REPLACE_MKTIME_Z.
* m4/time_rz.m4 (gl_TIME_RZ): Conditionally set HAVE_TZALLOC,
REPLACE_LOCALTIME_RZ, REPLACE_MKTIME_Z. Conditionally define
NEED_TIMEZONE_NULL_SUPPORT.
* modules/time-h (Makefile.am): Substitute HAVE_TZALLOC,
REPLACE_LOCALTIME_RZ, REPLACE_MKTIME_Z.
* modules/time_rz (Depends-on, configure.ac): Consider HAVE_TZALLOC,
REPLACE_LOCALTIME_RZ, REPLACE_MKTIME_Z. Ignore HAVE_TIMEZONE_T.
* m4/strerrorname_np.m4 (gl_FUNC_COPY_FILE_RANGE): Conditionally set
REPLACE_STRERRORNAME_NP.
(gl_CHECK_STRERRORNAME_NP): Test for strerrorname_np using
gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS.
0001-Resolve-conflicts-for-functions-introduced-in-Androi.patch
Description: Text Data
0002-Resolve-conflicts-for-functions-introduced-in-Androi.patch
Description: Text Data