[libvirt] [PATCH] build: fix PROBE() usage of intptr_t

Eric Blake eblake at redhat.com
Thu Aug 9 21:47:06 UTC 2012


Otherwise, in locations like virobject.c where PROBE is used,
for certain configure options, the compiler warns:

util/virobject.c:110:1: error: 'intptr_t' undeclared (first use in this function)

As long as we are making this header always available, we can
clean up several other files.

* src/internal.h (includes): Pull in <stdint.h>.
* src/conf/nwfilter_conf.h: Rely on internal.h.
* src/storage/storage_backend.c: Likewise.
* src/storage/storage_backend.h: Likewise.
* src/util/cgroup.c: Likewise.
* src/util/sexpr.h: Likewise.
* src/util/virhashcode.h: Likewise.
* src/util/virnetdevvportprofile.h: Likewise.
* src/util/virnetlink.h: Likewise.
* src/util/virrandom.h: Likewise.
* src/vbox/vbox_driver.c: Likewise.
* src/xenapi/xenapi_driver.c: Likewise.
* src/xenapi/xenapi_utils.c: Likewise.
* src/xenapi/xenapi_utils.h: Likewise.
* src/xenxs/xenxs_private.h: Likewise.
* tests/storagebackendsheepdogtest.c: Likewise.
Reported by Matthias Bolte.
---

Almost qualifies for the build-breaker rule, except that I didn't
reproduce the particular configure settings that Matthias was
experiencing on IRC.

 src/conf/nwfilter_conf.h           | 5 +----
 src/internal.h                     | 1 +
 src/storage/storage_backend.c      | 1 -
 src/storage/storage_backend.h      | 3 +--
 src/util/cgroup.c                  | 1 -
 src/util/sexpr.h                   | 8 ++------
 src/util/virhashcode.h             | 1 -
 src/util/virnetdevvportprofile.h   | 4 +---
 src/util/virnetlink.h              | 2 --
 src/util/virrandom.h               | 1 -
 src/vbox/vbox_driver.c             | 4 +---
 src/xenapi/xenapi_driver.c         | 1 -
 src/xenapi/xenapi_utils.c          | 1 -
 src/xenapi/xenapi_utils.h          | 2 +-
 src/xenxs/xenxs_private.h          | 3 +--
 tests/storagebackendsheepdogtest.c | 2 --
 16 files changed, 9 insertions(+), 31 deletions(-)

diff --git a/src/conf/nwfilter_conf.h b/src/conf/nwfilter_conf.h
index 8b05d04..ca6bd16 100644
--- a/src/conf/nwfilter_conf.h
+++ b/src/conf/nwfilter_conf.h
@@ -2,7 +2,7 @@
  * nwfilter_conf.h: network filter XML processing
  *                  (derived from storage_conf.h)
  *
- * Copyright (C) 2006-2010 Red Hat, Inc.
+ * Copyright (C) 2006-2010, 2012 Red Hat, Inc.
  * Copyright (C) 2006-2008 Daniel P. Berrange
  *
  * Copyright (C) 2010 IBM Corporation
@@ -26,9 +26,6 @@
 #ifndef NWFILTER_CONF_H
 # define NWFILTER_CONF_H

-# include <stdint.h>
-# include <stddef.h>
-
 # include "internal.h"

 # include "util.h"
diff --git a/src/internal.h b/src/internal.h
index fd8d190..300de3a 100644
--- a/src/internal.h
+++ b/src/internal.h
@@ -9,6 +9,7 @@
 # include <limits.h>
 # include <verify.h>
 # include <stdbool.h>
+# include <stdint.h>

 # if STATIC_ANALYSIS
 #  undef NDEBUG /* Don't let a prior NDEBUG definition cause trouble.  */
diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
index 4a2109e..df3833a 100644
--- a/src/storage/storage_backend.c
+++ b/src/storage/storage_backend.c
@@ -32,7 +32,6 @@
 #include <sys/wait.h>
 #include <unistd.h>
 #include <fcntl.h>
