aboutsummaryrefslogtreecommitdiffstats
path: root/libc/include/stdio.h
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2013-12-17 20:43:30 -0800
committerElliott Hughes <enh@google.com>2013-12-17 20:43:30 -0800
commitc13fb75ceabb47f8292be206db80b93889fccf66 (patch)
tree6aca1af2e53339d0c6f04abf3fa9fa696d9268c9 /libc/include/stdio.h
parentf293b15728031432317791fb4a17a423545d37b3 (diff)
downloadandroid_bionic-c13fb75ceabb47f8292be206db80b93889fccf66.tar.gz
android_bionic-c13fb75ceabb47f8292be206db80b93889fccf66.tar.bz2
android_bionic-c13fb75ceabb47f8292be206db80b93889fccf66.zip
Move bionic over to GCC's 'warning' attribute.
This is a better solution than the old __warn_references because it's a compile-time rather than link-time warning, it doesn't rely on something that doesn't appear to be supported by gold (which is why you only used to see these warnings on mips builds), and the errors refer to the exact call site(s) rather than just telling you which object file contains a reference to the bad function. This is primarily so we can build bionic for aarch64; building libc.so caused these warnings to fire (because link time is the wrong time) and warnings are errors. Change-Id: I5df9281b2a9d98b164a9b11807ea9472c6faa9e3
Diffstat (limited to 'libc/include/stdio.h')
-rw-r--r--libc/include/stdio.h24
1 files changed, 12 insertions, 12 deletions
diff --git a/libc/include/stdio.h b/libc/include/stdio.h
index 409afeaf8..260a4e706 100644
--- a/libc/include/stdio.h
+++ b/libc/include/stdio.h
@@ -222,13 +222,13 @@ int getchar(void);
ssize_t getdelim(char ** __restrict, size_t * __restrict, int,
FILE * __restrict);
ssize_t getline(char ** __restrict, size_t * __restrict, FILE * __restrict);
-char *gets(char *);
+
#if __BSD_VISIBLE && !defined(__SYS_ERRLIST)
#define __SYS_ERRLIST
-
extern int sys_nerr; /* perror(3) external variables */
extern char *sys_errlist[];
#endif
+
void perror(const char *);
int printf(const char * __restrict, ...)
__printflike(1, 2);
@@ -251,13 +251,16 @@ int vprintf(const char * __restrict, __va_list)
__printflike(1, 0);
#ifndef __AUDIT__
-char *gets(char *);
-int sprintf(char * __restrict, const char * __restrict, ...)
- __printflike(2, 3);
-char *tmpnam(char *);
-int vsprintf(char * __restrict, const char * __restrict,
- __va_list)
- __printflike(2, 0);
+char* gets(char*) __warnattr("gets is very unsafe; consider using fgets");
+int sprintf(char* __restrict, const char* __restrict, ...)
+ __printflike(2, 3) __warnattr("sprintf is often misused; please use snprintf");
+char* tmpnam(char*) __warnattr("tmpnam possibly used unsafely; consider using mkstemp");
+int vsprintf(char* __restrict, const char* __restrict, __va_list)
+ __printflike(2, 0) __warnattr("vsprintf is often misused; please use vsnprintf");
+#if __XPG_VISIBLE
+char* tempnam(const char*, const char*)
+ __warnattr("tempnam possibly used unsafely; consider using mkstemp");
+#endif
#endif
extern int rename(const char*, const char*);
@@ -320,9 +323,6 @@ int putc_unlocked(int, FILE *);
int putchar_unlocked(int);
#endif /* __POSIX_VISIBLE >= 199506 */
-#if __XPG_VISIBLE
-char *tempnam(const char *, const char *);
-#endif
__END_DECLS
#endif /* __BSD_VISIBLE || __POSIX_VISIBLE || __XPG_VISIBLE */