bug-gnulib
[Top][All Lists]
Advanced

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

Re: lib/dirent.in.h fails on AIX


From: Bruno Haible
Subject: Re: lib/dirent.in.h fails on AIX
Date: Thu, 21 May 2009 17:05:29 +0200
User-agent: KMail/1.9.9

Eric Blake wrote:
> I think I see a logic bug in this patch which explains why Jens Rehsack still 
> saw a failure in m4 1.4.13:
> 
> > +++ lib/math.in.h   2008-11-20 23:26:08.000000000 +0100
> > @@ -22,7 +22,7 @@
> >  #endif
> > 
> >  /* The include_next requires a split double-inclusion guard.  */
> > address@hidden@ @NEXT_MATH_H@
> > address@hidden@ @NEXT_MATH_H@
> 
> NEXT_MATH_H is still of the form "///usr/vac/include/math.h" here, but that's 
> exactly what we said was the second of two bugs in xlc's include_next 
> implementation

Bingo! That must be it.

> > +    if test $gl_cv_have_include_next = buggy; then
> > +      INCLUDE_NEXT=include
> > +      INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include_next
> 
> For this compiler (AIX's xlc), we want
> 
> @INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ <math.h>

Now that you say it, it's obvious :-)

> What do you think of this patch?
> ... The solution - add another substituted variable.

Obviously the right direction.

> +     if test $gl_cv_have_include_next == no; then

== is not a known operator for 'test', according to POSIX. I'm adding a
couple of comments, and committing it as below.

> By the way, m4_quote(m4_defn([foo])) is overkill - m4_defn already properly 
> quotes its output as a single m4 argument, so the m4_quote is a no-op 
> (m4_quote 
> is only useful when collecting multiple unquoted m4 arguments into a single 
> string).

m4_quote(m4_defn([foo])) comes from Paul Eggert. I'm a bit leery of removing
a level of m4 quoting, because
  - The generated statements in configure are right.
  - Removing a level of m4 quoting generally means to allow interpretation of
    some tokens as m4 macros. Which is not desirable here.

I also omitted all tab-related changes. Tabs in .m4 files are nothing but an
annoyance. The only tab-related change that would be useful on this file is
to remove all tabs entirely, through "expand -t 8".

Bruno


2009-05-21  Eric Blake  <address@hidden>
            Bruno Haible  <address@hidden>

        Second attempt to work around an AIX 5.3, 6.1 compiler bug with
        include_next. Fix of 2008-11-20 commit.
        * m4/include_next.m4 (gl_CHECK_NEXT_HEADERS): Also set
        NEXT_AS_FIRST_DIRECTIVE_FOO_H.
        * lib/math.in.h: Use NEXT_AS_FIRST_DIRECTIVE_MATH_H instead of
        NEXT_MATH_H.
        * modules/math (Makefile.am): Substitute NEXT_AS_FIRST_DIRECTIVE_MATH_H
        instead of NEXT_MATH_H.

--- m4/include_next.m4.orig     2009-05-21 16:42:08.000000000 +0200
+++ m4/include_next.m4  2009-05-21 16:39:38.000000000 +0200
@@ -1,4 +1,4 @@
-# include_next.m4 serial 12
+# include_next.m4 serial 13
 dnl Copyright (C) 2006-2009 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -104,8 +104,14 @@
 # For each arg foo.h, if #include_next works, define NEXT_FOO_H to be
 # '<foo.h>'; otherwise define it to be
 # '"///usr/include/foo.h"', or whatever other absolute file name is suitable.
+# Also, if #include_next works as first preprocessing directive in a file,
+# define NEXT_AS_FIRST_DIRECTIVE_FOO_H to be '<foo.h>'; otherwise define it to
+# be
+# '"///usr/include/foo.h"', or whatever other absolute file name is suitable.
 # That way, a header file with the following line:
 #      address@hidden@ @NEXT_FOO_H@
+# or
+#      address@hidden@ @NEXT_AS_FIRST_DIRECTIVE_FOO_H@
 # behaves (after sed substitution) as if it contained
 #      #include_next <foo.h>
 # even if the compiler does not support include_next.
@@ -167,5 +173,15 @@
      AC_SUBST(
        AS_TR_CPP([NEXT_]m4_quote(m4_defn([gl_HEADER_NAME]))),
        [AS_VAR_GET([gl_next_header])])
+     if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = 
buggy; then
+       # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next'
+       gl_next_as_first_directive='<'gl_HEADER_NAME'>'
+     else
+       # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include'
+       gl_next_as_first_directive=AS_VAR_GET([gl_next_header])
+     fi
+     AC_SUBST(
+       
AS_TR_CPP([NEXT_AS_FIRST_DIRECTIVE_]m4_quote(m4_defn([gl_HEADER_NAME]))),
+       [$gl_next_as_first_directive])
      AS_VAR_POPDEF([gl_next_header])])
 ])
--- lib/math.in.h.orig  2009-05-21 16:42:08.000000000 +0200
+++ lib/math.in.h       2009-05-21 16:15:46.000000000 +0200
@@ -22,7 +22,7 @@
 #endif
 
 /* The include_next requires a split double-inclusion guard.  */
address@hidden@ @NEXT_MATH_H@
address@hidden@ @NEXT_AS_FIRST_DIRECTIVE_MATH_H@
 
 #ifndef _GL_MATH_H
 #define _GL_MATH_H
--- modules/math.orig   2009-05-21 16:42:08.000000000 +0200
+++ modules/math        2009-05-21 16:16:09.000000000 +0200
@@ -22,7 +22,7 @@
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
          sed -e 
's|@''INCLUDE_NEXT_AS_FIRST_DIRECTIVE''@|$(INCLUDE_NEXT_AS_FIRST_DIRECTIVE)|g' \
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-             -e 's|@''NEXT_MATH_H''@|$(NEXT_MATH_H)|g' \
+             -e 
's|@''NEXT_AS_FIRST_DIRECTIVE_MATH_H''@|$(NEXT_AS_FIRST_DIRECTIVE_MATH_H)|g' \
              -e 's|@''GNULIB_CEILF''@|$(GNULIB_CEILF)|g' \
              -e 's|@''GNULIB_CEILL''@|$(GNULIB_CEILL)|g' \
              -e 's|@''GNULIB_FLOORF''@|$(GNULIB_FLOORF)|g' \




reply via email to

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