public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] gcc.c-torture/execute/builtins/fputs.c: Define _GNU_SOURCE
@ 2023-10-22  7:47 Florian Weimer
  2023-10-22 13:44 ` Jeff Law
  2023-10-22 16:09 ` Andrew Pinski
  0 siblings, 2 replies; 7+ messages in thread
From: Florian Weimer @ 2023-10-22  7:47 UTC (permalink / raw)
  To: gcc-patches

Current glibc headers only declare fputs_unlocked for _GNU_SOURCE.
Defining the macro avoids an implicit function declaration.

gcc/testsuite/

	* gcc.c-torture/execute/builtins/fputs.c (_GNU_SOURCE):
	Define.

---
 gcc/testsuite/gcc.c-torture/execute/builtins/fputs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/fputs.c b/gcc/testsuite/gcc.c-torture/execute/builtins/fputs.c
index 93fa9736449..13e30724355 100644
--- a/gcc/testsuite/gcc.c-torture/execute/builtins/fputs.c
+++ b/gcc/testsuite/gcc.c-torture/execute/builtins/fputs.c
@@ -5,6 +5,7 @@
 
    Written by Kaveh R. Ghazi, 10/30/2000.  */
 
+#define _GNU_SOURCE /* For fputs_unlocked.  */
 #include <stdio.h>
 extern void abort(void);
 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] gcc.c-torture/execute/builtins/fputs.c: Define _GNU_SOURCE
  2023-10-22  7:47 [PATCH] gcc.c-torture/execute/builtins/fputs.c: Define _GNU_SOURCE Florian Weimer
@ 2023-10-22 13:44 ` Jeff Law
  2023-10-22 16:09 ` Andrew Pinski
  1 sibling, 0 replies; 7+ messages in thread
From: Jeff Law @ 2023-10-22 13:44 UTC (permalink / raw)
  To: Florian Weimer, gcc-patches



On 10/22/23 01:47, Florian Weimer wrote:
> Current glibc headers only declare fputs_unlocked for _GNU_SOURCE.
> Defining the macro avoids an implicit function declaration.
> 
> gcc/testsuite/
> 
> 	* gcc.c-torture/execute/builtins/fputs.c (_GNU_SOURCE):
> 	Define.
OK
jeff

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] gcc.c-torture/execute/builtins/fputs.c: Define _GNU_SOURCE
  2023-10-22  7:47 [PATCH] gcc.c-torture/execute/builtins/fputs.c: Define _GNU_SOURCE Florian Weimer
  2023-10-22 13:44 ` Jeff Law
@ 2023-10-22 16:09 ` Andrew Pinski
  2023-10-22 19:45   ` Jeff Law
  2023-10-23  8:39   ` Florian Weimer
  1 sibling, 2 replies; 7+ messages in thread
From: Andrew Pinski @ 2023-10-22 16:09 UTC (permalink / raw)
  To: Florian Weimer; +Cc: gcc-patches

On Sun, Oct 22, 2023 at 12:47 AM Florian Weimer <fweimer@redhat.com> wrote:
>
> Current glibc headers only declare fputs_unlocked for _GNU_SOURCE.
> Defining the macro avoids an implicit function declaration.

This does not help targets that don't use glibc though.
Note for builtins testsuite there is a lib-fputs.c file which will
define a fputs_unlock which is how it will link even if the libc does
not define a fputs_unlock.

Thanks,
Andrew Pinski

>
> gcc/testsuite/
>
>         * gcc.c-torture/execute/builtins/fputs.c (_GNU_SOURCE):
>         Define.
>
> ---
>  gcc/testsuite/gcc.c-torture/execute/builtins/fputs.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/fputs.c b/gcc/testsuite/gcc.c-torture/execute/builtins/fputs.c
> index 93fa9736449..13e30724355 100644
> --- a/gcc/testsuite/gcc.c-torture/execute/builtins/fputs.c
> +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/fputs.c
> @@ -5,6 +5,7 @@
>
>     Written by Kaveh R. Ghazi, 10/30/2000.  */
>
> +#define _GNU_SOURCE /* For fputs_unlocked.  */
>  #include <stdio.h>
>  extern void abort(void);
>
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] gcc.c-torture/execute/builtins/fputs.c: Define _GNU_SOURCE
  2023-10-22 16:09 ` Andrew Pinski
@ 2023-10-22 19:45   ` Jeff Law
  2023-10-22 20:02     ` rep.dot.nop
  2023-10-23  8:39   ` Florian Weimer
  1 sibling, 1 reply; 7+ messages in thread
From: Jeff Law @ 2023-10-22 19:45 UTC (permalink / raw)
  To: Andrew Pinski, Florian Weimer; +Cc: gcc-patches



On 10/22/23 10:09, Andrew Pinski wrote:
> On Sun, Oct 22, 2023 at 12:47 AM Florian Weimer <fweimer@redhat.com> wrote:
>>
>> Current glibc headers only declare fputs_unlocked for _GNU_SOURCE.
>> Defining the macro avoids an implicit function declaration.
> 
> This does not help targets that don't use glibc though.
> Note for builtins testsuite there is a lib-fputs.c file which will
> define a fputs_unlock which is how it will link even if the libc does
> not define a fputs_unlock.
But isn't fputs_unlocked glibc specific to begin with?  ie, the test 
really doesn't make sense AFAICT on non-glibc targets.

