Re: [PATCH] features.h: do not consider _GNU_SOURCE for gets

"H.J. Lu" <[email protected]>
Newsgroups gmane.comp.lib.glibc.alpha
Message-ID <CAMe9rOpx36Cvh+wLuh=FDb35YdcPbszobgS1aNTsYjxwgvydSQ@mail.gmail.com>
On Sat, Aug 29, 2026 at 6:26 AM Arsen Arsenović <[email protected]> wrote:
>
> Hi H.J,
>
> Thanks for responding.
>
> "H.J. Lu" <[email protected]> writes:
>
> > On Sun, Aug 16, 2026 at 5:05 PM Arsen Arsenović <[email protected]> wrote:
> >>
> >> Arsen Arsenović <[email protected]> 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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.