aboutsummaryrefslogtreecommitdiffstats
path: root/libc/include/stdio.h
diff options
context:
space:
mode:
authorDan Albert <danalbert@google.com>2014-10-07 11:10:36 -0700
committerElliott Hughes <enh@google.com>2014-10-07 18:51:24 -0700
commit55ee845b8ec0861d09197b32fbb5f2d34320155d (patch)
tree69eb29683bfd94d7ca209ab06731d873377b3aa2 /libc/include/stdio.h
parentce92b41a00fb86656055eceab9648a858721c3b1 (diff)
downloadandroid_bionic-55ee845b8ec0861d09197b32fbb5f2d34320155d.tar.gz
android_bionic-55ee845b8ec0861d09197b32fbb5f2d34320155d.tar.bz2
android_bionic-55ee845b8ec0861d09197b32fbb5f2d34320155d.zip
Inline helpers need to be exported unmangled.
__open_2() is used by the fortify implementation of open(2) in fcntl.h, and as such needs an unmangled C name. For some reason (inlining?), this doesn't cause problems at the default optimization level, but does for -O0. The rest of these didn't cause build failures, but they look suspect and probably will, we just haven't caught them yet. (cherry-pick of 658727e111ed6dee7be5239494f0764f7b1b02f8 with conflicts in stdio.h and string.h.) Bug: 17784968 Change-Id: I7391a7a8999ee204eaf6abd14a3d5373ea419d5b
Diffstat (limited to 'libc/include/stdio.h')
-rw-r--r--libc/include/stdio.h32
1 files changed, 10 insertions, 22 deletions
diff --git a/libc/include/stdio.h b/libc/include/stdio.h
index 38a267771..a0161dec4 100644
--- a/libc/include/stdio.h
+++ b/libc/include/stdio.h
@@ -47,6 +47,8 @@
#define __need_NULL
#include <stddef.h>
+__BEGIN_DECLS
+
#define _FSTDIO /* Define for new stdio with functions. */
typedef off_t fpos_t; /* stdio file position type */
@@ -136,9 +138,7 @@ typedef struct __sFILE {
fpos_t _offset; /* current lseek offset */
} FILE;
-__BEGIN_DECLS
extern FILE __sF[];
-__END_DECLS
#define __SLBF 0x0001 /* line buffered */
#define __SNBF 0x0002 /* unbuffered */
@@ -208,7 +208,6 @@ __END_DECLS
/*
* Functions defined in ANSI C standard.
*/
-__BEGIN_DECLS
void clearerr(FILE *);
int fclose(FILE *);
int feof(FILE *);
@@ -296,16 +295,12 @@ int vsscanf(const char * __restrict, const char * __restrict, __va_list)
__scanflike(2, 0);
#endif /* __ISO_C_VISIBLE >= 1999 || __BSD_VISIBLE */
-__END_DECLS
-
-
/*
* Functions defined in POSIX 1003.1.
*/
#if __BSD_VISIBLE || __POSIX_VISIBLE || __XPG_VISIBLE
#define L_ctermid 1024 /* size for ctermid(); PATH_MAX */
-__BEGIN_DECLS
FILE *fdopen(int, const char *);
int fileno(FILE *);
@@ -329,15 +324,12 @@ int putc_unlocked(int, FILE *);
int putchar_unlocked(int);
#endif /* __POSIX_VISIBLE >= 199506 */
-__END_DECLS
-
#endif /* __BSD_VISIBLE || __POSIX_VISIBLE || __XPG_VISIBLE */
/*
* Routines that are purely local.
*/
#if __BSD_VISIBLE
-__BEGIN_DECLS
int asprintf(char ** __restrict, const char * __restrict, ...)
__printflike(2, 3);
char *fgetln(FILE * __restrict, size_t * __restrict);
@@ -347,25 +339,26 @@ int setlinebuf(FILE *);
int vasprintf(char ** __restrict, const char * __restrict,
__va_list)
__printflike(2, 0);
-__END_DECLS
/*
* Stdio function-access interface.
*/
-__BEGIN_DECLS
FILE *funopen(const void *,
int (*)(void *, char *, int),
int (*)(void *, const char *, int),
fpos_t (*)(void *, fpos_t, int),
int (*)(void *));
-__END_DECLS
+
#define fropen(cookie, fn) funopen(cookie, fn, 0, 0, 0)
#define fwopen(cookie, fn) funopen(cookie, 0, fn, 0, 0)
#endif /* __BSD_VISIBLE */
-#if defined(__BIONIC_FORTIFY)
+extern char* __fgets_chk(char*, int, FILE*, size_t);
+extern char* __fgets_real(char*, int, FILE*) __RENAME(fgets);
+__errordecl(__fgets_too_big_error, "fgets called with size bigger than buffer");
+__errordecl(__fgets_too_small_error, "fgets called with size less than zero");
-__BEGIN_DECLS
+#if defined(__BIONIC_FORTIFY)
__BIONIC_FORTIFY_INLINE
__printflike(3, 0)
@@ -411,11 +404,6 @@ int sprintf(char *dest, const char *format, ...)
}
#endif
-extern char* __fgets_chk(char*, int, FILE*, size_t);
-extern char* __fgets_real(char*, int, FILE*) __RENAME(fgets);
-__errordecl(__fgets_too_big_error, "fgets called with size bigger than buffer");
-__errordecl(__fgets_too_small_error, "fgets called with size less than zero");
-
#if !defined(__clang__)
__BIONIC_FORTIFY_INLINE
@@ -450,8 +438,8 @@ char *fgets(char* dest, int size, FILE* stream) {
#endif /* !defined(__clang__) */
-__END_DECLS
-
#endif /* defined(__BIONIC_FORTIFY) */
+__END_DECLS
+
#endif /* _STDIO_H_ */