Fix stdin/stdout/stderr for pre-M.
This wasn't an array of pointers, it was an array of structs.
Unfortunately we need a complete type to index into the struct for
stdin/stdout/stderr, so add a phony struct that matches the size and
alignment of `struct __sFILE`. This property is guaranteed by the
static_asserts in libc/bionic/struct_file_test.cpp.
Test: mma
Bug: http://b/30465923
Change-Id: I8ce851dd64a261703bb44f9b5cd23b7caff4dd68
diff --git a/libc/include/stdio.h b/libc/include/stdio.h
index 38021ef..816bd28 100644
--- a/libc/include/stdio.h
+++ b/libc/include/stdio.h
@@ -49,6 +49,10 @@
#include <bits/seek_constants.h>
+#if __ANDROID_API__ <= 23
+#include <bits/struct_file.h>
+#endif
+
__BEGIN_DECLS
#if defined(__clang__)
@@ -73,11 +77,11 @@
#define stderr stderr
#else
/* Before M the actual symbols for stdin and friends had different names. */
-extern FILE* __sF[] __REMOVED_IN(23);
+extern FILE __sF[] __REMOVED_IN(23);
-#define stdin __sF[0]
-#define stdout __sF[1]
-#define stderr __sF[2]
+#define stdin (&__sF[0])
+#define stdout (&__sF[1])
+#define stderr (&__sF[2])
#endif
/*