This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [PATCH] libstdc++/77795 Only declare ::gets for C++98 and C++11
- From: Jonathan Wakely <jwakely at redhat dot com>
- To: libstdc++ at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Fri, 30 Sep 2016 19:30:39 +0100
- Subject: Re: [PATCH] libstdc++/77795 Only declare ::gets for C++98 and C++11
- Authentication-results: sourceware.org; auth=none
- References: <20160930110813.GQ29482@redhat.com>
On 30/09/16 12:08 +0100, Jonathan Wakely wrote:
As noted in Bugzilla (and pointed out in LLVM's bugzilla by Richard
Smith) we check for a ::gets() declaration with the default
-std=gnu++14 mode, so for glibc we don't find it, and then we declare
it ourselves in <cstdio> even though it's not meant to exist in C++14.
This adjusts the check to use C++11, and doesn't declare it for C++14
and later. I think this fixes the regression, without introducing any
new problems.
Please take a look and double-check I haven't missed something.
PR libstdc++/77795
* acinclude.m4 (GLIBCXX_CHECK_STDIO_PROTO): Use -std=gnu++11 to check
for gets.
* config.h.in: Regenerate.
* configure: Regenerate.
* include/c_global/cstdio [!_GLIBCXX_HAVE_GETS] (gets): Only declare
for C++98 and C++11.
* include/c_std/cstdio [!_GLIBCXX_HAVE_GETS] (gets): Likewise.
* testsuite/27_io/headers/cstdio/functions_neg.cc: New test.
Committed to trunk and gcc-6-branch.
I think we could also get rid of the hack in
config/os/gnu-linux/os_defines.h because it doesn't do anything:
// Provide a declaration for the possibly deprecated gets function, as
// glibc 2.15 and later does not declare gets for ISO C11 when
// __GNU_SOURCE is defined.
#if __GLIBC_PREREQ(2,15) && defined(_GNU_SOURCE)
# undef _GLIBCXX_HAVE_GETS
#endif
Any reason to keep this part?