am b5c23796: Merge "Move use of __warnattr to __deprecated."

* commit 'b5c23796872dee26d7fa88f0a41801dcc6090d99':
  Move use of __warnattr to __deprecated.
This commit is contained in:
Yabin Cui 2015-02-17 23:16:01 +00:00 committed by Android Git Automerger
commit 0769bb4fcf
3 changed files with 12 additions and 8 deletions

View File

@ -266,16 +266,16 @@ int vdprintf(int, const char * __restrict, __va_list) __printflike(2, 0);
#ifndef __AUDIT__
#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 201112L
char* gets(char*) __warnattr("gets is very unsafe; consider using fgets");
char* gets(char*) __deprecated("gets is very unsafe; consider using fgets");
#endif
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");
__printflike(2, 3) __deprecated("sprintf is often misused; please use snprintf");
char* tmpnam(char*) __deprecated("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");
__printflike(2, 0) __deprecated("vsprintf is often misused; please use vsnprintf");
#if __XPG_VISIBLE
char* tempnam(const char*, const char*)
__warnattr("tempnam possibly used unsafely; consider using mkstemp");
__deprecated("tempnam possibly used unsafely; consider using mkstemp");
#endif
#endif

View File

@ -58,7 +58,7 @@ extern int unsetenv(const char*);
extern int clearenv(void);
extern char* mkdtemp(char*);
extern char* mktemp(char*) __warnattr("mktemp possibly used unsafely; consider using mkstemp");
extern char* mktemp(char*) __deprecated("mktemp possibly used unsafely; consider using mkstemp");
extern int mkostemp64(char*, int);
extern int mkostemp(char*, int);

View File

@ -334,12 +334,16 @@
#define __wur
#endif
#if __GNUC_PREREQ(3, 2)
#define __deprecated(msg) __attribute__ ((deprecated(msg)))
#else
#define __deprecated(msg)
#endif
#if __GNUC_PREREQ(4, 3)
#define __errorattr(msg) __attribute__((__error__(msg)))
#define __warnattr(msg) __attribute__((__warning__(msg)))
#else
#define __errorattr(msg)
#define __warnattr(msg)
#endif
#define __errordecl(name, msg) extern void name(void) __errorattr(msg)