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

Re: [libvirt] PATCH: 16/25: Fix GNULIB warnings on Mingw



The GNULIB Makefile.am doesn't set any particular compiler warning
flags in the belief that upstream GNULIB developers sort out all
warnings before committing their code. This is reasonable for builds
on mainstream Linux platforms, but MinGW builds of GNULIB don't
have nearly the same level of testing. So This patch adds the libvirt
$(WARN_CFLAGS) to the gnulib Makefile.am and then fixes the problems
this showed up. Nothing of consequence really. Leave it upto gnulib
developers whether its worth fixing these.

 Makefile.am    |    2 
 gettimeofday.c |    5 +-
 ioctl.c        |    1 
 poll.c         |    4 -
 strerror.c     |  128 ++++++++++++++++++++++++++++-----------------------------
 5 files changed, 70 insertions(+), 70 deletions(-)

Daniel

diff --git a/gnulib/lib/Makefile.am b/gnulib/lib/Makefile.am
--- a/gnulib/lib/Makefile.am
+++ b/gnulib/lib/Makefile.am
@@ -26,7 +26,7 @@ DISTCLEANFILES =
 DISTCLEANFILES =
 MAINTAINERCLEANFILES =
 
-AM_CPPFLAGS =
+AM_CPPFLAGS = $(WARN_CFLAGS)
 
 noinst_LTLIBRARIES += libgnu.la
 
diff --git a/gnulib/lib/gettimeofday.c b/gnulib/lib/gettimeofday.c
--- a/gnulib/lib/gettimeofday.c
+++ b/gnulib/lib/gettimeofday.c
@@ -47,11 +47,12 @@ static struct tm *localtime_buffer_addr 
    On the first call, record the address of the static buffer that
    localtime uses for its result.  */
 
