bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

poll: avoiding more warnings


From: Jim Meyering
Subject: poll: avoiding more warnings
Date: Thu, 15 Jan 2009 23:05:10 +0100

Hi Paolo,

After the used-uninitialized bug Dan Berrange found
in the windows-only part of poll.c, we've been motivated
to enable more warnings when building libvirt's subset
of gnulib, even (or rather especially) when cross-compiling
for mingw.

To that end, there are a few more warnings in poll.c that I'm
considering.  Two approaches:

1) Do what I did to inttostr.c a week or so ago
and add this at the top of poll.c:

  /* Tell gcc not to warn about the (nfd < 0) tests, below.  */
  #if (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) || 4 < __GNUC__
  # pragma GCC diagnostic ignored "-Wtype-limits"
  #endif

2) or use this patch:

>From f446bd3210c4c9e708fb91677f9855c80eb90353 Mon Sep 17 00:00:00 2001
From: Daniel P. Berrange <address@hidden>
Date: Thu, 15 Jan 2009 22:29:34 +0100
Subject: [PATCH] poll: remove declarations of unused variables

* lib/poll.c (poll) [WIN32_NATIVE]: Remove declarations of unused
sockbuf and optlen.
---
 lib/poll.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/lib/poll.c b/lib/poll.c
index c4fdecc..bc7721c 100644
--- a/lib/poll.c
+++ b/lib/poll.c
@@ -404,7 +404,6 @@ poll (pfd, nfd, timeout)
   fd_set rfds, wfds, xfds;
   BOOL poll_again;
   MSG msg;
-  char sockbuf[256];
   int rc = 0;
   nfds_t i;

@@ -426,7 +425,6 @@ poll (pfd, nfd, timeout)
   /* Classify socket handles and create fd sets. */
   for (i = 0; i < nfd; i++)
     {
-      size_t optlen = sizeof(sockbuf);
       pfd[i].revents = 0;
       if (pfd[i].fd < 0)
         continue;
--
1.6.1.233.g5b4a8

or 3) Change nothing ;-)

Do you have a preference?




reply via email to

[Prev in Thread] Current Thread [Next in Thread]