-#include <stdint.h>
 #include <sys/stat.h>
 #include <sys/param.h>
 #include <dirent.h>
diff --git a/src/storage/storage_backend.h b/src/storage/storage_backend.h
index bafd6b6..5352f5d 100644
--- a/src/storage/storage_backend.h
+++ b/src/storage/storage_backend.h
@@ -1,7 +1,7 @@
 /*
  * storage_backend.h: internal storage driver backend contract
  *
- * Copyright (C) 2007-2010 Red Hat, Inc.
+ * Copyright (C) 2007-2010, 2012 Red Hat, Inc.
  * Copyright (C) 2007-2008 Daniel P. Berrange
  *
  * This library is free software; you can redistribute it and/or
@@ -24,7 +24,6 @@
 #ifndef __VIR_STORAGE_BACKEND_H__
 # define __VIR_STORAGE_BACKEND_H__

-# include <stdint.h>
 # include "internal.h"
 # include "storage_conf.h"
 # include "command.h"
diff --git a/src/util/cgroup.c b/src/util/cgroup.c
index 6c29c87..2256c23 100644
--- a/src/util/cgroup.c
+++ b/src/util/cgroup.c
@@ -24,7 +24,6 @@
 #include <config.h>

 #include <stdio.h>
-#include <stdint.h>
 #if defined HAVE_MNTENT_H && defined HAVE_GETMNTENT_R
 # include <mntent.h>
 #endif
diff --git a/src/util/sexpr.h b/src/util/sexpr.h
index 8dfd89a..b4b41ed 100644
--- a/src/util/sexpr.h
+++ b/src/util/sexpr.h
@@ -1,9 +1,8 @@
 /*
  * sexpr.h : S-Expression interfaces needed to communicate with the Xen Daemon
  *
- * Copyright (C) 2005
- *
- *      Anthony Liguori <aliguori at us.ibm.com>
+ * Copyright (C) 2012 Red Hat, Inc.
+ * Copyright (C) 2005 Anthony Liguori <aliguori at us.ibm.com>
  *
  *  This file is subject to the terms and conditions of the GNU Lesser General
  *  Public License. See the file COPYING.LIB in the main directory of this
@@ -16,9 +15,6 @@
 # include "internal.h"
 # include "buf.h"

-# include <sys/types.h>
-# include <stdint.h>
-
 enum sexpr_type {
     SEXPR_NIL,
     SEXPR_CONS,
diff --git a/src/util/virhashcode.h b/src/util/virhashcode.h
index 2fb7a95..34254b6 100644
--- a/src/util/virhashcode.h
+++ b/src/util/virhashcode.h
@@ -29,7 +29,6 @@
 # define __VIR_HASH_CODE_H__

 # include "internal.h"
-# include <stdint.h>

 extern uint32_t virHashCodeGen(const void *key, size_t len, uint32_t seed);

diff --git a/src/util/virnetdevvportprofile.h b/src/util/virnetdevvportprofile.h
index 6cce1bb..f33da18 100644
--- a/src/util/virnetdevvportprofile.h
+++ b/src/util/virnetdevvportprofile.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2009-2011 Red Hat, Inc.
+ * Copyright (C) 2009-2012 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -23,8 +23,6 @@
 #ifndef __VIR_NETDEV_VPORT_PROFILE_H__
 # define __VIR_NETDEV_VPORT_PROFILE_H__

-# include <stdint.h>
-
 # include "internal.h"
 # include "uuid.h"
 # include "util.h"
diff --git a/src/util/virnetlink.h b/src/util/virnetlink.h
index 1997c8d..5d8337d 100644
--- a/src/util/virnetlink.h
+++ b/src/util/virnetlink.h
@@ -24,8 +24,6 @@
 # include "internal.h"
 # include "virmacaddr.h"

-# include <stdint.h>
-
 # if defined(__linux__) && defined(HAVE_LIBNL)

 #  include <netlink/msg.h>
diff --git a/src/util/virrandom.h b/src/util/virrandom.h
index 8d3cad7..29a055d 100644
--- a/src/util/virrandom.h
+++ b/src/util/virrandom.h
@@ -23,7 +23,6 @@
 # define __VIR_RANDOM_H__

 # include "internal.h"
-# include <stdint.h>

 uint64_t virRandomBits(int nbits);
 int virRandomGenerateWWN(char **wwn, const char *virt_type);
diff --git a/src/vbox/vbox_driver.c b/src/vbox/vbox_driver.c
index b340b7c..c4037f8 100644
--- a/src/vbox/vbox_driver.c
+++ b/src/vbox/vbox_driver.c
@@ -3,7 +3,7 @@
  */

 /*
- * Copyright (C) 2010-2011 Red Hat, Inc.
+ * Copyright (C) 2010-2012 Red Hat, Inc.
  * Copyright (C) 2008-2009 Sun Microsystems, Inc.
  *
  * This file is part of a free software library; you can redistribute
@@ -29,9 +29,7 @@

 #include <config.h>

-#include <stdint.h>
 #include <unistd.h>
-#include <sys/types.h>

 #include "internal.h"

diff --git a/src/xenapi/xenapi_driver.c b/src/xenapi/xenapi_driver.c
index 5608de8..f57449e 100644
--- a/src/xenapi/xenapi_driver.c
+++ b/src/xenapi/xenapi_driver.c
@@ -23,7 +23,6 @@
 #include <config.h>

 #include <limits.h>
-#include <stdint.h>
 #include <string.h>
 #include <curl/curl.h>
 #include <xen/api/xen_all.h>
diff --git a/src/xenapi/xenapi_utils.c b/src/xenapi/xenapi_utils.c
index 3031a17..d62192a 100644
--- a/src/xenapi/xenapi_utils.c
+++ b/src/xenapi/xenapi_utils.c
@@ -24,7 +24,6 @@

 #include <stdio.h>
 #include <string.h>
-#include <stdint.h>
 #include <xen/api/xen_all.h>
 #include "internal.h"
 #include "domain_conf.h"
diff --git a/src/xenapi/xenapi_utils.h b/src/xenapi/xenapi_utils.h
index 5912446..86af07c 100644
--- a/src/xenapi/xenapi_utils.h
+++ b/src/xenapi/xenapi_utils.h
@@ -1,5 +1,6 @@
 /*
  * xenapi_utils.h: Xen API driver -- utils header
+ * Copyright (C) 2012, Red Hat, Inc.
  * Copyright (C) 2009, 2010 Citrix Ltd.
  *
  * This library is free software; you can redistribute it and/or
@@ -22,7 +23,6 @@
 #ifndef __VIR_XENAPI_UTILS__
 # define __VIR_XENAPI_UTILS__

-# include <stdint.h>
 # include <xen/api/xen_all.h>
 # include "internal.h"
 # include "viruri.h"
diff --git a/src/xenxs/xenxs_private.h b/src/xenxs/xenxs_private.h
index d0ba59a..17b481b 100644
--- a/src/xenxs/xenxs_private.h
+++ b/src/xenxs/xenxs_private.h
@@ -1,8 +1,8 @@
 /*
  * xenxs_private.h: Private definitions for Xen parsing
  *
+ * Copyright (C) 2007, 2010, 2012 Red Hat, Inc.
  * Copyright (C) 2011 Univention GmbH
- * Copyright (C) 2007, 2010 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -27,7 +27,6 @@

 # include "internal.h"

-# include <stdint.h>
 # include <xen/xen.h>
 # include "xen_sxpr.h"

diff --git a/tests/storagebackendsheepdogtest.c b/tests/storagebackendsheepdogtest.c
index b7b3b35..ba5bc36 100644
--- a/tests/storagebackendsheepdogtest.c
+++ b/tests/storagebackendsheepdogtest.c
@@ -25,10 +25,8 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
-#include <stdint.h>
 #include <string.h>

-#include <sys/types.h>
 #include <fcntl.h>

 #include "internal.h"
-- 
1.7.11.2




More information about the libvir-list mailing list