LINUX.ORG.RU

История изменений

Исправление beastie, (текущая версия) :

А вот ещё интересно – более «новое» решение __warnattr: https://android.googlesource.com/platform/bionic/+/c13fb75%5E%21/

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");

Сам __warnattr живёт в cdefs.h:

#if __GNUC_PREREQ (4,3)
# define __warndecl(name, msg) \
  extern void name (void) __attribute__((__warning__ (msg)))
# define __warnattr(msg) __attribute__((__warning__ (msg)))
# define __errordecl(name, msg) \
  extern void name (void) __attribute__((__error__ (msg)))
#else
# define __warndecl(name, msg) extern void name (void)
# define __warnattr(msg)
# define __errordecl(name, msg) extern void name (void)
#endif

Исправление beastie, :

А вот ещё интересно – более «новое» решение __warnattr: https://android.googlesource.com/platform/bionic/+/c13fb75%5E%21/

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");

Сам __warnattr живёт в cdefs.h.

Исходная версия beastie, :

А вот ещё интересно – более «новое» решение __warnattr: https://android.googlesource.com/platform/bionic/+/c13fb75%5E%21/

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");