+#undef localtime
+extern struct tm *localtime (time_t const *);
+
 struct tm *
 rpl_localtime (time_t const *timep)
 {
-#undef localtime
-  extern struct tm *localtime (time_t const *);
   struct tm *tm = localtime (timep);
 
   if (localtime_buffer_addr == &tm_zero_buffer)
diff --git a/gnulib/lib/ioctl.c b/gnulib/lib/ioctl.c
--- a/gnulib/lib/ioctl.c
+++ b/gnulib/lib/ioctl.c
@@ -24,6 +24,7 @@
 #define WIN32_LEAN_AND_MEAN
 /* Get winsock2.h. */
 #include <sys/socket.h>
+#include <sys/ioctl.h>
 
 /* Get set_winsock_errno, FD_TO_SOCKET etc. */
 #include "w32sock.h"
diff --git a/gnulib/lib/poll.c b/gnulib/lib/poll.c
--- a/gnulib/lib/poll.c
+++ b/gnulib/lib/poll.c
@@ -404,11 +404,10 @@ poll (pfd, nfd, timeout)
   fd_set rfds, wfds, xfds;
   BOOL poll_again;
   MSG msg;
-  char sockbuf[256];
   int rc = 0;
   nfds_t i;
 
-  if (nfd < 0 || timeout < -1)
+  if (timeout < -1)
     {
       errno = EINVAL;
       return -1;
@@ -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;
diff --git a/gnulib/lib/strerror.c b/gnulib/lib/strerror.c
--- a/gnulib/lib/strerror.c
+++ b/gnulib/lib/strerror.c
@@ -45,89 +45,89 @@ rpl_strerror (int n)
     {
 # if GNULIB_defined_ETXTBSY
     case ETXTBSY:
-      return "Text file busy";
+      return (char*)"Text file busy";
 # endif
 
 # if GNULIB_defined_ESOCK /* native Windows platforms */
     /* EWOULDBLOCK is the same as EAGAIN.  */
     case EINPROGRESS:
-      return "Operation now in progress";
+      return (char*)"Operation now in progress";
     case EALREADY:
-      return "Operation already in progress";
+      return (char*)"Operation already in progress";
     case ENOTSOCK:
-      return "Socket operation on non-socket";
+      return (char*)"Socket operation on non-socket";
     case EDESTADDRREQ:
-      return "Destination address required";
+      return (char*)"Destination address required";
     case EMSGSIZE:
-      return "Message too long";
+      return (char*)"Message too long";
     case EPROTOTYPE:
-      return "Protocol wrong type for socket";
+      return (char*)"Protocol wrong type for socket";
     case ENOPROTOOPT:
-      return "Protocol not available";
+      return (char*)"Protocol not available";
     case EPROTONOSUPPORT:
-      return "Protocol not supported";
+      return (char*)"Protocol not supported";
     case ESOCKTNOSUPPORT:
-      return "Socket type not supported";
+      return (char*)"Socket type not supported";
     case EOPNOTSUPP:
-      return "Operation not supported";
+      return (char*)"Operation not supported";
     case EPFNOSUPPORT:
-      return "Protocol family not supported";
+      return (char*)"Protocol family not supported";
     case EAFNOSUPPORT:
-      return "Address family not supported by protocol";
+      return (char*)"Address family not supported by protocol";
     case EADDRINUSE:
-      return "Address already in use";
+      return (char*)"Address already in use";
     case EADDRNOTAVAIL:
-      return "Cannot assign requested address";
+      return (char*)"Cannot assign requested address";
     case ENETDOWN:
-      return "Network is down";
+      return (char*)"Network is down";
     case ENETUNREACH:
-      return "Network is unreachable";
+      return (char*)"Network is unreachable";
     case ENETRESET:
-      return "Network dropped connection on reset";
+      return (char*)"Network dropped connection on reset";
     case ECONNABORTED:
-      return "Software caused connection abort";
+      return (char*)"Software caused connection abort";
     case ECONNRESET:
-      return "Connection reset by peer";
+      return (char*)"Connection reset by peer";
     case ENOBUFS:
-      return "No buffer space available";
+      return (char*)"No buffer space available";
     case EISCONN:
-      return "Transport endpoint is already connected";
+      return (char*)"Transport endpoint is already connected";
     case ENOTCONN:
-      return "Transport endpoint is not connected";
+      return (char*)"Transport endpoint is not connected";
     case ESHUTDOWN:
-      return "Cannot send after transport endpoint shutdown";
+      return (char*)"Cannot send after transport endpoint shutdown";
     case ETOOMANYREFS:
-      return "Too many references: cannot splice";
+      return (char*)"Too many references: cannot splice";
     case ETIMEDOUT:
-      return "Connection timed out";
+      return (char*)"Connection timed out";
     case ECONNREFUSED:
-      return "Connection refused";
+      return (char*)"Connection refused";
     case ELOOP:
-      return "Too many levels of symbolic links";
+      return (char*)"Too many levels of symbolic links";
     case EHOSTDOWN:
-      return "Host is down";
+      return (char*)"Host is down";
     case EHOSTUNREACH:
-      return "No route to host";
+      return (char*)"No route to host";
     case EPROCLIM:
-      return "Too many processes";
+      return (char*)"Too many processes";
     case EUSERS:
-      return "Too many users";
+      return (char*)"Too many users";
     case EDQUOT:
-      return "Disk quota exceeded";
+      return (char*)"Disk quota exceeded";
     case ESTALE:
-      return "Stale NFS file handle";
+      return (char*)"Stale NFS file handle";
     case EREMOTE:
-      return "Object is remote";
+      return (char*)"Object is remote";
 #  if HAVE_WINSOCK2_H
     /* WSA_INVALID_HANDLE maps to EBADF */
     /* WSA_NOT_ENOUGH_MEMORY maps to ENOMEM */
     /* WSA_INVALID_PARAMETER maps to EINVAL */
     case WSA_OPERATION_ABORTED:
-      return "Overlapped operation aborted";
+      return (char*)"Overlapped operation aborted";
     case WSA_IO_INCOMPLETE:
-      return "Overlapped I/O event object not in signaled state";
+      return (char*)"Overlapped I/O event object not in signaled state";
     case WSA_IO_PENDING:
-      return "Overlapped operations will complete later";
+      return (char*)"Overlapped operations will complete later";
     /* WSAEINTR maps to EINTR */
     /* WSAEBADF maps to EBADF */
     /* WSAEACCES maps to EACCES */
@@ -172,86 +172,86 @@ rpl_strerror (int n)
     /* WSAESTALE is ESTALE */
     /* WSAEREMOTE is EREMOTE */
     case WSASYSNOTREADY:
-      return "Network subsystem is unavailable";
+      return (char*)"Network subsystem is unavailable";
     case WSAVERNOTSUPPORTED:
-      return "Winsock.dll version out of range";
+      return (char*)"Winsock.dll version out of range";
     case WSANOTINITIALISED:
-      return "Successful WSAStartup not yet performed";
+      return (char*)"Successful WSAStartup not yet performed";
     case WSAEDISCON:
-      return "Graceful shutdown in progress";
+      return (char*)"Graceful shutdown in progress";
     case WSAENOMORE: case WSA_E_NO_MORE:
-      return "No more results";
+      return (char*)"No more results";
     case WSAECANCELLED: case WSA_E_CANCELLED:
-      return "Call was canceled";
+      return (char*)"Call was canceled";
     case WSAEINVALIDPROCTABLE:
-      return "Procedure call table is invalid";
+      return (char*)"Procedure call table is invalid";
     case WSAEINVALIDPROVIDER:
-      return "Service provider is invalid";
+      return (char*)"Service provider is invalid";
     case WSAEPROVIDERFAILEDINIT:
-      return "Service provider failed to initialize";
+      return (char*)"Service provider failed to initialize";
     case WSASYSCALLFAILURE:
-      return "System call failure";
+      return (char*)"System call failure";
     case WSASERVICE_NOT_FOUND:
-      return "Service not found";
+      return (char*)"Service not found";
     case WSATYPE_NOT_FOUND:
-      return "Class type not found";
+      return (char*)"Class type not found";
     case WSAEREFUSED:
-      return "Database query was refused";
+      return (char*)"Database query was refused";
     case WSAHOST_NOT_FOUND:
-      return "Host not found";
+      return (char*)"Host not found";
     case WSATRY_AGAIN:
-      return "Nonauthoritative host not found";
+      return (char*)"Nonauthoritative host not found";
     case WSANO_RECOVERY:
-      return "Nonrecoverable error";
+      return (char*)"Nonrecoverable error";
     case WSANO_DATA:
-      return "Valid name, no data record of requested type";
+      return (char*)"Valid name, no data record of requested type";
     /* WSA_QOS_* omitted */
 #  endif
 # endif
 
 # if GNULIB_defined_ENOMSG
     case ENOMSG:
-      return "No message of desired type";
+      return (char*)"No message of desired type";
 # endif
 
 # if GNULIB_defined_EIDRM
     case EIDRM:
-      return "Identifier removed";
+      return (char*)"Identifier removed";
 # endif
 
 # if GNULIB_defined_ENOLINK
     case ENOLINK:
-      return "Link has been severed";
+      return (char*)"Link has been severed";
 # endif
 
 # if GNULIB_defined_EPROTO
     case EPROTO:
-      return "Protocol error";
+      return (char*)"Protocol error";
 # endif
 
 # if GNULIB_defined_EMULTIHOP
     case EMULTIHOP:
-      return "Multihop attempted";
+      return (char*)"Multihop attempted";
 # endif
 
 # if GNULIB_defined_EBADMSG
     case EBADMSG:
-      return "Bad message";
+      return (char*)"Bad message";
 # endif
 
 # if GNULIB_defined_EOVERFLOW
     case EOVERFLOW:
-      return "Value too large for defined data type";
+      return (char*)"Value too large for defined data type";
 # endif
 
 # if GNULIB_defined_ENOTSUP
     case ENOTSUP:
-      return "Not supported";
+      return (char*)"Not supported";
 # endif
 
 # if GNULIB_defined_
     case ECANCELED:
-      return "Operation canceled";
+      return (char*)"Operation canceled";
 # endif
     }
 

-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|


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