bug-gnulib
[Top][All Lists]
Advanced

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

static inlines in headers on Android


From: Bruno Haible
Subject: static inlines in headers on Android
Date: Sun, 13 May 2018 20:59:43 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-119-generic; KDE/5.18.0; x86_64; ; )

Compiling a testdir for Android 4.3, I get errors like these:

In file included from 
/ANDROID_SDK/ndk-bundle/sysroot/usr/include/stdlib.h:263:0,
                 from ../gllib/stdlib.h:36,
                 from macros.h:22,
                 from test-hypotl.c:29:
/ANDROID_SDK/ndk-bundle/sysroot/usr/include/android/legacy_stdlib_inlines.h:76:22:
 error: static declaration of 'random' follows non-static declaration
 static __inline long random(void) { return lrand48(); }
                      ^
In file included from test-hypotl.c:21:0:
../gllib/stdlib.h:1038:1: note: previous declaration of 'random' was here
 _GL_FUNCDECL_SYS (random, long, (void));
 ^
In file included from 
/ANDROID_SDK/ndk-bundle/sysroot/usr/include/stdlib.h:263:0,
                 from ../gllib/stdlib.h:36,
                 from macros.h:22,
                 from test-hypotl.c:29:
/ANDROID_SDK/ndk-bundle/sysroot/usr/include/android/legacy_stdlib_inlines.h:78:22:
 error: static declaration of 'srandom' follows non-static declaration
 static __inline void srandom(unsigned int __s) { srand48(__s); }
                      ^
In file included from test-hypotl.c:21:0:
../gllib/stdlib.h:1052:1: note: previous declaration of 'srandom' was here
 _GL_FUNCDECL_SYS (srandom, void, (unsigned int seed));
 ^
In file included from 
/ANDROID_SDK/ndk-bundle/sysroot/usr/include/stdlib.h:263:0,
                 from ../gllib/stdlib.h:36,
                 from macros.h:22,
                 from test-hypotl.c:29:
