]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* NEWS: Document recent changes to AC_CHECK_ALIGNOF, AC_CHECK_SIZEOF,
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 13 Apr 2007 07:52:57 +0000 (07:52 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 13 Apr 2007 07:52:57 +0000 (07:52 +0000)
AC_CHECK_TYPE, AC_CHECK_TYPES.
* doc/autoconf.texi (Generic types): C types must be type-names
(the C terminology), not type-ids (the C++ term).  C++ types
must not be anonymous.
* lib/autoconf/types.m4 (_AC_CHECK_TYPE_NEW): Remove special case
for C++; this drops support for anonymous struct and union types,
which were problematic anyway.
* tests/semantics.at (AC_CHECK_HEADERS_NEW): Adjust test to work even
for C++.

ChangeLog
NEWS
doc/autoconf.texi
lib/autoconf/types.m4
tests/semantics.at

index 0e052f64c7e5e5b99ec12bb426cef4a595b827c1..c40af5520c1824512c694fb0fed5f9b402f50e11 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2007-04-12  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * NEWS: Document recent changes to AC_CHECK_ALIGNOF, AC_CHECK_SIZEOF,
+       AC_CHECK_TYPE, AC_CHECK_TYPES.
+       * doc/autoconf.texi (Generic types): C types must be type-names
+       (the C terminology), not type-ids (the C++ term).  C++ types
+       must not be anonymous.
+       * lib/autoconf/types.m4 (_AC_CHECK_TYPE_NEW): Remove special case
+       for C++; this drops support for anonymous struct and union types,
+       which were problematic anyway.
+       * tests/semantics.at (AC_CHECK_HEADERS_NEW): Adjust test to work even
+       for C++.
+
 2007-04-12  Jim Meyering  <jim@meyering.net>
 
        * doc/autoconf.texi (Libraries): Typo fix: insert missing "in".
diff --git a/NEWS b/NEWS
index b9e6487db95fba47a77e17de846b03d0eca2e387..a07ee210858a4d1da9978aa8d9e1efa92b015a27 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,20 @@
 
 ** AC_C_BIGENDIAN now supports universal binaries a la Mac OS X.
 
+** AC_CHECK_ALIGNOF's type argument T is now documented better: it must
+   be a string of tokens such that "T y;" is a valid member declaration
+   in a struct.
+
+** AC_CHECK_SIZEOF now accepts objects as well as types: the general rule
+   is that sizeof (X) works, then AC_CHECK_SIZEOF (X) should work.
+
+** AC_CHECK_TYPE and AC_CHECK_TYPES now work on any C type-name; formerly,
+   they did not work for function types.  In C++, they now work on any
+   type-id that can be the operand of sizeof; this is similar to C,
+   except it excludes anonymous struct and union types.  Formerly,
+   some (but not all) C++ types involving anonymous struct and union
+   were accepted, though this was not documented.
+
 ** Autoconf now requires GNU M4 1.4.5 or later.  Earlier versions of M4 have
    a bug in macro tracing that interferes with the interaction between
    Autoconf and Automake.  GNU M4 1.4.8 or later is recommended.
index 49e925fc343f4f0d3a42c5d8031ed26bf3466fa4..5b4771e2fc8b15b8cf64dfa0470e76b57440c318 100644 (file)
@@ -6120,13 +6120,11 @@ test macros.
 Check whether @var{type} is defined.  It may be a compiler builtin type
 or defined by the @var{includes} (@pxref{Default Includes}).
 
-In C, @var{type} must be a type-id, so that the expression @samp{sizeof
+In C, @var{type} must be a type-name, so that the expression @samp{sizeof
 (@var{type})} is valid (but @samp{sizeof ((@var{type}))} is not).  The
-rules in C++ are currently more complicated and restrictive: @var{type}
-must be a string of tokens such that @samp{typedef @var{type} foo;} is a
-valid type definition.  However, the C++ approach has problems (for
-example, it mishandles function types) and may change in future versions
-of Autoconf.
+same test is applied when compiling for C++, which means that in C++
+@var{type} should be a type-id and should not be an anonymous
+@samp{struct} or @samp{union}.
 @end defmac
 
 
@@ -6242,7 +6240,7 @@ defines @code{SIZEOF_INT_P} to be 8 on DEC Alpha AXP systems.
 @defmac AC_CHECK_ALIGNOF (@var{type}, @dvar{includes, default-includes})
 @acindex{CHECK_ALIGNOF}
 Define @code{ALIGNOF_@var{type}} (@pxref{Standard Symbols}) to be the
-alignment in bytes of @var{type}.  @samp{@var{type} x;} must be valid as
+alignment in bytes of @var{type}.  @samp{@var{type} y;} must be valid as
 a structure member declaration.  If @samp{type} is unknown, the result
 is 0.  If no @var{includes} are specified, the default includes are used
 (@pxref{Default Includes}).
index 2fc95ed14b95b6eb9a73cb1f6aa717d0f9abf5f7..eb3c8ef8ff85b673e48447fb1481f29c190e0e66 100644 (file)
 #        if (sizeof (TYPE))
 #
 # to `read' sizeof (to avoid warnings), while not depending on its type
-# (not necessarily size_t etc.).  Equally, instead of defining an unused
-# variable, we just use a cast to avoid warnings from the compiler.
-#
-# Now, the next issue is that C++ disallows defining types inside casts
-# and inside `sizeof()', but we would like to allow unnamed structs, for
-# use inside AC_CHECK_SIZEOF, for example.  So for C++ we create a typedef
-# of the new type.  Note that this breaks for some types, e.g., function
-# types, but we don't know C++ well enough to fix this.
+# (not necessarily size_t etc.).
+#
+# C++ disallows defining types inside `sizeof ()', but that's OK,
+# since we don't want to consider unnamed structs to be types for C++,
+# precisely because they don't work in cases like that.
 m4_define([_AC_CHECK_TYPE_NEW],
 [AS_VAR_PUSHDEF([ac_Type], [ac_cv_type_$1])dnl
 AC_CACHE_CHECK([for $1], [ac_Type],
 [AS_VAR_SET([ac_Type], [no])
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT([$4])
-#ifdef __cplusplus
-typedef $1 ac__type_new_;
-#endif
-],
-[#ifdef __cplusplus
-if ((ac__type_new_ *) 0)
-  return 0;
-if (sizeof (ac__type_new_))
-  return 0;
-#else
-if (sizeof ($1))
-  return 0;
-#endif
-])],
+AC_COMPILE_IFELSE(
+  [AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT([$4])],
+     [if (sizeof ($1))
+       return 0;])],
   [AC_COMPILE_IFELSE(
      [AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT([$4])],
        [if (sizeof (($1)))
index 0a7afdd9783969d2b22d82adea812a8e7e4d9a46..2fa7cde4f10799267b3d8007c4f9147ca8cc0fda 100644 (file)
@@ -302,13 +302,13 @@ AC_CHECK_SIZEOF(charcharchar)
 # ----------------------
 AT_CHECK_MACRO_CROSS([AC_CHECK_SIZEOF struct],
 [[AC_C_CONST
-AC_CHECK_SIZEOF([struct { char c; int x; }])
-AC_CHECK_SIZEOF([const struct { const char *p; int x; }])
+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])
 ]],
-[AT_CHECK([[grep "#define SIZEOF_STRUCT___CHAR_C__INT_X___ [^0]" config.h]],
+[AT_CHECK([[grep "#define SIZEOF_STRUCT_X [^0]" config.h]],
         0, ignore)
-AT_CHECK([[grep "#define SIZEOF_CONST_STRUCT___CONST_CHAR_PP__INT_X___ [^0]" config.h]],
+AT_CHECK([[grep "#define SIZEOF_CONST_STRUCT_X [^0]" config.h]],
         0, ignore)
 AT_CHECK([[grep "#define SIZEOF_STRUCT_NOSUCHSTRUCT 0" config.h]],
         0, ignore)