summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2019-01-18 10:31:52 -0800
committerKaz Kylheku <kaz@kylheku.com>2019-01-18 10:31:52 -0800
commitd02b3c87d235beae67332e81d99e3069bc518e80 (patch)
treedd850673d313387f97d34f42dc07664bb9375e86
parent04ef5fd846cc43c3b97e5dee9ab102e2e2740608 (diff)
downloadtxr-d02b3c87d235beae67332e81d99e3069bc518e80.tar.gz
txr-d02b3c87d235beae67332e81d99e3069bc518e80.tar.bz2
txr-d02b3c87d235beae67332e81d99e3069bc518e80.zip
configure: improvements related to int_ptr_t.
* configure: We remove the uintptr variable and do not generate the HAVE_UINTPTR_T constant in config.h. This is always 1, and not actually tested anywhere. In situations when uintptr is not established, intptr is also not established and the configure script fails. We simply assume that for whatever type we detect as inptr_t, we can derive the unsigned type. (INT_PTR_MAX): We define this a bit differently; instead of interpolating into the expression the underlying C type, we use the int_ptr_t typedef that the previous lines of config.h establish. (UINT_PTR_MAX): New constant introduced in config.h.
-rwxr-xr-xconfigure12
1 files changed, 3 insertions, 9 deletions
diff --git a/configure b/configure
index 9a56950c..328d6de3 100755
--- a/configure
+++ b/configure
@@ -1221,16 +1221,12 @@ char DUMMY;
if [ $SIZEOF_PTR -eq $SIZEOF_SHORT ] ; then
intptr="short"
- uintptr=y
elif [ $SIZEOF_PTR -eq $SIZEOF_INT ] ; then
intptr="int"
- uintptr=y
elif [ $SIZEOF_PTR -eq $SIZEOF_LONG ] ; then
intptr="long"
- uintptr=y
elif [ $SIZEOF_PTR -eq $SIZEOF_LONGLONG_T ] ; then
intptr="longlong_t"
- uintptr=$ulonglong
fi
if [ -z "$intptr" ] ; then
@@ -1241,13 +1237,11 @@ fi
printf '"%s"\n' "$intptr"
printf "typedef $intptr int_ptr_t;\n" >> config.h
-if [ -n "$uintptr" ] ; then
- printf "#define HAVE_UINTPTR_T 1\n" >> config.h
- printf "typedef unsigned $intptr uint_ptr_t;\n" >> config.h
-fi
-intptr_max_expr="((((convert($intptr, 1) << $((SIZEOF_PTR * 8 - 2))) - 1) << 1) + 1)"
+printf "typedef unsigned $intptr uint_ptr_t;\n" >> config.h
+intptr_max_expr="((((convert(int_ptr_t, 1) << $((SIZEOF_PTR * 8 - 2))) - 1) << 1) + 1)"
printf "#define INT_PTR_MAX %s\n" "$intptr_max_expr" >> config.h
printf "#define INT_PTR_MIN (-INT_PTR_MAX)\n" >> config.h
+printf "#define UINT_PTR_MAX (convert(uint_ptr_t, -1))\n" >> config.h
if [ -n "$longlong" ] && [ $SIZEOF_LONGLONG_T -eq $(( 2 * SIZEOF_PTR )) ]
then