summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorJeremy Huddleston Sequoia <jeremyhu@apple.com>2012-08-28 10:06:51 -0700
committerJeremy Huddleston Sequoia <jeremyhu@apple.com>2012-08-29 16:09:20 -0700
commitb8ab93dfbc7f292b5bfe7e9113e1af824ccbd1a8 (patch)
treee4389108bb7feaf14c39b98b17aeac80b769ba85 /configure.ac
parentc75c947b6e9bc725821b28835f3667c4aabef9ee (diff)
list: Use offsetof() and typeof() to determine member offsets within a structure
Some compilers have difficulty with the previous implementation which relies on undefined behavior according to the C standard. Using offsetof() from <stddef.h> (which most likely just uses __builtin_offsetof on modern compilers) allows us to accomplish this without ambiguity. This fix also requires support for typeof(). If your compiler does not support typeof(), then the old implementation will be used. If you see failures in test/list, please try a more modern compiler. v2: Added fallback if typeof() is not present. Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac1
1 files changed, 1 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index abfe72766..ab890273f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -137,6 +137,7 @@ AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h dlfcn.h stropts.h fnmatch.h
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
+AC_C_TYPEOF
AC_C_BIGENDIAN([ENDIAN="X_BIG_ENDIAN"], [ENDIAN="X_LITTLE_ENDIAN"])
AC_CHECK_SIZEOF([unsigned long])