Add non-macro stdin/stdout/stderr too.

Various C and C++ standards explicitly say that stdin/stdout/stderr
should be macros, but glibc makes them global variables too. This
means it's possible to write code that uses those names as locals,
but that code (toybox being an example) won't build on bionic.

If we'd done this earlier, we could have hidden __sF for LP64, but
it's too late now.

Change-Id: I90cf8c73f52b66e1760b8fa2e135b9f9f9651230
This commit is contained in:
Elliott Hughes
2014-11-14 14:42:59 -08:00
parent 898aab282c
commit 168667c972
3 changed files with 13 additions and 9 deletions

View File

@@ -43,10 +43,6 @@ 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))
#define _UB(fp) _EXT(fp)->_ub
#define _FLOCK(fp) _EXT(fp)->_lock