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

Re: [Libvir] gnulib: take2, trunk-relative patch



"Richard W.M. Jones" <rjones redhat com> wrote:
> Jim, to use the gnulib <string.h> replacement with GCC 4.1.2 compiled
> under MinGW, I needed to patch lib/string.h as follows:
>
> --- gnulib/lib/string.h~        2007-12-05 18:29:29.000000000 +0000
> +++ gnulib/lib/string.h 2007-12-05 19:36:22.000000000 +0000
> @@ -280,7 +280,7 @@
>     See also strtok_r().  */
>  #if 1
>  # if ! 0
> -extern char *strsep (char **restrict __stringp, char const *restrict
> __delim);
> +extern char *strsep (char **__restrict__ __stringp, char const
> *__restrict__ __delim);
>  # endif
>  # if defined GNULIB_POSIXCHECK
>  #  undef strsep
>
> This seems to be because C99's restrict keyword is not enabled by
> default.  You need to pass the -std=c99 parameter to the compiler to
> get this.

Thanks for the report.
That file is generated from string.in.h, based on
settings determined at configure time.

And one of the autoconf checks performed for the string module
is to require the AC_C_RESTRICT macro which is supposed to
detect which flavor of restrict to use.  Then it puts the appropriate
definition of e.g.

#define restrict __restrict__

in config.h.

Ahh...  I've got it.
There are a bunch of files that don't include config.h.

There's a rule in "autoconf" land saying that
nearly every .c file should include "config.h" before anything else.
Most of the time people don't notice when it's forgotten, but
porting to "different" systems highlights the trouble.

You can list the files that include string.h yet do *not* include config.h,

    git-grep -l 'include <string\.h>'|xargs grep -L config.h

And here's a proposed patch to fix those.
There may well be others, but this should solve your build failure:

Include "config.h".

* qemud/event.c: Likewise.
* src/buf.c: Likewise.
* src/hash.c: Likewise.
* src/nodeinfo.c: Likewise.
* src/openvz_conf.c: Likewise.
* src/proxy_internal.c: Likewise.
* src/virterror.c: Likewise.
* src/xmlrpc.c: Likewise.
* src/xs_internal.c: Likewise.
* tests/conftest.c: Likewise.
* tests/xmlrpctest.c: Likewise.

Signed-off-by: Jim Meyering <meyering redhat com>
---
 qemud/event.c        |    1 +
 src/buf.c            |    2 ++
 src/hash.c           |    2 ++
 src/nodeinfo.c       |    2 ++
 src/openvz_conf.c    |    2 ++
 src/proxy_internal.c |    2 ++
 src/virterror.c      |    2 ++
 src/xmlrpc.c         |    2 ++
 src/xs_internal.c    |    2 ++
 tests/conftest.c     |    2 ++
 tests/xmlrpctest.c   |    2 ++
 11 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/qemud/event.c b/qemud/event.c
index 72d490e..1faeaf1 100644
--- a/qemud/event.c
+++ b/qemud/event.c
@@ -21,6 +21,7 @@
  * Author: Daniel P. Berrange <berrange redhat com>
  */

+#include "config.h"

 #include <stdlib.h>
 #include <string.h>
diff --git a/src/buf.c b/src/buf.c
index 0252357..5b7f15d 100644
--- a/src/buf.c
+++ b/src/buf.c
@@ -8,6 +8,8 @@
  * Daniel Veillard <veillard redhat com>
  */

+#include "config.h"
+
 #include "libvirt/libvirt.h"

 #include <stdio.h>
diff --git a/src/hash.c b/src/hash.c
index 2b4b6ec..b7962d9 100644
--- a/src/hash.c
+++ b/src/hash.c
@@ -18,6 +18,8 @@
  *         Daniel Veillard <veillard redhat com>
  */

+#include "config.h"
+
 #include <string.h>
 #include <stdlib.h>
 #include <libxml/threads.h>
diff --git a/src/nodeinfo.c b/src/nodeinfo.c
index 2ef49cb..98e72e8 100644
--- a/src/nodeinfo.c
+++ b/src/nodeinfo.c
@@ -21,6 +21,8 @@
  * Author: Daniel P. Berrange <berrange redhat com>
  */

+#include "config.h"
+
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
diff --git a/src/openvz_conf.c b/src/openvz_conf.c
index 88491f7..0502a1d 100644
--- a/src/openvz_conf.c
+++ b/src/openvz_conf.c
@@ -27,6 +27,8 @@

 #ifdef WITH_OPENVZ

+#include "config.h"
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
diff --git a/src/proxy_internal.c b/src/proxy_internal.c
index 6f142c5..2b98c61 100644
--- a/src/proxy_internal.c
+++ b/src/proxy_internal.c
@@ -8,6 +8,8 @@
  * Daniel Veillard <veillard redhat com>
  */

+#include "config.h"
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
diff --git a/src/virterror.c b/src/virterror.c
index 105d65f..0c0423b 100644
--- a/src/virterror.c
+++ b/src/virterror.c
@@ -8,6 +8,8 @@
  * Author: Daniel Veillard <veillard redhat com>
  */

+#include "config.h"
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/src/xmlrpc.c b/src/xmlrpc.c
index d58f887..d65a7a9 100644
--- a/src/xmlrpc.c
+++ b/src/xmlrpc.c
@@ -8,6 +8,8 @@
  * Anthony Liguori <aliguori us ibm com>
  */

+#include "config.h"
+
 #include "xmlrpc.h"
 #include "internal.h"

diff --git a/src/xs_internal.c b/src/xs_internal.c
index 391803e..3995e3e 100644
--- a/src/xs_internal.c
+++ b/src/xs_internal.c
@@ -9,6 +9,8 @@
  */

 #ifdef WITH_XEN
+#include "config.h"
+
 #include <stdio.h>
 #include <string.h>
 #include <unistd.h>
diff --git a/tests/conftest.c b/tests/conftest.c
index 9c8e3a6..abb68fd 100644
--- a/tests/conftest.c
+++ b/tests/conftest.c
@@ -1,3 +1,5 @@
+#include "config.h"
+
 #include <unistd.h>
 #include <stdlib.h>
 #include <stdio.h>
diff --git a/tests/xmlrpctest.c b/tests/xmlrpctest.c
index 64591e3..5fa937f 100644
--- a/tests/xmlrpctest.c
+++ b/tests/xmlrpctest.c
@@ -10,6 +10,8 @@
  * $Id$
  */

+#include "config.h"
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdarg.h>
--
1.5.3.6.950.g92b7b


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