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

Arsen Arsenović arsen@aarsen.me
Fri Aug 28 22:26:28 GMT 2026


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

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).

Guidance appreciated on how to approach writing these two tests.

Thanks in advance!
Have a lovely evening.
-- 
Arsen Arsenović
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 288 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20260829/95f8efad/attachment.sig>


More information about the Libc-alpha mailing list