diff --git a/libc/Android.mk b/libc/Android.mk index 0dc6c3b35..ce0609699 100644 --- a/libc/Android.mk +++ b/libc/Android.mk @@ -778,7 +778,10 @@ endif LOCAL_CFLAGS := \ $(libc_common_cflags) \ - -Wno-sign-compare -Wno-uninitialized -Wno-unused-parameter \ + -Wno-missing-field-initializers \ + -Wno-sign-compare \ + -Wno-uninitialized \ + -Wno-unused-parameter \ -I$(LOCAL_PATH)/private \ -I$(LOCAL_PATH)/upstream-openbsd/android/include \ -I$(LOCAL_PATH)/upstream-openbsd/lib/libc/include \ diff --git a/libc/stdio/fileext.h b/libc/stdio/fileext.h index 1f2a3a31e..7efff8f1b 100644 --- a/libc/stdio/fileext.h +++ b/libc/stdio/fileext.h @@ -43,6 +43,8 @@ struct __sfileext { pthread_mutex_t _lock; /* file lock */ }; +__LIBC_HIDDEN__ extern struct __sfileext __sFext[3]; + #define _FILEEXT_INITIALIZER {{NULL,0},{0},PTHREAD_RECURSIVE_MUTEX_INITIALIZER} #define _EXT(fp) ((struct __sfileext *)((fp)->_ext._base)) diff --git a/libc/upstream-openbsd/android/include/openbsd-compat.h b/libc/upstream-openbsd/android/include/openbsd-compat.h index 630094d99..268b3b63a 100644 --- a/libc/upstream-openbsd/android/include/openbsd-compat.h +++ b/libc/upstream-openbsd/android/include/openbsd-compat.h @@ -52,6 +52,10 @@ #define explicit_bzero(p, s) memset(p, 0, s) +/* OpenBSD has these in , but "ALIGN" isn't something we want to reserve. */ +#define ALIGNBYTES (sizeof(uintptr_t) - 1) +#define ALIGN(p) (((uintptr_t)(p) + ALIGNBYTES) &~ ALIGNBYTES) + /* We have OpenBSD's getentropy_linux.c, but we don't mention getentropy in any header. */ __LIBC_HIDDEN__ extern int getentropy(void*, size_t); diff --git a/libc/upstream-openbsd/lib/libc/stdio/findfp.c b/libc/upstream-openbsd/lib/libc/stdio/findfp.c index b8c7dc137..3594369bf 100644 --- a/libc/upstream-openbsd/lib/libc/stdio/findfp.c +++ b/libc/upstream-openbsd/lib/libc/stdio/findfp.c @@ -39,19 +39,16 @@ #include #include "local.h" #include "glue.h" -#include "private/thread_private.h" - -#define ALIGNBYTES (sizeof(uintptr_t) - 1) -#define ALIGN(p) (((uintptr_t)(p) + ALIGNBYTES) &~ ALIGNBYTES) +#include "thread_private.h" int __sdidinit; #define NDYNAMIC 10 /* add ten more whenever necessary */ #define std(flags, file) \ - {0,0,0,flags,file,{0,0},0,__sF+file,__sclose,__sread,__sseek,__swrite, \ - {(unsigned char *)(__sFext+file), 0},NULL,0,{0,0,0},{0},{0,0},0,0} -/* p r w flags file _bf z cookie close read seek write + {0,0,0,flags,file,{0},0,__sF+file,__sclose,__sread,__sseek,__swrite, \ + {(unsigned char *)(__sFext+file), 0}} +/* p r w flags file _bf z cookie close read seek write ext */ /* the usual - (stdin + stdout + stderr) */ @@ -61,7 +58,7 @@ static struct glue uglue = { 0, FOPEN_MAX - 3, usual }; static struct glue *lastglue = &uglue; _THREAD_PRIVATE_MUTEX(__sfp_mutex); -static struct __sfileext __sFext[3]; +struct __sfileext __sFext[3]; FILE __sF[3] = { std(__SRD, STDIN_FILENO), /* stdin */ std(__SWR, STDOUT_FILENO), /* stdout */ @@ -176,6 +173,6 @@ __sinit(void) /* make sure we clean up on exit */ __atexit_register_cleanup(_cleanup); /* conservative */ __sdidinit = 1; -out: +out: _THREAD_PRIVATE_MUTEX_UNLOCK(__sinit_mutex); }