summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane2009-12-31 19:41:37 +0000
committerTom Lane2009-12-31 19:41:37 +0000
commit85d02a6586012edc385a420ebaca1c8ce4e93390 (patch)
tree4331782a9095429f06b9da7b200538d596d08380
parent8abb0110479382b1873715052933f600d682654c (diff)
Redefine Datum as uintptr_t, instead of unsigned long.
This is more in keeping with modern practice, and is a first step towards porting to Win64 (which has sizeof(pointer) > sizeof(long)). Tsutomu Yamada, Magnus Hagander, Tom Lane
-rwxr-xr-xconfigure477
-rw-r--r--configure.in12
-rw-r--r--src/backend/access/common/heaptuple.c8
-rw-r--r--src/backend/access/hash/hashfunc.c4
-rw-r--r--src/backend/port/hpux/tas.c.template2
-rw-r--r--src/backend/storage/lmgr/lwlock.c4
-rw-r--r--src/backend/utils/misc/guc.c5
-rw-r--r--src/include/access/tupmacs.h14
-rw-r--r--src/include/c.h13
-rw-r--r--src/include/pg_config.h.in20
-rw-r--r--src/include/pg_config.h.win3211
-rw-r--r--src/include/postgres.h16
-rw-r--r--src/include/storage/s_lock.h4
-rw-r--r--src/interfaces/ecpg/ecpglib/data.c12
-rw-r--r--src/pl/plperl/plperl.c6
-rw-r--r--src/pl/tcl/pltcl.c4
16 files changed, 470 insertions, 142 deletions
diff --git a/configure b/configure
index be5128194f..d4644d92ad 100755
--- a/configure
+++ b/configure
@@ -16026,6 +16026,321 @@ _ACEOF
fi
+ { $as_echo "$as_me:$LINENO: checking for intptr_t" >&5
+$as_echo_n "checking for intptr_t... " >&6; }
+if test "${ac_cv_type_intptr_t+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_type_intptr_t=no
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if (sizeof (intptr_t))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if (sizeof ((intptr_t)))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ :
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_type_intptr_t=yes
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_intptr_t" >&5
+$as_echo "$ac_cv_type_intptr_t" >&6; }
+if test "x$ac_cv_type_intptr_t" = x""yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_INTPTR_T 1
+_ACEOF
+
+else
+ for ac_type in 'int' 'long int' 'long long int'; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(sizeof (void *) <= sizeof ($ac_type))];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+
+cat >>confdefs.h <<_ACEOF
+#define intptr_t $ac_type
+_ACEOF
+
+ ac_type=
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ test -z "$ac_type" && break
+ done
+fi
+
+
+
+ { $as_echo "$as_me:$LINENO: checking for uintptr_t" >&5
+$as_echo_n "checking for uintptr_t... " >&6; }
+if test "${ac_cv_type_uintptr_t+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_type_uintptr_t=no
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if (sizeof (uintptr_t))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if (sizeof ((uintptr_t)))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ :
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_type_uintptr_t=yes
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_uintptr_t" >&5
+$as_echo "$ac_cv_type_uintptr_t" >&6; }
+if test "x$ac_cv_type_uintptr_t" = x""yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_UINTPTR_T 1
+_ACEOF
+
+else
+ for ac_type in 'unsigned int' 'unsigned long int' \
+ 'unsigned long long int'; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(sizeof (void *) <= sizeof ($ac_type))];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+
+cat >>confdefs.h <<_ACEOF
+#define uintptr_t $ac_type
+_ACEOF
+
+ ac_type=
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ test -z "$ac_type" && break
+ done
+fi
+
+
+
{ $as_echo "$as_me:$LINENO: checking for struct cmsgcred" >&5
$as_echo_n "checking for struct cmsgcred... " >&6; }
if test "${ac_cv_type_struct_cmsgcred+set}" = set; then
@@ -22539,14 +22854,14 @@ esac
fi
-# Need a #define for the size of Datum (unsigned long)
+# Check size of void *, size_t (enables tweaks for > 32bit address space)
# The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:$LINENO: checking size of unsigned long" >&5
-$as_echo_n "checking size of unsigned long... " >&6; }
-if test "${ac_cv_sizeof_unsigned_long+set}" = set; then
+{ $as_echo "$as_me:$LINENO: checking size of void *" >&5
+$as_echo_n "checking size of void *... " >&6; }
+if test "${ac_cv_sizeof_void_p+set}" = set; then
$as_echo_n "(cached) " >&6
else
if test "$cross_compiling" = yes; then
@@ -22561,7 +22876,7 @@ $ac_includes_default
int
main ()
{
-static int test_array [1 - 2 * !(((long int) (sizeof (unsigned long))) >= 0)];
+static int test_array [1 - 2 * !(((long int) (sizeof (void *))) >= 0)];
test_array [0] = 0
;
@@ -22598,7 +22913,7 @@ $ac_includes_default
int
main ()
{
-static int test_array [1 - 2 * !(((long int) (sizeof (unsigned long))) <= $ac_mid)];
+static int test_array [1 - 2 * !(((long int) (sizeof (void *))) <= $ac_mid)];
test_array [0] = 0
;
@@ -22652,7 +22967,7 @@ $ac_includes_default
int
main ()
{
-static int test_array [1 - 2 * !(((long int) (sizeof (unsigned long))) < 0)];
+static int test_array [1 - 2 * !(((long int) (sizeof (void *))) < 0)];
test_array [0] = 0
;
@@ -22689,7 +23004,7 @@ $ac_includes_default
int
main ()
{
-static int test_array [1 - 2 * !(((long int) (sizeof (unsigned long))) >= $ac_mid)];
+static int test_array [1 - 2 * !(((long int) (sizeof (void *))) >= $ac_mid)];
test_array [0] = 0
;
@@ -22753,7 +23068,7 @@ $ac_includes_default
int
main ()
{
-static int test_array [1 - 2 * !(((long int) (sizeof (unsigned long))) <= $ac_mid)];
+static int test_array [1 - 2 * !(((long int) (sizeof (void *))) <= $ac_mid)];
test_array [0] = 0
;
@@ -22789,17 +23104,17 @@ fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
done
case $ac_lo in
-?*) ac_cv_sizeof_unsigned_long=$ac_lo;;
-'') if test "$ac_cv_type_unsigned_long" = yes; then
+?*) ac_cv_sizeof_void_p=$ac_lo;;
+'') if test "$ac_cv_type_void_p" = yes; then
{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned long)
+{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (void *)
See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (unsigned long)
+$as_echo "$as_me: error: cannot compute sizeof (void *)
See \`config.log' for more details." >&2;}
{ (exit 77); exit 77; }; }; }
else
- ac_cv_sizeof_unsigned_long=0
+ ac_cv_sizeof_void_p=0
fi ;;
esac
else
@@ -22810,8 +23125,8 @@ cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
-static long int longval () { return (long int) (sizeof (unsigned long)); }
-static unsigned long int ulongval () { return (long int) (sizeof (unsigned long)); }
+static long int longval () { return (long int) (sizeof (void *)); }
+static unsigned long int ulongval () { return (long int) (sizeof (void *)); }
#include <stdio.h>
#include <stdlib.h>
int
@@ -22821,17 +23136,17 @@ main ()
FILE *f = fopen ("conftest.val", "w");
if (! f)
return 1;
- if (((long int) (sizeof (unsigned long))) < 0)
+ if (((long int) (sizeof (void *))) < 0)
{
long int i = longval ();
- if (i != ((long int) (sizeof (unsigned long))))
+ if (i != ((long int) (sizeof (void *))))
return 1;
fprintf (f, "%ld", i);
}
else
{
unsigned long int i = ulongval ();
- if (i != ((long int) (sizeof (unsigned long))))
+ if (i != ((long int) (sizeof (void *))))
return 1;
fprintf (f, "%lu", i);
}
@@ -22865,23 +23180,23 @@ $as_echo "$ac_try_echo") >&5
ac_status=$?
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
- ac_cv_sizeof_unsigned_long=`cat conftest.val`
+ ac_cv_sizeof_void_p=`cat conftest.val`
else
$as_echo "$as_me: program exited with status $ac_status" >&5
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
( exit $ac_status )
-if test "$ac_cv_type_unsigned_long" = yes; then
+if test "$ac_cv_type_void_p" = yes; then
{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned long)
+{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (void *)
See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (unsigned long)
+$as_echo "$as_me: error: cannot compute sizeof (void *)
See \`config.log' for more details." >&2;}
{ (exit 77); exit 77; }; }; }
else
- ac_cv_sizeof_unsigned_long=0
+ ac_cv_sizeof_void_p=0
fi
fi
rm -rf conftest.dSYM
@@ -22889,25 +23204,23 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$a
fi
rm -f conftest.val
fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_unsigned_long" >&5
-$as_echo "$ac_cv_sizeof_unsigned_long" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_void_p" >&5
+$as_echo "$ac_cv_sizeof_void_p" >&6; }
cat >>confdefs.h <<_ACEOF
-#define SIZEOF_UNSIGNED_LONG $ac_cv_sizeof_unsigned_long
+#define SIZEOF_VOID_P $ac_cv_sizeof_void_p
_ACEOF
-
-# And check size of void *, size_t (enables tweaks for > 32bit address space)
# The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:$LINENO: checking size of void *" >&5
-$as_echo_n "checking size of void *... " >&6; }
-if test "${ac_cv_sizeof_void_p+set}" = set; then
+{ $as_echo "$as_me:$LINENO: checking size of size_t" >&5
+$as_echo_n "checking size of size_t... " >&6; }
+if test "${ac_cv_sizeof_size_t+set}" = set; then
$as_echo_n "(cached) " >&6
else
if test "$cross_compiling" = yes; then
@@ -22922,7 +23235,7 @@ $ac_includes_default
int
main ()
{
-static int test_array [1 - 2 * !(((long int) (sizeof (void *))) >= 0)];
+static int test_array [1 - 2 * !(((long int) (sizeof (size_t))) >= 0)];
test_array [0] = 0
;
@@ -22959,7 +23272,7 @@ $ac_includes_default
int
main ()
{
-static int test_array [1 - 2 * !(((long int) (sizeof (void *))) <= $ac_mid)];
+static int test_array [1 - 2 * !(((long int) (sizeof (size_t))) <= $ac_mid)];
test_array [0] = 0
;
@@ -23013,7 +23326,7 @@ $ac_includes_default
int
main ()
{
-static int test_array [1 - 2 * !(((long int) (sizeof (void *))) < 0)];
+static int test_array [1 - 2 * !(((long int) (sizeof (size_t))) < 0)];
test_array [0] = 0
;
@@ -23050,7 +23363,7 @@ $ac_includes_default
int
main ()
{
-static int test_array [1 - 2 * !(((long int) (sizeof (void *))) >= $ac_mid)];
+static int test_array [1 - 2 * !(((long int) (sizeof (size_t))) >= $ac_mid)];
test_array [0] = 0
;
@@ -23114,7 +23427,7 @@ $ac_includes_default
int
main ()
{
-static int test_array [1 - 2 * !(((long int) (sizeof (void *))) <= $ac_mid)];
+static int test_array [1 - 2 * !(((long int) (sizeof (size_t))) <= $ac_mid)];
test_array [0] = 0
;
@@ -23150,17 +23463,17 @@ fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
done
case $ac_lo in
-?*) ac_cv_sizeof_void_p=$ac_lo;;
-'') if test "$ac_cv_type_void_p" = yes; then
+?*) ac_cv_sizeof_size_t=$ac_lo;;
+'') if test "$ac_cv_type_size_t" = yes; then
{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (void *)
+{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (size_t)
See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (void *)
+$as_echo "$as_me: error: cannot compute sizeof (size_t)
See \`config.log' for more details." >&2;}
{ (exit 77); exit 77; }; }; }
else
- ac_cv_sizeof_void_p=0
+ ac_cv_sizeof_size_t=0
fi ;;
esac
else
@@ -23171,8 +23484,8 @@ cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
-static long int longval () { return (long int) (sizeof (void *)); }
-static unsigned long int ulongval () { return (long int) (sizeof (void *)); }
+static long int longval () { return (long int) (sizeof (size_t)); }
+static unsigned long int ulongval () { return (long int) (sizeof (size_t)); }
#include <stdio.h>
#include <stdlib.h>
int
@@ -23182,17 +23495,17 @@ main ()
FILE *f = fopen ("conftest.val", "w");
if (! f)
return 1;
- if (((long int) (sizeof (void *))) < 0)
+ if (((long int) (sizeof (size_t))) < 0)
{
long int i = longval ();
- if (i != ((long int) (sizeof (void *))))
+ if (i != ((long int) (sizeof (size_t))))
return 1;
fprintf (f, "%ld", i);
}
else
{
unsigned long int i = ulongval ();
- if (i != ((long int) (sizeof (void *))))
+ if (i != ((long int) (sizeof (size_t))))
return 1;
fprintf (f, "%lu", i);
}
@@ -23226,23 +23539,23 @@ $as_echo "$ac_try_echo") >&5
ac_status=$?
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
- ac_cv_sizeof_void_p=`cat conftest.val`
+ ac_cv_sizeof_size_t=`cat conftest.val`
else
$as_echo "$as_me: program exited with status $ac_status" >&5
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
( exit $ac_status )
-if test "$ac_cv_type_void_p" = yes; then
+if test "$ac_cv_type_size_t" = yes; then
{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (void *)
+{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (size_t)
See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (void *)
+$as_echo "$as_me: error: cannot compute sizeof (size_t)
See \`config.log' for more details." >&2;}
{ (exit 77); exit 77; }; }; }
else
- ac_cv_sizeof_void_p=0
+ ac_cv_sizeof_size_t=0
fi
fi
rm -rf conftest.dSYM
@@ -23250,13 +23563,13 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$a
fi
rm -f conftest.val
fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_void_p" >&5
-$as_echo "$ac_cv_sizeof_void_p" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_size_t" >&5
+$as_echo "$ac_cv_sizeof_size_t" >&6; }
cat >>confdefs.h <<_ACEOF
-#define SIZEOF_VOID_P $ac_cv_sizeof_void_p
+#define SIZEOF_SIZE_T $ac_cv_sizeof_size_t
_ACEOF
@@ -23264,9 +23577,9 @@ _ACEOF
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:$LINENO: checking size of size_t" >&5
-$as_echo_n "checking size of size_t... " >&6; }
-if test "${ac_cv_sizeof_size_t+set}" = set; then
+{ $as_echo "$as_me:$LINENO: checking size of long" >&5
+$as_echo_n "checking size of long... " >&6; }
+if test "${ac_cv_sizeof_long+set}" = set; then
$as_echo_n "(cached) " >&6
else
if test "$cross_compiling" = yes; then
@@ -23281,7 +23594,7 @@ $ac_includes_default
int
main ()
{
-static int test_array [1 - 2 * !(((long int) (sizeof (size_t))) >= 0)];
+static int test_array [1 - 2 * !(((long int) (sizeof (long))) >= 0)];
test_array [0] = 0
;
@@ -23318,7 +23631,7 @@ $ac_includes_default
int
main ()
{
-static int test_array [1 - 2 * !(((long int) (sizeof (size_t))) <= $ac_mid)];
+static int test_array [1 - 2 * !(((long int) (sizeof (long))) <= $ac_mid)];
test_array [0] = 0
;
@@ -23372,7 +23685,7 @@ $ac_includes_default
int
main ()
{
-static int test_array [1 - 2 * !(((long int) (sizeof (size_t))) < 0)];
+static int test_array [1 - 2 * !(((long int) (sizeof (long))) < 0)];
test_array [0] = 0
;
@@ -23409,7 +23722,7 @@ $ac_includes_default
int
main ()
{
-static int test_array [1 - 2 * !(((long int) (sizeof (size_t))) >= $ac_mid)];
+static int test_array [1 - 2 * !(((long int) (sizeof (long))) >= $ac_mid)];
test_array [0] = 0
;
@@ -23473,7 +23786,7 @@ $ac_includes_default
int
main ()
{
-static int test_array [1 - 2 * !(((long int) (sizeof (size_t))) <= $ac_mid)];
+static int test_array [1 - 2 * !(((long int) (sizeof (long))) <= $ac_mid)];
test_array [0] = 0
;
@@ -23509,17 +23822,17 @@ fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
done
case $ac_lo in
-?*) ac_cv_sizeof_size_t=$ac_lo;;
-'') if test "$ac_cv_type_size_t" = yes; then
+?*) ac_cv_sizeof_long=$ac_lo;;
+'') if test "$ac_cv_type_long" = yes; then
{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (size_t)
+{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (long)
See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (size_t)
+$as_echo "$as_me: error: cannot compute sizeof (long)
See \`config.log' for more details." >&2;}
{ (exit 77); exit 77; }; }; }
else
- ac_cv_sizeof_size_t=0
+ ac_cv_sizeof_long=0
fi ;;
esac
else
@@ -23530,8 +23843,8 @@ cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
-static long int longval () { return (long int) (sizeof (size_t)); }
-static unsigned long int ulongval () { return (long int) (sizeof (size_t)); }
+static long int longval () { return (long int) (sizeof (long)); }
+static unsigned long int ulongval () { return (long int) (sizeof (long)); }
#include <stdio.h>
#include <stdlib.h>
int
@@ -23541,17 +23854,17 @@ main ()
FILE *f = fopen ("conftest.val", "w");
if (! f)
return 1;
- if (((long int) (sizeof (size_t))) < 0)
+ if (((long int) (sizeof (long))) < 0)
{
long int i = longval ();
- if (i != ((long int) (sizeof (size_t))))
+ if (i != ((long int) (sizeof (long))))
return 1;
fprintf (f, "%ld", i);
}
else
{
unsigned long int i = ulongval ();
- if (i != ((long int) (sizeof (size_t))))
+ if (i != ((long int) (sizeof (long))))
return 1;
fprintf (f, "%lu", i);
}
@@ -23585,23 +23898,23 @@ $as_echo "$ac_try_echo") >&5
ac_status=$?
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
- ac_cv_sizeof_size_t=`cat conftest.val`
+ ac_cv_sizeof_long=`cat conftest.val`
else
$as_echo "$as_me: program exited with status $ac_status" >&5
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
( exit $ac_status )
-if test "$ac_cv_type_size_t" = yes; then
+if test "$ac_cv_type_long" = yes; then
{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (size_t)
+{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (long)
See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (size_t)
+$as_echo "$as_me: error: cannot compute sizeof (long)
See \`config.log' for more details." >&2;}
{ (exit 77); exit 77; }; }; }
else
- ac_cv_sizeof_size_t=0
+ ac_cv_sizeof_long=0
fi
fi
rm -rf conftest.dSYM
@@ -23609,13 +23922,13 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$a
fi
rm -f conftest.val
fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_size_t" >&5
-$as_echo "$ac_cv_sizeof_size_t" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_long" >&5
+$as_echo "$ac_cv_sizeof_long" >&6; }
cat >>confdefs.h <<_ACEOF
-#define SIZEOF_SIZE_T $ac_cv_sizeof_size_t
+#define SIZEOF_LONG $ac_cv_sizeof_long
_ACEOF
@@ -23672,7 +23985,7 @@ _ACEOF
# If not, trying to select it is an error.
{ $as_echo "$as_me:$LINENO: checking whether to build with float8 passed by value" >&5
$as_echo_n "checking whether to build with float8 passed by value... " >&6; }
-if test $ac_cv_sizeof_unsigned_long -ge 8 ; then
+if test $ac_cv_sizeof_void_p -ge 8 ; then
# Check whether --enable-float8-byval was given.
diff --git a/configure.in b/configure.in
index 38ac6c8caa..c0e0130b6a 100644
--- a/configure.in
+++ b/configure.in
@@ -1,5 +1,5 @@
dnl Process this file with autoconf to produce a configure script.
-dnl $PostgreSQL: pgsql/configure.in,v 1.616 2009/12/11 02:21:21 momjian Exp $
+dnl $PostgreSQL: pgsql/configure.in,v 1.617 2009/12/31 19:41:33 tgl Exp $
dnl
dnl Developers, please strive to achieve this order:
dnl
@@ -1095,6 +1095,8 @@ PGAC_STRUCT_SOCKADDR_UN
PGAC_STRUCT_SOCKADDR_STORAGE
PGAC_STRUCT_SOCKADDR_STORAGE_MEMBERS
PGAC_STRUCT_ADDRINFO
+AC_TYPE_INTPTR_T
+AC_TYPE_UINTPTR_T
AC_CHECK_TYPES([struct cmsgcred, struct fcred, struct sockcred], [], [],
[#include <sys/param.h>
@@ -1555,12 +1557,10 @@ if test $pgac_need_repl_snprintf = yes; then
AC_LIBOBJ(snprintf)
fi
-# Need a #define for the size of Datum (unsigned long)
-AC_CHECK_SIZEOF([unsigned long])
-
-# And check size of void *, size_t (enables tweaks for > 32bit address space)
+# Check size of void *, size_t (enables tweaks for > 32bit address space)
AC_CHECK_SIZEOF([void *])
AC_CHECK_SIZEOF([size_t])
+AC_CHECK_SIZEOF([long])
# Decide whether float4 is passed by value: user-selectable, enabled by default
AC_MSG_CHECKING([whether to build with float4 passed by value])
@@ -1577,7 +1577,7 @@ AC_DEFINE_UNQUOTED([FLOAT4PASSBYVAL], [$float4passbyval], [float4 values are pas
# If sizeof(Datum) >= 8, this is user-selectable, enabled by default.
# If not, trying to select it is an error.
AC_MSG_CHECKING([whether to build with float8 passed by value])
-if test $ac_cv_sizeof_unsigned_long -ge 8 ; then
+if test $ac_cv_sizeof_void_p -ge 8 ; then
PGAC_ARG_BOOL(enable, float8-byval, yes, [disable float8 passed by value])
else
PGAC_ARG_BOOL(enable, float8-byval, no, [disable float8 passed by value])
diff --git a/src/backend/access/common/heaptuple.c b/src/backend/access/common/heaptuple.c
index ac5749c713..49164a0697 100644
--- a/src/backend/access/common/heaptuple.c
+++ b/src/backend/access/common/heaptuple.c
@@ -50,7 +50,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/common/heaptuple.c,v 1.127 2009/06/11 14:48:53 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/access/common/heaptuple.c,v 1.128 2009/12/31 19:41:33 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -192,7 +192,7 @@ heap_fill_tuple(TupleDesc tupleDesc,
if (att[i]->attbyval)
{
/* pass-by-value */
- data = (char *) att_align_nominal((long) data, att[i]->attalign);
+ data = (char *) att_align_nominal(data, att[i]->attalign);
store_att_byval(data, values[i], att[i]->attlen);
data_length = att[i]->attlen;
}
@@ -226,7 +226,7 @@ heap_fill_tuple(TupleDesc tupleDesc,
else
{
/* full 4-byte header varlena */
- data = (char *) att_align_nominal((long) data,
+ data = (char *) att_align_nominal(data,
att[i]->attalign);
data_length = VARSIZE(val);
memcpy(data, val, data_length);
@@ -243,7 +243,7 @@ heap_fill_tuple(TupleDesc tupleDesc,
else
{
/* fixed-length pass-by-reference */
- data = (char *) att_align_nominal((long) data, att[i]->attalign);
+ data = (char *) att_align_nominal(data, att[i]->attalign);
Assert(att[i]->attlen > 0);
data_length = att[i]->attlen;
memcpy(data, DatumGetPointer(values[i]), data_length);
diff --git a/src/backend/access/hash/hashfunc.c b/src/backend/access/hash/hashfunc.c
index 3242e2713e..167d5c97ca 100644
--- a/src/backend/access/hash/hashfunc.c
+++ b/src/backend/access/hash/hashfunc.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/hash/hashfunc.c,v 1.59 2009/06/11 14:48:53 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/access/hash/hashfunc.c,v 1.60 2009/12/31 19:41:33 tgl Exp $
*
* NOTES
* These functions are stored in pg_amproc. For each operator class
@@ -319,7 +319,7 @@ hash_any(register const unsigned char *k, register int keylen)
a = b = c = 0x9e3779b9 + len + 3923095;
/* If the source pointer is word-aligned, we use word-wide fetches */
- if (((long) k & UINT32_ALIGN_MASK) == 0)
+ if (((intptr_t) k & UINT32_ALIGN_MASK) == 0)
{
/* Code path for aligned source data */
register const uint32 *ka = (const uint32 *) k;
diff --git a/src/backend/port/hpux/tas.c.template b/src/backend/port/hpux/tas.c.template
index 45782948df..5ccbbcde9a 100644
--- a/src/backend/port/hpux/tas.c.template
+++ b/src/backend/port/hpux/tas.c.template
@@ -20,7 +20,7 @@ tas(lock)
* LDCWX requires that we align the "semaphore" to a 16-byte
* boundary. The actual datum is a single word (4 bytes).
*/
- lock = ((long) lock + 15) & ~15;
+ lock = ((uintptr_t) lock + 15) & ~15;
/*
* The LDCWX instruction atomically clears the target word and
diff --git a/src/backend/storage/lmgr/lwlock.c b/src/backend/storage/lmgr/lwlock.c
index b92ee50c0d..920f3a6b52 100644
--- a/src/backend/storage/lmgr/lwlock.c
+++ b/src/backend/storage/lmgr/lwlock.c
@@ -15,7 +15,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/storage/lmgr/lwlock.c,v 1.53 2009/01/01 17:23:48 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/storage/lmgr/lwlock.c,v 1.54 2009/12/31 19:41:34 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -245,7 +245,7 @@ CreateLWLocks(void)
ptr += 2 * sizeof(int);
/* Ensure desired alignment of LWLock array */
- ptr += LWLOCK_PADDED_SIZE - ((unsigned long) ptr) % LWLOCK_PADDED_SIZE;
+ ptr += LWLOCK_PADDED_SIZE - ((uintptr_t) ptr) % LWLOCK_PADDED_SIZE;
LWLockArray = (LWLockPadded *) ptr;
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 626983d8bd..8b38e8d00f 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -10,7 +10,7 @@
* Written by Peter Eisentraut <[email protected]>.
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.529 2009/12/21 01:34:11 rhaas Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.530 2009/12/31 19:41:34 tgl Exp $
*
*--------------------------------------------------------------------
*/
@@ -87,7 +87,8 @@
#endif
/* upper limit for GUC variables measured in kilobytes of memory */
-#if SIZEOF_SIZE_T > 4
+/* note that various places assume the byte size fits in a "long" variable */
+#if SIZEOF_SIZE_T > 4 && SIZEOF_LONG > 4
#define MAX_KILOBYTES INT_MAX
#else
#define MAX_KILOBYTES (INT_MAX / 1024)
diff --git a/src/include/access/tupmacs.h b/src/include/access/tupmacs.h
index 824adc9b7b..a1828470e2 100644
--- a/src/include/access/tupmacs.h
+++ b/src/include/access/tupmacs.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/access/tupmacs.h,v 1.36 2009/01/01 17:23:56 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/access/tupmacs.h,v 1.37 2009/12/31 19:41:35 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -100,7 +100,8 @@
*/
#define att_align_datum(cur_offset, attalign, attlen, attdatum) \
( \
- ((attlen) == -1 && VARATT_IS_SHORT(DatumGetPointer(attdatum))) ? (long) (cur_offset) : \
+ ((attlen) == -1 && VARATT_IS_SHORT(DatumGetPointer(attdatum))) ? \
+ (intptr_t) (cur_offset) : \
att_align_nominal(cur_offset, attalign) \
)
@@ -115,12 +116,13 @@
* aligned 4-byte length word; in either case we need not align.)
*
* Note: some callers pass a "char *" pointer for cur_offset. This is
- * a bit of a hack but works OK on all known platforms. It ought to be
- * cleaned up someday, though.
+ * a bit of a hack but should work all right as long as intptr_t is the
+ * correct width.
*/
#define att_align_pointer(cur_offset, attalign, attlen, attptr) \
( \
- ((attlen) == -1 && VARATT_NOT_PAD_BYTE(attptr)) ? (long) (cur_offset) : \
+ ((attlen) == -1 && VARATT_NOT_PAD_BYTE(attptr)) ? \
+ (intptr_t) (cur_offset) : \
att_align_nominal(cur_offset, attalign) \
)
@@ -142,7 +144,7 @@
#define att_align_nominal(cur_offset, attalign) \
( \
((attalign) == 'i') ? INTALIGN(cur_offset) : \
- (((attalign) == 'c') ? (long) (cur_offset) : \
+ (((attalign) == 'c') ? (intptr_t) (cur_offset) : \
(((attalign) == 'd') ? DOUBLEALIGN(cur_offset) : \
( \
AssertMacro((attalign) == 's'), \
diff --git a/src/include/c.h b/src/include/c.h
index 36401259de..ea712d6ac6 100644
--- a/src/include/c.h
+++ b/src/include/c.h
@@ -12,7 +12,7 @@
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/c.h,v 1.236 2009/06/11 14:49:08 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/c.h,v 1.237 2009/12/31 19:41:35 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -72,6 +72,9 @@
#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
#include <sys/types.h>
#include <errno.h>
@@ -492,7 +495,7 @@ typedef NameData *Name;
* True iff pointer is properly aligned to point to the given type.
*/
#define PointerIsAligned(pointer, type) \
- (((long)(pointer) % (sizeof (type))) == 0)
+ (((intptr_t)(pointer) % (sizeof (type))) == 0)
#define OidIsValid(objectId) ((bool) ((objectId) != InvalidOid))
@@ -538,7 +541,7 @@ typedef NameData *Name;
*/
#define TYPEALIGN(ALIGNVAL,LEN) \
- (((long) (LEN) + ((ALIGNVAL) - 1)) & ~((long) ((ALIGNVAL) - 1)))
+ (((intptr_t) (LEN) + ((ALIGNVAL) - 1)) & ~((intptr_t) ((ALIGNVAL) - 1)))
#define SHORTALIGN(LEN) TYPEALIGN(ALIGNOF_SHORT, (LEN))
#define INTALIGN(LEN) TYPEALIGN(ALIGNOF_INT, (LEN))
@@ -549,7 +552,7 @@ typedef NameData *Name;
#define BUFFERALIGN(LEN) TYPEALIGN(ALIGNOF_BUFFER, (LEN))
#define TYPEALIGN_DOWN(ALIGNVAL,LEN) \
- (((long) (LEN)) & ~((long) ((ALIGNVAL) - 1)))
+ (((intptr_t) (LEN)) & ~((intptr_t) ((ALIGNVAL) - 1)))
#define SHORTALIGN_DOWN(LEN) TYPEALIGN_DOWN(ALIGNOF_SHORT, (LEN))
#define INTALIGN_DOWN(LEN) TYPEALIGN_DOWN(ALIGNOF_INT, (LEN))
@@ -630,7 +633,7 @@ typedef NameData *Name;
int _val = (val); \
Size _len = (len); \
\
- if ((((long) _vstart) & LONG_ALIGN_MASK) == 0 && \
+ if ((((intptr_t) _vstart) & LONG_ALIGN_MASK) == 0 && \
(_len & LONG_ALIGN_MASK) == 0 && \
_val == 0 && \
_len <= MEMSET_LOOP_LIMIT && \
diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in
index 1af24681fd..a3a80f053b 100644
--- a/src/include/pg_config.h.in
+++ b/src/include/pg_config.h.in
@@ -236,6 +236,9 @@
/* Define to 1 if the system has the type `int8'. */
#undef HAVE_INT8
+/* Define to 1 if the system has the type `intptr_t'. */
+#undef HAVE_INTPTR_T
+
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
@@ -599,6 +602,9 @@
/* Define to 1 if the system has the type `uint8'. */
#undef HAVE_UINT8
+/* Define to 1 if the system has the type `uintptr_t'. */
+#undef HAVE_UINTPTR_T
+
/* Define to 1 if the system has the type `union semun'. */
#undef HAVE_UNION_SEMUN
@@ -705,15 +711,15 @@
RELSEG_SIZE requires an initdb. */
#undef RELSEG_SIZE
+/* The size of `long', as computed by sizeof. */
+#undef SIZEOF_LONG
+
/* The size of `off_t', as computed by sizeof. */
#undef SIZEOF_OFF_T
/* The size of `size_t', as computed by sizeof. */
#undef SIZEOF_SIZE_T
-/* The size of `unsigned long', as computed by sizeof. */
-#undef SIZEOF_UNSIGNED_LONG
-
/* The size of `void *', as computed by sizeof. */
#undef SIZEOF_VOID_P
@@ -827,9 +833,17 @@
#undef inline
#endif
+/* 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. */
+#undef intptr_t
+
/* Define to empty if the C compiler does not understand signed types. */
#undef signed
+/* Define to the type of an unsigned integer type wide enough to hold a
+ pointer, if such a type exists, and if the system does not define it. */
+#undef uintptr_t
+
/* Define to empty if the keyword `volatile' does not work. Warning: valid
code using `volatile' can become incorrect without. Disable with care. */
#undef volatile
diff --git a/src/include/pg_config.h.win32 b/src/include/pg_config.h.win32
index a3b3b7374b..573a53edb8 100644
--- a/src/include/pg_config.h.win32
+++ b/src/include/pg_config.h.win32
@@ -347,7 +347,7 @@
/* #undef HAVE_SRANDOM */
/* Define to 1 if you have the <stdint.h> header file. */
-#define HAVE_STDINT_H 1
+/* #undef HAVE_STDINT_H */
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
@@ -585,11 +585,14 @@
your system. */
/* #undef PTHREAD_CREATE_JOINABLE */
-/* The size of a `size_t', as computed by sizeof. */
+/* The size of `long', as computed by sizeof. */
+#define SIZEOF_LONG 4
+
+/* The size of `size_t', as computed by sizeof. */
#define SIZEOF_SIZE_T 4
-/* The size of a `unsigned long', as computed by sizeof. */
-#define SIZEOF_UNSIGNED_LONG 4
+/* The size of `void *', as computed by sizeof. */
+#define SIZEOF_VOID_P 4
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
diff --git a/src/include/postgres.h b/src/include/postgres.h
index c1e4f77386..ea6d81e52d 100644
--- a/src/include/postgres.h
+++ b/src/include/postgres.h
@@ -10,7 +10,7 @@
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
* Portions Copyright (c) 1995, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/postgres.h,v 1.92 2009/01/01 17:23:55 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/postgres.h,v 1.93 2009/12/31 19:41:35 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -285,16 +285,10 @@ typedef struct
/*
* Port Notes:
- * Postgres makes the following assumption about machines:
- *
- * sizeof(Datum) == sizeof(long) >= sizeof(void *) >= 4
- *
- * Postgres also assumes that
+ * Postgres makes the following assumptions about datatype sizes:
*
+ * sizeof(Datum) == sizeof(void *) == 4 or 8
* sizeof(char) == 1
- *
- * and that
- *
* sizeof(short) == 2
*
* When a type narrower than Datum is stored in a Datum, we place it in the
@@ -305,9 +299,9 @@ typedef struct
* or short may contain garbage when called as if it returned Datum.
*/
-typedef unsigned long Datum; /* XXX sizeof(long) >= sizeof(void *) */
+typedef uintptr_t Datum;
-#define SIZEOF_DATUM SIZEOF_UNSIGNED_LONG
+#define SIZEOF_DATUM SIZEOF_VOID_P
typedef Datum *DatumPtr;
diff --git a/src/include/storage/s_lock.h b/src/include/storage/s_lock.h
index 174fa60d6e..228ffdff57 100644
--- a/src/include/storage/s_lock.h
+++ b/src/include/storage/s_lock.h
@@ -66,7 +66,7 @@
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/storage/s_lock.h,v 1.167 2009/07/27 05:31:05 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/storage/s_lock.h,v 1.168 2009/12/31 19:41:36 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -683,7 +683,7 @@ typedef struct
int sema[4];
} slock_t;
-#define TAS_ACTIVE_WORD(lock) ((volatile int *) (((long) (lock) + 15) & ~15))
+#define TAS_ACTIVE_WORD(lock) ((volatile int *) (((uintptr_t) (lock) + 15) & ~15))
#if defined(__GNUC__)
diff --git a/src/interfaces/ecpg/ecpglib/data.c b/src/interfaces/ecpg/ecpglib/data.c
index 04eb335383..f30fe8ba1e 100644
--- a/src/interfaces/ecpg/ecpglib/data.c
+++ b/src/interfaces/ecpg/ecpglib/data.c
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/data.c,v 1.46 2009/11/27 13:32:17 meskes Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/data.c,v 1.47 2009/12/31 19:41:36 tgl Exp $ */
#define POSTGRES_ECPG_INTERNAL
#include "postgres_fe.h"
@@ -162,12 +162,10 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
if (binary)
{
if (varcharsize == 0 || varcharsize * offset >= size)
- memcpy((char *) ((long) var + offset * act_tuple),
- pval, size);
+ memcpy(var + offset * act_tuple, pval, size);
else
{
- memcpy((char *) ((long) var + offset * act_tuple),
- pval, varcharsize * offset);
+ memcpy(var + offset * act_tuple, pval, varcharsize * offset);
if (varcharsize * offset < size)
{
@@ -371,7 +369,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
case ECPGt_unsigned_char:
case ECPGt_string:
{
- char *str = (char *) ((long) var + offset * act_tuple);
+ char *str = (char *) (var + offset * act_tuple);
if (varcharsize == 0 || varcharsize > size)
{
strncpy(str, pval, size + 1);
@@ -426,7 +424,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
case ECPGt_varchar:
{
struct ECPGgeneric_varchar *variable =
- (struct ECPGgeneric_varchar *) ((long) var + offset * act_tuple);
+ (struct ECPGgeneric_varchar *) (var + offset * act_tuple);
variable->len = size;
if (varcharsize == 0)
diff --git a/src/pl/plperl/plperl.c b/src/pl/plperl/plperl.c
index 4fe30bba27..2c429b0bc1 100644
--- a/src/pl/plperl/plperl.c
+++ b/src/pl/plperl/plperl.c
@@ -1,7 +1,7 @@
/**********************************************************************
* plperl.c - perl as a procedural language for PostgreSQL
*
- * $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.156 2009/12/29 17:40:59 heikki Exp $
+ * $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.157 2009/12/31 19:41:37 tgl Exp $
*
**********************************************************************/
@@ -95,7 +95,7 @@ typedef struct plperl_call_data
**********************************************************************/
typedef struct plperl_query_desc
{
- char qname[sizeof(long) * 2 + 1];
+ char qname[20];
void *plan;
int nargs;
Oid *argtypes;
@@ -2337,7 +2337,7 @@ plperl_spi_prepare(char *query, int argc, SV **argv)
************************************************************/
qdesc = (plperl_query_desc *) malloc(sizeof(plperl_query_desc));
MemSet(qdesc, 0, sizeof(plperl_query_desc));
- snprintf(qdesc->qname, sizeof(qdesc->qname), "%lx", (long) qdesc);
+ snprintf(qdesc->qname, sizeof(qdesc->qname), "%p", qdesc);
qdesc->nargs = argc;
qdesc->argtypes = (Oid *) malloc(argc * sizeof(Oid));
qdesc->arginfuncs = (FmgrInfo *) malloc(argc * sizeof(FmgrInfo));
diff --git a/src/pl/tcl/pltcl.c b/src/pl/tcl/pltcl.c
index 2e8db71275..82189c15c3 100644
--- a/src/pl/tcl/pltcl.c
+++ b/src/pl/tcl/pltcl.c
@@ -2,7 +2,7 @@
* pltcl.c - PostgreSQL support for Tcl as
* procedural language (PL)
*
- * $PostgreSQL: pgsql/src/pl/tcl/pltcl.c,v 1.128 2009/06/11 14:49:14 momjian Exp $
+ * $PostgreSQL: pgsql/src/pl/tcl/pltcl.c,v 1.129 2009/12/31 19:41:37 tgl Exp $
*
**********************************************************************/
@@ -1946,7 +1946,7 @@ pltcl_SPI_prepare(ClientData cdata, Tcl_Interp *interp,
* Allocate the new querydesc structure
************************************************************/
qdesc = (pltcl_query_desc *) malloc(sizeof(pltcl_query_desc));
- snprintf(qdesc->qname, sizeof(qdesc->qname), "%lx", (long) qdesc);
+ snprintf(qdesc->qname, sizeof(qdesc->qname), "%p", qdesc);
qdesc->nargs = nargs;
qdesc->argtypes = (Oid *) malloc(nargs * sizeof(Oid));
qdesc->arginfuncs = (FmgrInfo *) malloc(nargs * sizeof(FmgrInfo));