/ANDROID_SDK/ndk-bundle/sysroot/usr/include/android/legacy_stdlib_inlines.h:80:21:
 error: static declaration of 'grantpt' follows non-static declaration
 static __inline int grantpt(int __fd __attribute((unused))) {
                     ^
In file included from test-hypotl.c:21:0:
../gllib/stdlib.h:724:1: note: previous declaration of 'grantpt' was here
 _GL_FUNCDECL_SYS (grantpt, int, (int fd));
 ^

The reason  is that the Android headers define a number of system functions
through 'static inline'. This is the complete list:

./android/legacy_fenv_inlines_arm.h:static __inline int feclearexcept(int 
__excepts) {
./android/legacy_fenv_inlines_arm.h:static __inline int fedisableexcept(int 
__mask __unused) {
./android/legacy_fenv_inlines_arm.h:static __inline int feenableexcept(int 
__mask __unused) {
./android/legacy_fenv_inlines_arm.h:static __inline int fegetenv(fenv_t* 
__envp) {
./android/legacy_fenv_inlines_arm.h:static __inline int fegetexcept(void) {
./android/legacy_fenv_inlines_arm.h:static __inline int 
fegetexceptflag(fexcept_t* __flagp, int __excepts) {
./android/legacy_fenv_inlines_arm.h:static __inline int fegetround(void) {
./android/legacy_fenv_inlines_arm.h:static __inline int feholdexcept(fenv_t* 
__envp) {
./android/legacy_fenv_inlines_arm.h:static __inline int feraiseexcept(int 
__excepts) {
./android/legacy_fenv_inlines_arm.h:static __inline int fesetenv(const fenv_t* 
__envp) {
./android/legacy_fenv_inlines_arm.h:static __inline int fesetexceptflag(const 
fexcept_t* __flagp, int __excepts) {
./android/legacy_fenv_inlines_arm.h:static __inline int fesetround(int __round) 
{
./android/legacy_fenv_inlines_arm.h:static __inline int fetestexcept(int 
__excepts) {
./android/legacy_fenv_inlines_arm.h:static __inline int feupdateenv(const 
fenv_t* __envp) {
./android/legacy_signal_inlines.h:static __inline int sigaddset(sigset_t *set, 
int signum) {
./android/legacy_signal_inlines.h:static __inline int sigdelset(sigset_t *set, 
int signum) {
./android/legacy_signal_inlines.h:static __inline int sigemptyset(sigset_t 
*set) {
./android/legacy_signal_inlines.h:static __inline int sigfillset(sigset_t *set) 
{
./android/legacy_signal_inlines.h:static __inline int sigismember(const 
sigset_t *set, int signum) {
./android/legacy_signal_inlines.h:static __inline sighandler_t signal(int s, 
sighandler_t f) {
./android/legacy_stdlib_inlines.h:static __inline double atof(const char *nptr) 
{ return (strtod(nptr, NULL)); }
./android/legacy_stdlib_inlines.h:static __inline double strtod_l(const char* 
__s, char** __end_ptr, locale_t __l) {
./android/legacy_stdlib_inlines.h:static __inline float strtof(const char* 
nptr, char** endptr) {
./android/legacy_stdlib_inlines.h:static __inline float strtof_l(const char* 
__s, char** __end_ptr, locale_t __l) {
./android/legacy_stdlib_inlines.h:static __inline int abs(int __n) { return 
(__n < 0) ? -__n : __n; }
./android/legacy_stdlib_inlines.h:static __inline int grantpt(int __fd 
__attribute((unused))) {
./android/legacy_stdlib_inlines.h:static __inline int rand(void) { return 
(int)lrand48(); }
./android/legacy_stdlib_inlines.h:static __inline long labs(long __n) { return 
(__n < 0L) ? -__n : __n; }
./android/legacy_stdlib_inlines.h:static __inline long long llabs(long long 
__n) {
./android/legacy_stdlib_inlines.h:static __inline long random(void) { return 
lrand48(); }
./android/legacy_stdlib_inlines.h:static __inline long strtol_l(const char* 
__s, char** __end_ptr, int __base, locale_t __l) {
./android/legacy_stdlib_inlines.h:static __inline void srand(unsigned int __s) 
{ srand48(__s); }
./android/legacy_stdlib_inlines.h:static __inline void srandom(unsigned int 
__s) { srand48(__s); }
./android/legacy_strings_inlines.h:static __inline int ffs(int __n) { return 
__builtin_ffs(__n); }
./android/legacy_sys_stat_inlines.h:static __inline int mkfifo(const char* 
__path, mode_t __mode) {
./android/legacy_sys_wait_inlines.h:static __inline pid_t wait4(pid_t pid, int* 
status, int options, struct rusage* rusage) {
./bits/termios_inlines.h:static __inline speed_t cfgetspeed(const struct 
termios* s) {
./bits/termios_inlines.h:__BIONIC_TERMIOS_INLINE speed_t cfgetispeed(const 
struct termios* s) {
./bits/termios_inlines.h:__BIONIC_TERMIOS_INLINE speed_t cfgetospeed(const 
struct termios* s) {
./bits/termios_inlines.h:__BIONIC_TERMIOS_INLINE void cfmakeraw(struct termios* 
s) {
./bits/termios_inlines.h:__BIONIC_TERMIOS_INLINE int cfsetspeed(struct termios* 
s, speed_t speed) {
./bits/termios_inlines.h:__BIONIC_TERMIOS_INLINE int cfsetispeed(struct 
termios* s, speed_t speed) {
./bits/termios_inlines.h:__BIONIC_TERMIOS_INLINE int cfsetospeed(struct 
termios* s, speed_t speed) {
./bits/termios_inlines.h:__BIONIC_TERMIOS_INLINE int tcdrain(int fd) {
./bits/termios_inlines.h:__BIONIC_TERMIOS_INLINE int tcflow(int fd, int action) 
{
./bits/termios_inlines.h:__BIONIC_TERMIOS_INLINE int tcflush(int fd, int queue) 
{
./bits/termios_inlines.h:__BIONIC_TERMIOS_INLINE int tcgetattr(int fd, struct 
termios* s) {
./bits/termios_inlines.h:__BIONIC_TERMIOS_INLINE pid_t tcgetsid(int fd) {
./bits/termios_inlines.h:__BIONIC_TERMIOS_INLINE int tcsendbreak(int fd, int 
duration) {
./bits/termios_inlines.h:__BIONIC_TERMIOS_INLINE int tcsetattr(int fd, int 
optional_actions, const struct termios* s) {
./unistd.h:static __inline__ int getpagesize(void) {

A number of these are interacting with gnulib. I'm applying these fixes.


2018-05-13  Bruno Haible  <address@hidden>

        getpagesize: Fix compilation error on Android.
        * m4/getpagesize.m4 (gl_CHECK_FUNC_GETPAGESIZE): New macro.
        (gl_FUNC_GETPAGESIZE): Invoke it instead of AC_CHECK_FUNC.
        * m4/getcwd-abort-bug.m4 (gl_FUNC_GETCWD_ABORT_BUG): Don't invoke
        AC_CHECK_FUNC. Instead, invoke gl_CHECK_FUNC_GETPAGESIZE and define
        HAVE_GETPAGESIZE accordingly.
        * modules/getcwd (Files): Add m4/getpagesize.m4.

2018-05-13  Bruno Haible  <address@hidden>

        tcgetsid: Fix compilation error on Android.
        * m4/tcgetsid.m4 (gl_FUNC_TCGETSID): Use AC_LINK_IFELSE instead of
        AC_CHECK_FUNC.

2018-05-13  Bruno Haible  <address@hidden>

        getpass: Fix configure test for Android.
        * m4/getpass.m4 (gl_PREREQ_GETPASS): Use AC_LINK_IFELSE instead of
        AC_CHECK_FUNC.

2018-05-13  Bruno Haible  <address@hidden>

        ffs: Fix compilation error on Android.
        * m4/ffs.m4 (gl_FUNC_FFS): Use AC_LINK_IFELSE instead of AC_CHECK_FUNC.

2018-05-13  Bruno Haible  <address@hidden>

        mkfifo: Fix compilation error on Android.
        * m4/mkfifo.m4 (gl_FUNC_MKFIFO): Use AC_LINK_IFELSE instead of
        AC_CHECK_FUNC.

2018-05-13  Bruno Haible  <address@hidden>

        c-strtod: Fix configure test for Android.
        * m4/c-strtod.m4 (gl_C_STRTOD): Use AC_LINK_IFELSE instead of
        AC_CHECK_FUNC.

2018-05-13  Bruno Haible  <address@hidden>

        random: Fix compilation error on Android.
        * m4/random.m4 (gl_FUNC_RANDOM): Use AC_LINK_IFELSE instead of
        AC_CHECK_FUNC.

2018-05-13  Bruno Haible  <address@hidden>

        grantpt: Fix compilation error on Android.
        * m4/grantpt.m4 (gl_FUNC_GRANTPT): Use AC_LINK_IFELSE instead of
        AC_CHECK_FUNC.

Attachment: 0001-grantpt-Fix-compilation-error-on-Android.patch
Description: Text Data

Attachment: 0002-random-Fix-compilation-error-on-Android.patch
Description: Text Data

Attachment: 0003-c-strtod-Fix-configure-test-for-Android.patch
Description: Text Data

Attachment: 0004-mkfifo-Fix-compilation-error-on-Android.patch
Description: Text Data

Attachment: 0005-ffs-Fix-compilation-error-on-Android.patch
Description: Text Data

Attachment: 0006-getpass-Fix-configure-test-for-Android.patch
Description: Text Data

Attachment: 0007-tcgetsid-Fix-compilation-error-on-Android.patch
Description: Text Data

Attachment: 0008-getpagesize-Fix-compilation-error-on-Android.patch
Description: Text Data


reply via email to

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