Building read-file.c currently fails on Android (ARM): arm-linux-androideabi-gcc -DHAVE_CONFIG_H -I. -I.. -DGNULIB_STRICT_CHECKING=1 -g -O2 -MT read-file.o -MD -MP -MF .deps/read-file.Tpo -c -o read-file.o read-file.c read-file.c: In function 'fread_file': read-file.c:62:17: error: 'SIZE_MAX' undeclared (first use in this function) read-file.c:62:17: note: each undeclared identifier is reported only once for each function it appears in make[4]: *** [read-file.o] Error 1
Bionic puts SIZE_MAX in <limits.h>, but gnulib tries to make it available from our stdint.h. However, the logic in our stdint.h intended to prevent circular dependencies inadvertently causes the SIZE_MAX definition to be omitted in some situations. * lib/sys_types.in.h (_GL_INCLUDING_UNISTD_H): New macro, to work around potential circular dependencies when stdint.h is included by the system's sys/types.h. * lib/stdint.in.h: Use _GL_INCLUDING_UNISTD_H to figure out if we're being included from sys/types.h, as merely checking _SYS_TYPES_H_ could return true if sys/types.h had been previously included. * modules/stdint (Depends-on): Add sys_types. --- ChangeLog | 12 ++++++++++++ lib/stdint.in.h | 3 +-- lib/sys_types.in.h | 2 ++ modules/stdint | 1 + 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4e1984c..17b9b88 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2014-03-04 Kevin Cernekee <cerne...@gmail.com> + + stdint, read-file: fix missing SIZE_MAX on Android + * lib/sys_types.in.h (_GL_INCLUDING_UNISTD_H): New macro, to work + around potential circular dependencies when stdint.h is included + by the system's sys/types.h. + * lib/stdint.in.h: Use _GL_INCLUDING_UNISTD_H to figure out if + we're being included from sys/types.h, as merely checking + _SYS_TYPES_H_ could return true if sys/types.h had been previously + included. + * modules/stdint (Depends-on): Add sys_types. + 2014-02-26 Pádraig Brady <p...@draigbrady.com> parse-datetime: fix crash or infloop in TZ="" parsing diff --git a/lib/stdint.in.h b/lib/stdint.in.h index 91fad37..98ee423 100644 --- a/lib/stdint.in.h +++ b/lib/stdint.in.h @@ -38,8 +38,7 @@ other system header files; just include the system's <stdint.h>. Ideally we should test __BIONIC__ here, but it is only defined after <sys/cdefs.h> has been included; hence test __ANDROID__ instead. */ -#if defined __ANDROID__ \ - && defined _SYS_TYPES_H_ && !defined __need_size_t +#if defined __ANDROID__ && defined _GL_INCLUDING_SYS_TYPES_H # @INCLUDE_NEXT@ @NEXT_STDINT_H@ #else diff --git a/lib/sys_types.in.h b/lib/sys_types.in.h index 803d7b1..b3bf9f2 100644 --- a/lib/sys_types.in.h +++ b/lib/sys_types.in.h @@ -23,7 +23,9 @@ #ifndef _@GUARD_PREFIX@_SYS_TYPES_H /* The include_next requires a split double-inclusion guard. */ +# define _GL_INCLUDING_SYS_TYPES_H #@INCLUDE_NEXT@ @NEXT_SYS_TYPES_H@ +# undef _GL_INCLUDING_SYS_TYPES_H #ifndef _@GUARD_PREFIX@_SYS_TYPES_H #define _@GUARD_PREFIX@_SYS_TYPES_H diff --git a/modules/stdint b/modules/stdint index 92eb59f..62a5797 100644 --- a/modules/stdint +++ b/modules/stdint @@ -14,6 +14,7 @@ m4/longlong.m4 Depends-on: include_next multiarch +sys_types configure.ac: gl_STDINT_H -- 1.7.9.5