[PATCH] features.h: do not consider _GNU_SOURCE for gets
H.J. Lu
hjl.tools@gmail.com
Sat Aug 29 00:16:46 GMT 2026
On Sat, Aug 29, 2026 at 6:26 AM Arsen Arsenović <arsen@aarsen.me> wrote:
>
> Hi H.J,
>
> Thanks for responding.
>
> "H.J. Lu" <hjl.tools@gmail.com> writes:
>
> > On Sun, Aug 16, 2026 at 5:05 PM Arsen Arsenović <arsen@aarsen.me> wrote:
> >>
> >> Arsen Arsenović <arsen@aarsen.me> writes:
> >>
> >> > Currently, -std=c99 -D_GNU_SOURCE and similar lack the 'gets'
> >> > declaration.
> >> >
> >> > This causes, say, programs using the:
> >> >
> >> > extern __typeof__ (gets) function __attribute__ ((__warning__ (...)))
> >>
> >> There's a typo there. That's meant to be:
> >>
> >> extern __typeof__ (gets) gets __attribute__ ((__warning__ (...)))
> >>
> >> ... of course.
> >> --
> >> Arsen Arsenović
> >
> > At least, more tests are needed for changed behavior:
> >
> > 1. No gets prototype for ISO C11 and ISO C++14.
>
> Isn't C11 covered by conform/ already?
>
> I initially accidentally made the 'gets' signature available in C11 (by
> typo-ing the stdc value), and it was caught. And, indeed, stdio.h has:
>
> #if !defined ISO11 && !defined ISO23
> function {char*} gets (char*)
> #endif
That is good to know.
> As for C++, sure, that makes sense, but there's no existing framework
> for writing those as far as I can tell.
>
> Similarly, for ...
>
> > 2. Warnings of gets usage from compiler before ISO C11 or ISO C++14.
>
> ... I am not sure how diagnostic tests would work in glibc (obviously
> its testsuite differs to that of GCC), and I haven't been able to parse
> out the right approach from the makefiles.
>
> AFAICS, the right thing to do would be a tst-*.sh that greps compiler
> output?
>
> But then, that seems redundant with the existing conform/ machinery (and
> the warnings are not something peculiar to this patch, they already
> exist in glibc today).
tst-*.sh should work C++ prototype check and warning check.
> Guidance appreciated on how to approach writing these two tests.
>
> Thanks in advance!
> Have a lovely evening.
> --
> Arsen Arsenović
--
H.J.
More information about the Libc-alpha
mailing list