Commit 89c1ffd6 authored by Cheng Shao's avatar Cheng Shao Committed by Marge Bot
Browse files

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.
parent d13b9f20
......@@ -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])
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment