autoconf-patches
[Top][All Lists]
Advanced

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

Re: AC_CHECK_SIZEOF([int *]) is error in autoconf-2.66


From: Ralf Wildenhues
Subject: Re: AC_CHECK_SIZEOF([int *]) is error in autoconf-2.66
Date: Sat, 10 Jul 2010 08:18:31 +0200
User-agent: Mutt/1.5.20 (2010-04-22)

* Ralf Wildenhues wrote on Thu, Jul 08, 2010 at 06:38:50AM CEST:
> * Eric Blake wrote on Wed, Jul 07, 2010 at 07:17:30AM CEST:
> > ----- "Ralf Wildenhues" wrote:
> > > Patch here.  Eric, I'm not quite sure why you added the + to the
> > > _AS_TR_SH case.  Can you explain, so I can add testsuite coverage?

> > The AS_TR_SH change was for the separate feature change in 2.66 of allowing
> > AS_ARG_WITH to allow + signs: the shell variable $as_with_c__ should
> > be allowed when you use ./configure --enable-c++ (typing from memory
> > here, so I may have some details off).  To date, we use AS_TR_SH in
> > more places than AS_TR_CPP (namely, in the creation of shell variables
> > to track configure options), explaining the asymmetry between the
> > characters accepted by the two.
> 
> Hmm, but at least the "AC_ARG_ENABLE and AC_ARG_WITH" test doesn't
> produce autoconf warnings for me when I remove the + from the patch,
> and the whole testsuite doesn't show any failures either.
[...]
> In light of this, should the `+' still be kept in _AS_TR_SH?

I've pushed the patch now but dropped the addition of `+' from _AS_TR_SH
on the grounds that we should only add what we expose in the testsuite.
Hope you don't mind.

Cheers,
Ralf

2010-07-10  Eric Blake  <address@hidden>
        and Ralf Wildenhues  <address@hidden>

        Fix regression of AC_CHECK_SIZEOF on pointer types.
        * lib/autoconf/types.m4 (AC_CHECK_SIZEOF): Translate `*' to `p'
        when checking literal-ness of the type, for pointer types.
        * lib/m4sugar/m4sh.m4 (_AS_TR_SH): Also consider `*' as literal.
        (_AS_TR_CPP): Likewise.
        * tests/semantics.at (AC_CHECK_ALIGNOF struct): When checking
        for numeric answer, be sure to not allow variable references.
        (AC_CHECK_SIZEOF struct): Likewise.  Also, test the
        `AC_CHECK_SIZEOF([int *])' example from the manual.
        * doc/autoconf.texi (Generic Compiler Characteristics): Add
        example marker.
        * NEWS: Update.
        Reports by Nishio Futoshi and Roberto Bagnara.

diff --git a/NEWS b/NEWS
index 5053557..6256d40 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,9 @@ GNU Autoconf NEWS - User visible changes.
 ** AC_CONFIG_SUBDIRS with more than one subdirectory at a time works again.
    Regression introduced in 2.66.
 
+** AC_CHECK_SIZEOF of a pointer type works again.  Regression introduced in
+   2.66.
+
 * Major changes in Autoconf 2.66 (2010-07-02) [stable]
   Released by Eric Blake, based on git versions 2.65.*.
 
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index 39c2ba6..76b01c9 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -6957,6 +6957,7 @@ Generic Compiler Characteristics
 For example, the call
 
 @example
address@hidden If you change this example, adjust 
tests/semantics.at:AC_F77_DUMMY_MAIN usage.
 AC_CHECK_SIZEOF([int *])
 @end example
 
diff --git a/lib/autoconf/types.m4 b/lib/autoconf/types.m4
index ee07148..9f482da 100644
--- a/lib/autoconf/types.m4
+++ b/lib/autoconf/types.m4
@@ -763,7 +763,7 @@ Remove this warning and the `AC_CACHE_CHECK' when you 
adjust the code.])
 # AC_CHECK_SIZEOF(TYPE, [IGNORED], [INCLUDES = DEFAULT-INCLUDES])
 # ---------------------------------------------------------------
 AC_DEFUN([AC_CHECK_SIZEOF],
-[AS_LITERAL_IF([$1], [],
+[AS_LITERAL_IF(m4_translit([[$1]], [*], [p]), [],
               [m4_fatal([$0: requires literal arguments])])]dnl
 [# The cast to long int works around a bug in the HP C Compiler
 # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
diff --git a/lib/m4sugar/m4sh.m4 b/lib/m4sugar/m4sh.m4
index e1d03d9..6fbc9e1 100644
--- a/lib/m4sugar/m4sh.m4
+++ b/lib/m4sugar/m4sh.m4
@@ -1779,7 +1779,7 @@ m4_defun_init([AS_TR_SH],
 [_$0(m4_expand([$1]))])
 
 m4_define([_AS_TR_SH],
-[_AS_LITERAL_IF([$1], [         ][
+[_AS_LITERAL_IF([$1], [*][      ][
 ])([], [$0_INDIR], [$0_LITERAL])([$1])])
 
 m4_define([_AS_TR_SH_LITERAL],
@@ -1812,7 +1812,7 @@ m4_defun_init([AS_TR_CPP],
 [_$0(m4_expand([$1]))])
 
 m4_define([_AS_TR_CPP],
-[_AS_LITERAL_IF([$1], [         ][
+[_AS_LITERAL_IF([$1], [*][      ][
 ])([], [$0_INDIR], [$0_LITERAL])([$1])])
 
 m4_define([_AS_TR_CPP_LITERAL],
diff --git a/tests/semantics.at b/tests/semantics.at
index b703fd4..48136cd 100644
--- a/tests/semantics.at
+++ b/tests/semantics.at
@@ -350,7 +350,7 @@ AT_CHECK_MACRO_CROSS([AC_CHECK_ALIGNOF struct],
 [[AC_CHECK_ALIGNOF([struct { char c; }])
 AC_CHECK_ALIGNOF([struct nosuchstruct])
 ]],
-[AT_CHECK([[grep "#define ALIGNOF_STRUCT___CHAR_C___ [^0]" config.h]],
+[AT_CHECK([[grep "#define ALIGNOF_STRUCT___CHAR_C___ [1-9]" config.h]],
         0, ignore)
 AT_CHECK([[grep "#define ALIGNOF_STRUCT_NOSUCHSTRUCT 0" config.h]],
         0, ignore)
@@ -379,13 +379,17 @@ AT_CHECK_MACRO_CROSS([AC_CHECK_SIZEOF struct],
 AC_CHECK_SIZEOF([struct x], [], [struct x { char c; int x; };])
 AC_CHECK_SIZEOF([const struct x], [], [struct x { const char *p; int x; };])
 AC_CHECK_SIZEOF([struct nosuchstruct])
+# Taken from autoconf.texi:Generic Compiler Characteristics.
+AC_CHECK_SIZEOF([int *])
 ]],
-[AT_CHECK([[grep "#define SIZEOF_STRUCT_X [^0]" config.h]],
+[AT_CHECK([[grep "#define SIZEOF_STRUCT_X [1-9]" config.h]],
         0, ignore)
-AT_CHECK([[grep "#define SIZEOF_CONST_STRUCT_X [^0]" config.h]],
+AT_CHECK([[grep "#define SIZEOF_CONST_STRUCT_X [1-9]" config.h]],
         0, ignore)
 AT_CHECK([[grep "#define SIZEOF_STRUCT_NOSUCHSTRUCT 0" config.h]],
         0, ignore)
+AT_CHECK([[grep "#define SIZEOF_INT_P [1-9]" config.h]],
+        0, ignore)
 ])
 
 



reply via email to

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