This is a valid C++14 program that is rejected since 6.1: int gets; #include <cstdio> And this should not compile, but is accepted since 6.1: #include <cstdio> using ::gets; Since we switched the default to -std=gnu++14 the configure checks for ::gets find it is missing from glibc, so we don't define _GLIBCXX_HAVE_GETS, and then in <cstdio> we do: #ifndef _GLIBCXX_HAVE_GETS extern "C" char* gets (char* __s) __attribute__((__deprecated__)); #endif The configure check should use -std=gnu++98 or -std=gnu++11 (so we correctly detect the presence of ::gets when it's needed) and the declaration should only be done for C++98 and C++11 (so we only add it when it's needed).
Author: redi Date: Fri Sep 30 18:28:53 2016 New Revision: 240672 URL: https://gcc.gnu.org/viewcvs?rev=240672&root=gcc&view=rev Log: libstdc++/77795 Only declare ::gets for C++98 and C++11 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. Added: trunk/libstdc++-v3/testsuite/27_io/headers/cstdio/functions_neg.cc Modified: trunk/libstdc++-v3/ChangeLog trunk/libstdc++-v3/acinclude.m4 trunk/libstdc++-v3/config.h.in trunk/libstdc++-v3/configure trunk/libstdc++-v3/include/c_global/cstdio trunk/libstdc++-v3/include/c_std/cstdio
Author: redi Date: Fri Sep 30 18:29:24 2016 New Revision: 240674 URL: https://gcc.gnu.org/viewcvs?rev=240674&root=gcc&view=rev Log: libstdc++/77795 Only declare ::gets for C++98 and C++11 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. Added: branches/gcc-6-branch/libstdc++-v3/testsuite/27_io/headers/cstdio/functions_neg.cc Modified: branches/gcc-6-branch/libstdc++-v3/ChangeLog branches/gcc-6-branch/libstdc++-v3/acinclude.m4 branches/gcc-6-branch/libstdc++-v3/config.h.in branches/gcc-6-branch/libstdc++-v3/configure branches/gcc-6-branch/libstdc++-v3/include/c_global/cstdio branches/gcc-6-branch/libstdc++-v3/include/c_std/cstdio
Fixed for 6.3 onwards.