emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Android port


From: Bruno Haible
Subject: Re: Android port
Date: Sun, 06 Aug 2023 12:33:32 +0200

Paul Eggert wrote:
> As I understand it the Android port uses Gnulib printf-posix and 
> vasprintf-posix modules only because Android printf lacks support for 
> "%td", "%jd" and "%ju".

No, that's not the case. Android *printf supports the 't', 'j', 'z' already
since 2009-03-04 (ca. Android 1.6).

I don't know what's the minimum supported Android version targetted by Po Lu
is, but for Android 4.3 you find the deficiencies listed in gnulib/m4/printf.m4:

dnl . = yes, # = no.
dnl
dnl                                  1  2  3  4  5  6  7  8  9 10 11 12 13 14 
15 16 17 18 19 20 21 22 23 24
dnl   Android 4.3                    .  #  .  #  #  #  #  #  #  #  #  ?  .  #  
.  #  .  #  .  .  .  #  .  .

Legend:
dnl 2 = checking whether printf supports size specifiers as in C23...
dnl 4 = checking whether printf supports infinite 'double' arguments...
dnl 5 = checking whether printf supports infinite 'long double' arguments...
dnl 6 = checking whether printf supports the 'a' and 'A' directives...
dnl 7 = checking whether printf supports the 'b' directive...
dnl 8 = checking whether printf supports the 'B' directive...
dnl 9 = checking whether printf supports the 'F' directive...
dnl 10 = checking whether printf supports the 'n' directive...
dnl 11 = checking whether printf supports the 'ls' directive...
dnl 12 = checking whether printf supports the 'lc' directive correctly...
dnl 14 = checking whether printf supports the grouping flag...
dnl 16 = checking whether printf supports the zero flag correctly...
dnl 18 = checking whether printf survives out-of-memory conditions...
dnl 22 = checking whether snprintf fully supports the 'n' directive...

> If this understanding is correct, how about if 
> we go through the printf formats in the Emacs C source code, and replace 
> all uses of "%jd" and "%ju" with "%"PRIdMAX and "%"PRIuMAX, and all uses 
> of "%td" with "%"pT"d" where pT is an Emacs invention defined like this:
> 
>   #ifdef __ANDROID__
>   # define pT "z"
>   #else
>   # define pT "t"
>   #endif

This workaround is not needed, since the problem is not there, not for
Android and not for other platforms either: Gnulib's documentation lists
the platforms

  @item
  This function does not support size specifiers as in C99 (@code{hh}, 
@code{ll},
  @code{j}, @code{t}, @code{z}) on some platforms:
  AIX 5.1, HP-UX 11.23, IRIX 6.5, Solaris 9, Cygwin 1.5.24, mingw, MSVC 14.

AIX 5.1, HP-UX 11.23, IRIX 6.5, Solaris 9, Cygwin 1.5.24 are long obsolete,
mingw is dealt with by Emacs differently, and MSVC is not supported by
Emacs (AFAIU).

Bruno






reply via email to

[Prev in Thread] Current Thread [Next in Thread]