intptr fallout
authorDerrick Brashear <shadow@dementia.org>
Tue, 29 Sep 2009 14:26:23 +0000 (10:26 -0400)
committerDerrick Brashear <shadow|account-1000005@unknown>
Tue, 29 Sep 2009 19:10:08 +0000 (12:10 -0700)
some kernels don't have e.g. uintptr_t; revert this hunk for now.
also, autoconf as recent as what's in rhel5 has no macros. provide
some.

Reviewed-on: http://gerrit.openafs.org/553
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

acinclude.m4
src/afs/afs_lock.c
src/cf/intptr.m4 [new file with mode: 0644]

index 973826e..6d60abc 100644 (file)
@@ -1606,6 +1606,7 @@ fi
 
 AC_TYPE_SOCKLEN_T
 AC_TYPE_SIGNAL
+AC_CHECK_SIZEOF(void *)
 AC_TYPE_INTPTR_T
 AC_TYPE_UINTPTR_T
 AC_CHECK_TYPE(ssize_t, int)
index 65d738e..a29357f 100644 (file)
@@ -279,7 +279,7 @@ afs_BozonLock(struct afs_bozoLock *alock, struct vcache *avc)
            /* To shut up SGI compiler on remark(1413) warnings. */
            alock->proc = (char *)(long)MyPidxx;
 #else /* AFS_64BITPOINTER_ENV */
-           alock->proc = (char *)(intptr_t)MyPidxx;
+           alock->proc = (char *)MyPidxx;
 #endif /* AFS_64BITPOINTER_ENV */
 #endif
            alock->count = 1;
@@ -291,7 +291,7 @@ afs_BozonLock(struct afs_bozoLock *alock, struct vcache *avc)
            /* To shut up SGI compiler on remark(1413) warnings. */
        } else if (alock->proc == (char *)(long)MyPidxx) {
 #else /* AFS_64BITPOINTER_ENV */
-       } else if (alock->proc == (char *)(intptr_t)MyPidxx) {
+       } else if (alock->proc == (char *)MyPidxx) {
 #endif /* AFS_64BITPOINTER_ENV */
 #endif
            /* lock is held, but by us, so we win anyway */
@@ -350,7 +350,7 @@ afs_CheckBozonLockBlocking(struct afs_bozoLock *alock)
        /* To shut up SGI compiler on remark(1413) warnings. */
        if (alock->proc != (char *)(long)MyPidxx)
 #else /* AFS_64BITPOINTER_ENV */
-       if (alock->proc != (char *)(intptr_t)MyPidxx)
+       if (alock->proc != (char *)MyPidxx)
 #endif /* AFS_64BITPOINTER_ENV */
 #endif
            return 1;
diff --git a/src/cf/intptr.m4 b/src/cf/intptr.m4
new file mode 100644 (file)
index 0000000..d4e0707
--- /dev/null
@@ -0,0 +1,45 @@
+AC_DEFUN([AC_TYPE_INTPTR_T],
+[
+  AC_CHECK_TYPE([intptr_t],
+    [AC_DEFINE([HAVE_INTPTR_T], 1,
+       [Define to 1 if the system has the type `intptr_t'.])],
+    [
+       if test "$ac_cv_type_intptr_t" != yes; then
+         AC_MSG_CHECKING(for type equivalent to intptr_t)
+         case $ac_cv_sizeof_void_p in
+           2) openafs_cv_type_intptr_t=afs_int16 ;;
+           4) openafs_cv_type_intptr_t=afs_int32 ;;
+           8) openafs_cv_type_intptr_t=afs_int64 ;;
+           *) AC_MSG_ERROR(no equivalent for intptr_t);;
+         esac
+         AC_DEFINE_UNQUOTED([intptr_t], [$openafs_cv_type_intptr_t],
+         [Define to the type of a signed integer type wide enough to
+             hold a pointer, if such a type exists, and if the system
+             does not define it.])
+         AC_MSG_RESULT($openafs_cv_type_intptr_t)
+       fi
+     ])
+])
+
+AC_DEFUN([AC_TYPE_UINTPTR_T],
+[
+  AC_CHECK_TYPE([uintptr_t],
+    [AC_DEFINE([HAVE_UINTPTR_T], 1,
+       [Define to 1 if the system has the type `uintptr_t'.])],
+    [
+       if test "$ac_cv_type_uintptr_t" != yes; then
+         AC_MSG_CHECKING(for type equivalent to uintptr_t)
+         case $ac_cv_sizeof_void_p in 
+           2) openafs_cv_type_uintptr_t=afs_uint16 ;;
+           4) openafs_cv_type_uintptr_t=afs_uint32 ;;
+           8) openafs_cv_type_uintptr_t=afs_uint64 ;;
+           *) AC_MSG_ERROR(no equivalent for uintptr_t);;
+         esac
+         AC_DEFINE_UNQUOTED([uintptr_t], [$openafs_cv_type_uintptr_t],
+         [Define to the type of a signed integer type wide enough to
+             hold a pointer, if such a type exists, and if the system
+             does not define it.])
+         AC_MSG_RESULT($openafs_cv_type_uintptr_t)
+       fi
+  ])
+])