Jeff

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] gcc.c-torture/execute/builtins/fputs.c: Define _GNU_SOURCE
  2023-10-22 19:45   ` Jeff Law
@ 2023-10-22 20:02     ` rep.dot.nop
  2023-10-23  5:57       ` Eric Gallager
  0 siblings, 1 reply; 7+ messages in thread
From: rep.dot.nop @ 2023-10-22 20:02 UTC (permalink / raw)
  To: gcc-patches, Jeff Law, Andrew Pinski, Florian Weimer

On 22 October 2023 21:45:12 CEST, Jeff Law <jeffreyalaw@gmail.com> wrote:
>
>
>On 10/22/23 10:09, Andrew Pinski wrote:
>> On Sun, Oct 22, 2023 at 12:47 AM Florian Weimer <fweimer@redhat.com> wrote:
>>> 
>>> Current glibc headers only declare fputs_unlocked for _GNU_SOURCE.
>>> Defining the macro avoids an implicit function declaration.
>> 
>> This does not help targets that don't use glibc though.
>> Note for builtins testsuite there is a lib-fputs.c file which will
>> define a fputs_unlock which is how it will link even if the libc does
>> not define a fputs_unlock.
>But isn't fputs_unlocked glibc specific to begin with?  ie, the test really doesn't make sense AFAICT on non-glibc targets.

I think uClibc had it too, at least at one point in the past.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] gcc.c-torture/execute/builtins/fputs.c: Define _GNU_SOURCE
  2023-10-22 20:02     ` rep.dot.nop
@ 2023-10-23  5:57       ` Eric Gallager
  0 siblings, 0 replies; 7+ messages in thread
From: Eric Gallager @ 2023-10-23  5:57 UTC (permalink / raw)
  To: rep.dot.nop; +Cc: gcc-patches, Jeff Law, Andrew Pinski, Florian Weimer

On Sun, Oct 22, 2023 at 4:03 PM <rep.dot.nop@gmail.com> wrote:
>
> On 22 October 2023 21:45:12 CEST, Jeff Law <jeffreyalaw@gmail.com> wrote:
> >
> >
> >On 10/22/23 10:09, Andrew Pinski wrote:
> >> On Sun, Oct 22, 2023 at 12:47 AM Florian Weimer <fweimer@redhat.com> wrote:
> >>>
> >>> Current glibc headers only declare fputs_unlocked for _GNU_SOURCE.
> >>> Defining the macro avoids an implicit function declaration.
> >>
> >> This does not help targets that don't use glibc though.
> >> Note for builtins testsuite there is a lib-fputs.c file which will
> >> define a fputs_unlock which is how it will link even if the libc does
> >> not define a fputs_unlock.
> >But isn't fputs_unlocked glibc specific to begin with?  ie, the test really doesn't make sense AFAICT on non-glibc targets.
>
> I think uClibc had it too, at least at one point in the past.
>

gnulib has these portability notes about fputs_unlocked:
https://www.gnu.org/software/gnulib/manual/html_node/fputs_005funlocked.html
Unfortunately, it only lists the platforms that *don't* have it, not
the ones that *do* have it, so I'm afraid its notes aren't actually
that helpful after all... oh well, never mind...

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] gcc.c-torture/execute/builtins/fputs.c: Define _GNU_SOURCE
  2023-10-22 16:09 ` Andrew Pinski
  2023-10-22 19:45   ` Jeff Law
@ 2023-10-23  8:39   ` Florian Weimer
  1 sibling, 0 replies; 7+ messages in thread
From: Florian Weimer @ 2023-10-23  8:39 UTC (permalink / raw)
  To: Andrew Pinski; +Cc: gcc-patches

* Andrew Pinski:

> On Sun, Oct 22, 2023 at 12:47 AM Florian Weimer <fweimer@redhat.com> wrote:
>>
>> Current glibc headers only declare fputs_unlocked for _GNU_SOURCE.
>> Defining the macro avoids an implicit function declaration.
>
> This does not help targets that don't use glibc though.
> Note for builtins testsuite there is a lib-fputs.c file which will
> define a fputs_unlock which is how it will link even if the libc does
> not define a fputs_unlock.

That's a good point.  I've sent a v2 which also adds a prototype
declaration in addition to _GNU_SOURCE.  I've thought about it for a bit
and it seems to be the least intrusive option.

Thanks,
Florian


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-10-23  8:39 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-22  7:47 [PATCH] gcc.c-torture/execute/builtins/fputs.c: Define _GNU_SOURCE Florian Weimer
2023-10-22 13:44 ` Jeff Law
2023-10-22 16:09 ` Andrew Pinski
2023-10-22 19:45   ` Jeff Law
2023-10-22 20:02     ` rep.dot.nop
2023-10-23  5:57       ` Eric Gallager
2023-10-23  8:39   ` Florian Weimer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).