[libvirt] [PATCH 2/2] build: import latest gnulib, for mingw and syntax-check fixes

Eric Blake eblake at redhat.com
Tue Nov 29 13:53:45 UTC 2011


Gnulib has picked up our fixes for openpty on mingw.  It has
also added support for a new gcc warning option,
-Wunsuffixed-float-constants, which was pretty easy to silence
(sometimes, using 'float' is more efficient than the default
of 'double' that you get for an unsuffixed constant).

* .gnulib: Update to latest, for openpty fixes, and improved
'make syntax-check' and compiler warnings.
* gnulib/local/lib/pty.in.h.diff: Delete, no longer needed.
* gnulib/local/lib/openpty.c.diff: Likewise.
* m4/virt-compile-warnings.m4 (LIBVIRT_COMPILE_WARNINGS):
Re-silence -Wformat-nonliteral.
* src/fdstream.c (virFDStreamConnectUNIX): Suffix floating point
constants.
* src/xenapi/xenapi_utils.c (createVMRecordFromXml): Likewise.
* src/qemu/qemu_monitor.c (qemuMonitorOpenUnix): Likewise.
* src/qemu/qemu_monitor_json.c
(qemuMonitorJSONSetMigrationDowntime): Likewise.
* tools/virsh.c (cmdDomControl, cmdDominfo, cmdVcpuinfo)
(print_job_progress, DIFF_MSEC): Likewise.
* tests/testutils.c (DIFF_MSEC): Likewise.
---

