diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/features.h | 11 | ||||
-rw-r--r-- | include/stdio.h | 18 |
2 files changed, 11 insertions, 18 deletions
diff --git a/include/features.h b/include/features.h index dc8ae79..7de4089 100644 --- a/include/features.h +++ b/include/features.h @@ -136,6 +136,7 @@ #undef __USE_GNU #undef __USE_FORTIFY_LEVEL #undef __KERNEL_STRICT_NAMES +#undef __GLIBC_USE_DEPRECATED_GETS /* Suppress kernel-name space pollution unless user expressedly asks for it. */ @@ -383,6 +384,16 @@ # define __USE_FORTIFY_LEVEL 0 #endif +/* The function 'gets' existed in C89, but is impossible to use + safely. It has been removed from ISO C11 and ISO C++14. Note: for + compatibility with various implementations of <cstdio>, this test + must consider only the value of __cplusplus when compiling C++. */ +#if defined __cplusplus ? __cplusplus >= 201402L : defined __USE_ISOC11 +# define __GLIBC_USE_DEPRECATED_GETS 0 +#else +# define __GLIBC_USE_DEPRECATED_GETS 1 +#endif + /* Get definitions of __STDC_* predefined macros, if the compiler has not preincluded this header automatically. */ #include <stdc-predef.h> diff --git a/include/stdio.h b/include/stdio.h index 30e737e..17b5a05 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -181,24 +181,6 @@ libc_hidden_proto (__vasprintf_chk) libc_hidden_proto (__vdprintf_chk) libc_hidden_proto (__obstack_vprintf_chk) -/* The <stdio.h> header does not include the declaration for gets - anymore when compiling with _GNU_SOURCE. Provide a copy here. */ -extern char *gets (char *__s); -# if __USE_FORTIFY_LEVEL > 0 -extern char *__gets_chk (char *__str, size_t) __wur; -extern char *__REDIRECT (__gets_warn, (char *__str), gets) - __wur __warnattr ("please use fgets or getline instead, gets can't " - "specify buffer size"); - -__fortify_function __wur char * -gets (char *__str) -{ - if (__bos (__str) != (size_t) -1) - return __gets_chk (__str, __bos (__str)); - return __gets_warn (__str); -} -# endif - extern FILE * __fmemopen (void *buf, size_t len, const char *mode); libc_hidden_proto (__fmemopen) |