public inbox for libc-help@sourceware.org
 help / color / mirror / Atom feed
* Regarding FD_ZERO compilation warning
@ 2022-06-20  3:47 Reddy K
  2022-06-20  7:31 ` Florian Weimer
  0 siblings, 1 reply; 6+ messages in thread
From: Reddy K @ 2022-06-20  3:47 UTC (permalink / raw)
  To: libc-help

HI Team,

I have enabled all compilation flags and did "make" build. I got the
warning below and have tried to include required header files ( select.h,
time.h, types.h and unistd.h) but still it shows the warning. So can you
please help me to fix this.

ds_locator.c:930:2: warning: traditional C rejects string constant
concatenation [-Wtraditional]
FD_ZERO(&readfds);

I am pasting the code snippet below to understand how variable readfds
define.
-----------------------------
fd_set readfds;
FD_ZERO(&readfds);

----------------------------

Thanks & Regards
Haritha

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

* Re: Regarding FD_ZERO compilation warning
  2022-06-20  3:47 Regarding FD_ZERO compilation warning Reddy K
@ 2022-06-20  7:31 ` Florian Weimer
  2022-06-20 11:04   ` Reddy K
  0 siblings, 1 reply; 6+ messages in thread
From: Florian Weimer @ 2022-06-20  7:31 UTC (permalink / raw)
  To: Reddy K via Libc-help; +Cc: Reddy K

* Reddy K. via Libc-help:

> I have enabled all compilation flags and did "make" build. I got the
> warning below and have tried to include required header files ( select.h,
> time.h, types.h and unistd.h) but still it shows the warning. So can you
> please help me to fix this.
>
> ds_locator.c:930:2: warning: traditional C rejects string constant
> concatenation [-Wtraditional]
> FD_ZERO(&readfds);
>
> I am pasting the code snippet below to understand how variable readfds
> define.
> -----------------------------
> fd_set readfds;
> FD_ZERO(&readfds);
>
> ----------------------------

I don't see how glibc's FD_ZERO can trigger this compiler warning.

I suggest you generate preprocessed sources with gcc --save-temps or gcc
-E, and show us the macro expansion.

In general, there is no expectation that the glibc headers are clean
with -Wtraditional, quite the opposite actually.  We require an ISO C
compiler.

Thanks,
Florian


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

* Re: Regarding FD_ZERO compilation warning
  2022-06-20  7:31 ` Florian Weimer
@ 2022-06-20 11:04   ` Reddy K
  2022-06-20 11:09     ` Florian Weimer
  0 siblings, 1 reply; 6+ messages in thread
From: Reddy K @ 2022-06-20 11:04 UTC (permalink / raw)
  To: Florian Weimer; +Cc: Reddy K via Libc-help

Hi Florian,
Thank you very much for your help.

As you suggested, I have generated  preprocessed sources with gcc -E.
Please find macro expansion below.
-------------------
 do { int __d0, __d1; __asm__ __volatile__ ("cld; rep; " "stosq" : "=c"
(__d0), "=D" (__d1) : "a" (0), "0" (sizeof (fd_set) / sizeof (__fd_mask)),
"1" (&((&readfds)->__fds_bits)[0]) : "memory"); } while (0);
---------------------

thanks & regards,
Haritha

On Mon, Jun 20, 2022 at 1:01 PM Florian Weimer <fweimer@redhat.com> wrote:

> * Reddy K. via Libc-help:
>
> > I have enabled all compilation flags and did "make" build. I got the
> > warning below and have tried to include required header files ( select.h,
> > time.h, types.h and unistd.h) but still it shows the warning. So can you
> > please help me to fix this.
> >
> > ds_locator.c:930:2: warning: traditional C rejects string constant
> > concatenation [-Wtraditional]
> > FD_ZERO(&readfds);
> >
> > I am pasting the code snippet below to understand how variable readfds
> > define.
> > -----------------------------
> > fd_set readfds;
> > FD_ZERO(&readfds);
> >
> > ----------------------------
>
> I don't see how glibc's FD_ZERO can trigger this compiler warning.
>
> I suggest you generate preprocessed sources with gcc --save-temps or gcc
> -E, and show us the macro expansion.
>
> In general, there is no expectation that the glibc headers are clean
> with -Wtraditional, quite the opposite actually.  We require an ISO C
> compiler.
>
> Thanks,
> Florian
>
>

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