* .gnulib e56e96f...908690c (79):
  > hash: mark compute_bucket_size with the pure attribute
  > quotearg, propername: correct pragma guard expression
  > propername: do not mark proper_name with the const attribute
  > propername: mark one more function as const
  > mark functions with const and pure attributes
  > Remove unused macros from !_LIBC code in glibc-borrowed files.
  > getcwd: Fix link error on MSVC 9.
  > Don't set REPLACE_FOO to 1 if HAVE_FOO is 0.
  > getcwd: Fix bug from 2011-08-17.
  > binary-io tests: Avoid test failure on mingw when libtool is used.
  > Fix conflict between two instantiations of module 'unistd'.
  > pagealign_alloc: Doc and comments.
  > test-update-copyright.sh: avoid false-positive failure
  > valgrind-tests.m4: Avoid breakage if valgrind on bash fails.
  > test-stdalign.c: comment out long double tests
  > init.sh: make "compare /dev/null FILE" output more readable
  > init.sh: work around OSF/1 5.1's mishandling of /dev/null
  > gnulib-common: Silence warnings against config.h code.
  > autoupdate
  > getcwd: Work around getcwd bug on AIX 5..7.
  > getcwd: Fix bug from 2009-09-10.
  > manywarnings: More warnings.
  > fma tests: Avoid shadowing local variables.
  > copysignf tests: Fix.
  > fma: Remove unused code.
  > sethostname: Fix doc about AIX.
  > sethostname: Mention more portability problems.
  > Depend on module fcntl-h when AT_FDCWD is used.
  > euidaccess: Update a comment.
  > openat: Fix file list.
  > fstatat: Simplify.
  > Ensure 'inline' can be used in tests/test-utimens-common.h.
  > hash: Don't refer to deprecated interfaces.
  > readline: Check for readline/history.h.
  > test-getcwd: disambiguate exit status
  > fstatat: fix configuration bug on mingw, OpenBSD 4, Solaris 8
  > hash: deprecate poorly-named hash_insert0: use hash_insert_if_absent
  > openat: avoid compilation failure due to lack of <errno.h> inclusion
  > * modules/getcwd (Depends-on): Add fdopendir.
  > modules/crypto/gc-*: simplify dependencies and fix stdalign.h bug
  > tests: factor out st_ctime-comparison code (a dozen uses)
  > test-getcwd: don't leave behind a confdir3/ directory upon interrupt
  > gitlog-to-changelog: support multi-author commits.
  > Fix some modules' file list.
  > maint.mk: fix tight-scope.mk generation in VPATH builds.
  > Silence successful tests that use 'compare' on AIX, HP-UX, Solaris.
  > Makefile: Tweak indentation.
  > Syntax check for copyright statements.
  > Fix for last commit.
  > git-version-gen: Add --prefix.
  > git-version: Improve command line handling.
  > revamp the other test-exclude?.sh scripts to use init.sh, too
  > test-exclude2.sh, test-exclude5.sh: fail if test-exclude fails
  > test-exclude: fix a typo
  > autoupdate
  > obstack: Fix compilation error on MSVC 9.
  > test-exclude: skip tests rather than failing on deficient systems
  > ptsname_r test: Avoid gcc warning on glibc systems.
  > ptsname_r: Avoid compilation error on OSF/1 5.1.
  > fstatat: Make cross-compilation guess succeed everywhere except on AIX.
  > ptsname_r tests: Fix bugs.
  > fstatat: work with cross-compilation
  > Improve MODULES.html output.
  > ptsname_r-tests: new test module
  > update from texinfo
  > ptsname_r: new module
  > announce-gen: be more concise when there's only one URL+tarball
  > openpty: provide a stub on mingw
  > raise: fix mingw handling of SIGPIPE
  > More conditional dependencies.
  > faccessat: Move AC_LIBOBJ invocation to module description.
  > faccessat: Simplify autoconf macro.
  > renameat: Fix dependencies.
  > mkfifoat: Fix module description.
  > fstatat: Remove unused dependency.
  > GNUmakefile: behave when Makefile is missing.
  > openat: Conditionalize dependencies.
  > maint.mk: extract GPG key ID without using a temporary file
  > grantpt: fix typo

 .gnulib                         |    2 +-
 gnulib/local/lib/openpty.c.diff |   26 --------------------------
 gnulib/local/lib/pty.in.h.diff  |   13 -------------
 m4/virt-compile-warnings.m4     |    8 ++++++--
 src/fdstream.c                  |    2 +-
 src/qemu/qemu_monitor.c         |    2 +-
 src/qemu/qemu_monitor_json.c    |    2 +-
 src/xenapi/xenapi_utils.c       |    2 +-
 tests/testutils.c               |    4 ++--
 tools/virsh.c                   |   12 ++++++------
 10 files changed, 19 insertions(+), 54 deletions(-)
 delete mode 100644 gnulib/local/lib/openpty.c.diff
 delete mode 100644 gnulib/local/lib/pty.in.h.diff

