diff options
author | Cheng Shao <cheng.shao@tweag.io> | 2021-11-03 13:50:02 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-12-15 16:33:54 -0500 |
commit | 89c1ffd6bcc6527d587d1188a43dda08d373bdb3 (patch) | |
tree | b8a1e7857c50b7023487bc4e5bdc45a79900c98b | |
parent | d13b9f20d1dc3613cf850eeb9b5627a0cdec5c4e (diff) | |
download | haskell-89c1ffd6bcc6527d587d1188a43dda08d373bdb3.tar.gz |
base: fix autoconf detection of C pointer types
We used to attempt compiling `foo_t val; *val;` to determine if `foo_t`
is a pointer type in C. This doesn't work if `foo_t` points to an
incomplete type, and autoconf will detect `foo_t` as a floating point
type in that case. Now we use `memset(val, 0, 0)` instead, and it works
for incomplete types as well.
-rw-r--r-- | libraries/base/aclocal.m4 | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libraries/base/aclocal.m4 b/libraries/base/aclocal.m4 index 190e2b496f..3a028dda16 100644 --- a/libraries/base/aclocal.m4 +++ b/libraries/base/aclocal.m4 @@ -141,13 +141,13 @@ AC_DEFUN([FPTOOLS_CHECK_HTYPE_ELSE],[ if test "$HTYPE_IS_INTEGRAL" -eq 0 then dnl If the C type isn't an integer, we check if it's a pointer type - dnl by trying to dereference one of its values. If that fails to + dnl by trying to call memset() on it. If that fails to dnl compile, it's not a pointer, so we check to see if it's a dnl floating-point type. AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [FPTOOLS_HTYPE_INCLUDES], - [$1 val; *val;] + [$1 val; memset(val, 0, 0);] )], [HTYPE_IS_POINTER=yes], [HTYPE_IS_POINTER=no]) |