* Re: Regarding FD_ZERO compilation warning
  2022-06-20 11:04   ` Reddy K
@ 2022-06-20 11:09     ` Florian Weimer
  2022-06-20 11:23       ` Reddy K
  0 siblings, 1 reply; 6+ messages in thread
From: Florian Weimer @ 2022-06-20 11:09 UTC (permalink / raw)
  To: Reddy K; +Cc: Reddy K via Libc-help

* Reddy K.:

> Hi Florian,
> Thank you very much for your help.
>
> As you suggested, I have generated  preprocessed sources with gcc -E. Please find macro
> expansion below.
> -------------------
>  do { int __d0, __d1; __asm__ __volatile__ ("cld; rep; " "stosq" : "=c" (__d0), "=D" (__d1) :
> "a" (0), "0" (sizeof (fd_set) / sizeof (__fd_mask)), "1" (&((&readfds)->__fds_bits)[0]) :
> "memory"); } while (0);
> ---------------------

Ahh, that code was removed upstream in:

commit 3430ed09d3bef58dbf3fe18d87716236883599d8
Author: Florian Weimer <fweimer@redhat.com>
Date:   Sun Feb 9 11:01:39 2020 +0100

    x86: Remove <bits/select.h> and use the generic version
    
    Particularly on CPUs without ERMS, the string instructions are slow,
    so it is unclear whether this architecture-specific implementation is
    in fact an optimization.

If you need this backported in a distribution build, please contact your
distribution about backporting the change.

Thanks,
Florian


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

* Re: Regarding FD_ZERO compilation warning
  2022-06-20 11:09     ` Florian Weimer
@ 2022-06-20 11:23       ` Reddy K
  2022-06-20 11:26         ` Florian Weimer
  0 siblings, 1 reply; 6+ messages in thread
From: Reddy K @ 2022-06-20 11:23 UTC (permalink / raw)
  To: Florian Weimer; +Cc: Reddy K via Libc-help

Hi Florian,

I am including the below header files.

#include <sys/types.h>
#include <sys/socket.h>
#include <unistd.h>
#include <sys/time.h>
#include <sys/select.h>

Thanks & Regards
Haritha

On Mon, Jun 20, 2022 at 4:39 PM Florian Weimer <fweimer@redhat.com> wrote:

> * Reddy K.:
>
> > Hi Florian,
> > Thank you very much for your help.
> >
> > As you suggested, I have generated  preprocessed sources with gcc -E.
> Please find macro
> > expansion below.
> > -------------------
> >  do { int __d0, __d1; __asm__ __volatile__ ("cld; rep; " "stosq" : "=c"
> (__d0), "=D" (__d1) :
> > "a" (0), "0" (sizeof (fd_set) / sizeof (__fd_mask)), "1"
> (&((&readfds)->__fds_bits)[0]) :
> > "memory"); } while (0);
> > ---------------------
>
> Ahh, that code was removed upstream in:
>
> commit 3430ed09d3bef58dbf3fe18d87716236883599d8
> Author: Florian Weimer <fweimer@redhat.com>
> Date:   Sun Feb 9 11:01:39 2020 +0100
>
>     x86: Remove <bits/select.h> and use the generic version
>
>     Particularly on CPUs without ERMS, the string instructions are slow,
>     so it is unclear whether this architecture-specific implementation is
>     in fact an optimization.
>
> If you need this backported in a distribution build, please contact your
> distribution about backporting the change.
>
> Thanks,
> Florian
>
>

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

* Re: Regarding FD_ZERO compilation warning
  2022-06-20 11:23       ` Reddy K
@ 2022-06-20 11:26         ` Florian Weimer
  0 siblings, 0 replies; 6+ messages in thread
From: Florian Weimer @ 2022-06-20 11:26 UTC (permalink / raw)
  To: Reddy K; +Cc: Reddy K via Libc-help

* Reddy K.:

> I am including the below header files.
>
> #include <sys/types.h>
> #include <sys/socket.h>
> #include <unistd.h>
> #include <sys/time.h>
> #include <sys/select.h>

I guessed as much.  Given that the issue is already fixed upstream,
you really need to contact your distribution regarding this issue.

Thanks,
Florian


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

end of thread, other threads:[~2022-06-20 11:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-20  3:47 Regarding FD_ZERO compilation warning Reddy K
2022-06-20  7:31 ` Florian Weimer
2022-06-20 11:04   ` Reddy K
2022-06-20 11:09     ` Florian Weimer
2022-06-20 11:23       ` Reddy K
2022-06-20 11:26         ` 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).