This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 3/5] Clean up conditionals for declaration of gets().
- From: Zack Weinberg <zackw at panix dot com>
- To: libc-alpha at sourceware dot org
- Date: Tue, 6 Dec 2016 08:43:23 -0500
- Subject: Re: [PATCH 3/5] Clean up conditionals for declaration of gets().
- Authentication-results: sourceware.org; auth=none
- References: <20161128160007.13994-1-zackw@panix.com> <20161128160007.13994-2-zackw@panix.com> <20161128160007.13994-3-zackw@panix.com> <20161128160007.13994-4-zackw@panix.com>
On 11/28/2016 11:00 AM, Zack Weinberg wrote:
> gets() has the dubious honor of being the only C89 library feature
> that has been completely removed from the current C and C++ standards.
> glibc follows suit by not declaring it in _GNU_SOURCE mode either, but
> it remains present in older compatibility modes. Internally, two test
> cases need to see stdio.h make the declaration, but all our internal
> code is of course compiled under _GNU_SOURCE. This is currently
> kludged by duplicating the gets declaration, fortify wrapper and all,
> in include/stdio.h. Also, the conditional in the public headers for
> deciding when to declare gets is complicated, contains a non-obvious
> dependence on short-circuit evaluation, and is repeated in two places.
>
> This patch adds a new macro to features.h that encapsulates the
> complicated rule for when to declare gets. stdio.h and bits/stdio2.h
> can simply test __GLIBC_USE (DEPRECATED_GETS). Then, instead of
> having a duplicate gets declaration in include/stdio.h,
> debug/tst-chk1.c and stdio-common/tst-gets.c force that flag on.
Ping.