diff --git a/.gnulib b/.gnulib
index e56e96f..908690c 160000
--- a/.gnulib
+++ b/.gnulib
@@ -1 +1 @@
-Subproject commit e56e96fe20f72586e9ec5c528b9a9a06daa2ecc6
+Subproject commit 908690cb743e69c73b42ae310807b29800c8764b
diff --git a/gnulib/local/lib/openpty.c.diff b/gnulib/local/lib/openpty.c.diff
deleted file mode 100644
index f17e566..0000000
--- a/gnulib/local/lib/openpty.c.diff
+++ /dev/null
@@ -1,26 +0,0 @@
-diff --git c/lib/openpty.c i/lib/openpty.c
-index c398db5..d61d5ba 100644
---- c/lib/openpty.c
-+++ i/lib/openpty.c
-@@ -32,6 +32,21 @@ rpl_openpty (int *amaster, int *aslave, char *name,
-                   (struct winsize *) winp);
- }
-
-+#elif (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__ /* mingw */
-+
-+# include <errno.h>
-+
-+int
-+openpty (int *amaster _GL_UNUSED, int *aslave _GL_UNUSED,
-+         char *name _GL_UNUSED,
-+         struct termios const *termp _GL_UNUSED,
-+         struct winsize const *winp _GL_UNUSED)
-+{
-+  /* Mingw lacks pseudo-terminals altogether.  */
-+  errno = ENOSYS;
-+  return -1;
-+}
-+
- #else /* AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 10, mingw */
-
- # include <fcntl.h>
diff --git a/gnulib/local/lib/pty.in.h.diff b/gnulib/local/lib/pty.in.h.diff
deleted file mode 100644
index 9470700..0000000
--- a/gnulib/local/lib/pty.in.h.diff
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git c/lib/pty.in.h i/lib/pty.in.h
-index aff989c..00eecc6 100644
---- c/lib/pty.in.h
-+++ i/lib/pty.in.h
-@@ -92,6 +92,8 @@ _GL_WARN_ON_USE (forkpty, "forkpty is not declared consistently - "
- /* Create pseudo tty master slave pair and set terminal attributes
-    according to TERMP and WINP.  Return handles for both ends in
-    *AMASTER and *ASLAVE, and return the name of the slave end in NAME.  */
-+struct termios;
-+struct winsize;
- # if @REPLACE_OPENPTY@
- #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
- #   undef openpty
diff --git a/m4/virt-compile-warnings.m4 b/m4/virt-compile-warnings.m4
index 305036f..213b3db 100644
--- a/m4/virt-compile-warnings.m4
+++ b/m4/virt-compile-warnings.m4
@@ -55,8 +55,8 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
         # Things like virAsprintf mean we can't use this
         dontwarn="$dontwarn -Wformat-nonliteral"

-        # We might fundamentally need some of these disabled forever, but ideally
-        # we'd turn many of them on
+        # We might fundamentally need some of these disabled forever, but
+        # ideally we'd turn many of them on
         dontwarn="$dontwarn -Wfloat-equal"
         dontwarn="$dontwarn -Wdeclaration-after-statement"
         dontwarn="$dontwarn -Wcast-qual"
@@ -88,6 +88,10 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
         # that one off, so we need to manually enable this again
         gl_WARN_ADD([-Wjump-misses-init])

+        # GNULIB turns on -Wformat=2 which implies -Wformat-nonliteral,
+        # so we need to manually re-exclude it.
+        gl_WARN_ADD([-Wno-format-nonliteral])
+
         # This should be < 256 really. Currently we're down to 4096,
         # but using 1024 bytes sized buffers (mostly for virStrerror)
         # stops us from going down further
diff --git a/src/fdstream.c b/src/fdstream.c
index 841f979..1471c65 100644
--- a/src/fdstream.c
+++ b/src/fdstream.c
@@ -482,7 +482,7 @@ int virFDStreamConnectUNIX(virStreamPtr st,
         }

         goto error;
-    } while ((++i <= timeout*5) && (usleep(.2 * 1000000) <= 0));
+    } while ((++i <= timeout*5) && (usleep(.2F * 1000000) <= 0));

     if (virFDStreamOpenInternal(st, fd, NULL, -1, 0) < 0)
         goto error;
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 73e5ea9..1a5b7d8 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -252,7 +252,7 @@ qemuMonitorOpenUnix(const char *monitor, pid_t cpid)
                              _("failed to connect to monitor socket"));
         goto error;

