Bug 13566 - Glibc should define gets for C++11
Summary: Glibc should define gets for C++11
Alias: None
Product: glibc
Classification: Unclassified
Component: stdio (show other bugs)
Version: 2.15
: P2 normal
Target Milestone: ---
Assignee: Joseph Myers
Depends on:
Reported: 2012-01-05 18:23 UTC by Tom de Vries
Modified: 2014-06-27 11:15 UTC (History)
2 users (show)

See Also:
Last reconfirmed:
fweimer: security-


Note You need to log in before you can comment on or make changes to this bug.
Description Tom de Vries 2012-01-05 18:23:30 UTC
With this change:
	[BZ #13528]
	* libio/stdio.h: Do not declare gets for ISO C11 and _GNU_SOURCE.

gets is no longer defined for C++11, while it should be. This causes breakage when building libstdc++. See also discussion at http://gcc.gnu.org/ml/gcc/2012-01/msg00041.html .
Comment 1 Jonathan Wakely 2012-01-05 18:49:58 UTC
(In reply to comment #0)
> http://gcc.gnu.org/ml/gcc/2012-01/msg00041.html .

That build failure is in C++03 code, not C++11

gets() needs to be defined for C++ even when _GNU_SOURCE is defined.

I suggest checking whether __cplusplus <= 201103L
Comment 2 Joseph Myers 2012-01-06 18:15:14 UTC
Fixed in commit 8ecd6b2a1283a28bcf56cfe48099fafa412a3929.
Comment 3 Bryan Kadzban 2012-02-05 20:00:07 UTC
...And un-fixed in this commit, a day later:


Looks like either that needs to be rolled back, or gcc needs to be changed to not define _GNU_SOURCE.  (But I bet that latter change will break lots more stuff in libstdc++...)
Comment 4 Tom de Vries 2012-02-05 20:28:02 UTC
related gcc bug:

Bug 51785 - gets not anymore declared
Comment 5 Bryan Kadzban 2012-02-05 21:09:14 UTC
Ah, indeed.

Well, I'll let the gcc and glibc people figure out what to do here.  Nothing has been released with these changes yet (at least not AFAIK), so it's only hitting people trying to use head versions, which isn't many.
Comment 6 Joseph Myers 2012-03-06 20:57:45 UTC
GCC was fixed for 4.7.  glibc patch for GCC <= 4.6 pending review: http://sourceware.org/ml/libc-alpha/2012-03/msg00111.html
Comment 7 Joseph Myers 2012-03-09 22:10:35 UTC
Fixed, again, by removing the __USE_GNU conditional after further discussion on libc-alpha.