-    } while ((++i <= timeout*5) && (usleep(.2 * 1000000) <= 0));
+    } while ((++i <= timeout*5) && (usleep(.2F * 1000000) <= 0));

     if (ret != 0) {
         virReportSystemError(errno, "%s",
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 56a62db..9187ab0 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -2083,7 +2083,7 @@ int qemuMonitorJSONSetMigrationDowntime(qemuMonitorPtr mon,
     virJSONValuePtr reply = NULL;

     cmd = qemuMonitorJSONMakeCommand("migrate_set_downtime",
-                                     "d:value", downtime / 1000.0,
+                                     "d:value", downtime / 1000.0D,
                                      NULL);
     if (!cmd)
         return -1;
diff --git a/src/xenapi/xenapi_utils.c b/src/xenapi/xenapi_utils.c
index 79fd946..888497b 100644
--- a/src/xenapi/xenapi_utils.c
+++ b/src/xenapi/xenapi_utils.c
@@ -548,7 +548,7 @@ createVMRecordFromXml (virConnectPtr conn, virDomainDefPtr def,
     (*record)->other_config = xen_string_string_map_alloc(0);
     (*record)->last_boot_cpu_flags = xen_string_string_map_alloc(0);
     (*record)->xenstore_data = xen_string_string_map_alloc(0);
-    (*record)->hvm_shadow_multiplier = 1.000;
+    (*record)->hvm_shadow_multiplier = 1;
     if (!xen_vm_create(((struct _xenapiPrivate *)(conn->privateData))->session,
                         vm, *record)) {
         xenapiSessionErrorHandler(conn, VIR_ERR_INTERNAL_ERROR, NULL);
diff --git a/tests/testutils.c b/tests/testutils.c
index acdfdc1..bac47a1 100644
--- a/tests/testutils.c
+++ b/tests/testutils.c
@@ -45,8 +45,8 @@

 #define GETTIMEOFDAY(T) gettimeofday(T, NULL)
 #define DIFF_MSEC(T, U)                                 \
-    ((((int) ((T)->tv_sec - (U)->tv_sec)) * 1000000.0 + \
-      ((int) ((T)->tv_usec - (U)->tv_usec))) / 1000.0)
+    ((((int) ((T)->tv_sec - (U)->tv_sec)) * 1000000.0D + \
+      ((int) ((T)->tv_usec - (U)->tv_usec))) / 1000.0D)

 #include "virfile.h"

diff --git a/tools/virsh.c b/tools/virsh.c
index d8e5dae..e1303fa 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -73,8 +73,8 @@ static char *progname;

 #define GETTIMEOFDAY(T) gettimeofday(T, NULL)
 #define DIFF_MSEC(T, U) \
-        ((((int) ((T)->tv_sec - (U)->tv_sec)) * 1000000.0 + \
-          ((int) ((T)->tv_usec - (U)->tv_usec))) / 1000.0)
+        ((((int) ((T)->tv_sec - (U)->tv_sec)) * 1000000.0D + \
+          ((int) ((T)->tv_usec - (U)->tv_usec))) / 1000.0D)

 /**
  * The log configuration
@@ -1037,7 +1037,7 @@ cmdDomControl(vshControl *ctl, const vshCmd *cmd)
         info.state != VIR_DOMAIN_CONTROL_ERROR) {
         vshPrint(ctl, "%s (%0.3fs)\n",
                  _(vshDomainControlStateToString(info.state)),
-                 info.stateTime / 1000.0);
+                 info.stateTime / 1000.0D);
     } else {
         vshPrint(ctl, "%s\n",
                  _(vshDomainControlStateToString(info.state)));
@@ -3337,7 +3337,7 @@ cmdDominfo(vshControl *ctl, const vshCmd *cmd)
         if (info.cpuTime != 0) {
             double cpuUsed = info.cpuTime;

-            cpuUsed /= 1000000000.0;
+            cpuUsed /= 1000000000;

             vshPrint(ctl, "%-15s %.1lfs\n", _("CPU time:"), cpuUsed);
         }
@@ -3964,7 +3964,7 @@ cmdVcpuinfo(vshControl *ctl, const vshCmd *cmd)
             if (cpuinfo[n].cpuTime != 0) {
                 double cpuUsed = cpuinfo[n].cpuTime;

-                cpuUsed /= 1000000000.0;
+                cpuUsed /= 1000000000;

                 vshPrint(ctl, "%-15s %.1lfs\n", _("CPU time:"), cpuUsed);
             }
@@ -5692,7 +5692,7 @@ print_job_progress(const char *label, unsigned long long remaining,
         progress = 100;
     } else {
         /* use float to avoid overflow */
-        progress = (int)(100.0 - remaining * 100.0 / total);
+        progress = (int)(100.0F - remaining * 100.0F / total);
         if (progress >= 100) {
             /* migration has not completed, do not print [100 %] */
             progress = 99;
-- 
1.7.7.3




More information about the libvir-list mailing list