uintptr_t for Datum
Attached patch is the part of the win64 patch that changes Datum to be
uintptr_t, and associated changes, with only very minor changes from
me. It also includes autoconf tests that I tricked Bruce into fixing
for me :-)
Comments?
Unless there are objections, I'll go ahead and apply this one for
broader buildfarm testing. It's working on all the platforms I could
test, and also on Bruces (where the original patch broke).
--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/
Attachments:
uintptr.patchapplication/octet-stream; name=uintptr.patchDownload
diff --git a/configure b/configure
index 009a177..416e4c8 100755
--- a/configure
+++ b/configure
@@ -16024,6 +16024,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
diff --git a/configure.in b/configure.in
index d875571..add5f1c 100644
--- a/configure.in
+++ b/configure.in
@@ -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>
diff --git a/src/backend/access/common/heaptuple.c b/src/backend/access/common/heaptuple.c
index a86716e..f429f68 100644
--- a/src/backend/access/common/heaptuple.c
+++ b/src/backend/access/common/heaptuple.c
@@ -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 a38103e..d3efb29 100644
--- a/src/backend/access/hash/hashfunc.c
+++ b/src/backend/access/hash/hashfunc.c
@@ -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/storage/lmgr/lwlock.c b/src/backend/storage/lmgr/lwlock.c
index f2ccbe1..5d88b02 100644
--- a/src/backend/storage/lmgr/lwlock.c
+++ b/src/backend/storage/lmgr/lwlock.c
@@ -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/include/access/tupmacs.h b/src/include/access/tupmacs.h
index 7666aaa..82ee422 100644
--- a/src/include/access/tupmacs.h
+++ b/src/include/access/tupmacs.h
@@ -142,7 +142,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 44efac4..acaec39 100644
--- a/src/include/c.h
+++ b/src/include/c.h
@@ -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 1af2468..5420e6b 100644
--- a/src/include/pg_config.h.in
+++ b/src/include/pg_config.h.in
@@ -833,3 +833,11 @@
/* Define to empty if the keyword `volatile' does not work. Warning: valid
code using `volatile' can become incorrect without. Disable with care. */
#undef volatile
+
+#ifndef HAVE_UINTPTR_T
+#undef uintptr_t
+#endif
+
+#ifndef HAVE_INTPTR_T
+#undef intptr_t
+#endif
diff --git a/src/include/pg_config.h.win32 b/src/include/pg_config.h.win32
index a3b3b73..0f9ecf9 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
@@ -591,6 +591,9 @@
/* 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 26dfecc..e0d04c1 100644
--- a/src/include/postgres.h
+++ b/src/include/postgres.h
@@ -305,9 +305,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; /* XXX sizeof(long) >= sizeof(void *) */
-#define SIZEOF_DATUM SIZEOF_UNSIGNED_LONG
+#define SIZEOF_DATUM SIZEOF_VOID_P
typedef Datum *DatumPtr;
diff --git a/src/interfaces/ecpg/ecpglib/data.c b/src/interfaces/ecpg/ecpglib/data.c
index d468de6..12ee7a8 100644
--- a/src/interfaces/ecpg/ecpglib/data.c
+++ b/src/interfaces/ecpg/ecpglib/data.c
@@ -162,11 +162,11 @@ 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),
+ memcpy((char *) (var + offset * act_tuple),
pval, size);
else
{
- memcpy((char *) ((long) var + offset * act_tuple),
+ memcpy((char *) (var + offset * act_tuple),
pval, varcharsize * offset);
if (varcharsize * offset < size)
@@ -371,7 +371,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 +426,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)
Magnus Hagander <magnus@hagander.net> writes:
Attached patch is the part of the win64 patch that changes Datum to be
uintptr_t, and associated changes, with only very minor changes from
me. It also includes autoconf tests that I tricked Bruce into fixing
for me :-)
Comments?
This is a joke no? Where's the logic to provide a definition of
intptr_t if the platform fails to? The lack of attention to updating
the comments about Datum doesn't give me a warm feeling either.
BTW, it looks like the patch is showing a manual change to
pg_config.h.in. Don't do that. Run autoheader.
regards, tom lane
2009/12/31 Tom Lane <tgl@sss.pgh.pa.us>:
Magnus Hagander <magnus@hagander.net> writes:
Attached patch is the part of the win64 patch that changes Datum to be
uintptr_t, and associated changes, with only very minor changes from
me. It also includes autoconf tests that I tricked Bruce into fixing
for me :-)Comments?
This is a joke no?
Hey, it got your attention ;)
Where's the logic to provide a definition of
intptr_t if the platform fails to? The lack of attention to updating
autoconf does that. This is exactly what broke on Bruce's platform,
and autoconf fixed it in the way that is included in the patch.
the comments about Datum doesn't give me a warm feeling either.
Will look over that.
BTW, it looks like the patch is showing a manual change to
pg_config.h.in. Don't do that. Run autoheader.
That also came out of Bruce's patch. Bruce, can you look at doing
that? I don't have a machine easily accessible with the right autoconf
version ATM :(
--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/
Magnus Hagander <magnus@hagander.net> writes:
2009/12/31 Tom Lane <tgl@sss.pgh.pa.us>:
�Where's the logic to provide a definition of
intptr_t if the platform fails to?
autoconf does that.
Oh, that's what I get for trying to review a patch before absorbing
any caffeine :-( ... I missed that you were relying on a built-in
autoconf macro.
That also came out of Bruce's patch. Bruce, can you look at doing
that? I don't have a machine easily accessible with the right autoconf
version ATM :(
It's a really bad idea to be committing configure changes without having
personally run the patch through autoconf.
As penance for being too quick to complain, I'll review and commit this
myself. If it works on my old HPUX box, it'll probably work everywhere ;-)
regards, tom lane
2009/12/31 Tom Lane <tgl@sss.pgh.pa.us>:
Magnus Hagander <magnus@hagander.net> writes:
2009/12/31 Tom Lane <tgl@sss.pgh.pa.us>:
Where's the logic to provide a definition of
intptr_t if the platform fails to?autoconf does that.
Oh, that's what I get for trying to review a patch before absorbing
any caffeine :-( ... I missed that you were relying on a built-in
autoconf macro.
:-)
That also came out of Bruce's patch. Bruce, can you look at doing
that? I don't have a machine easily accessible with the right autoconf
version ATM :(It's a really bad idea to be committing configure changes without having
personally run the patch through autoconf.
Right, this is why I had Bruce do that part, and send it to me
separately. I figured one committer is as good as another.
As penance for being too quick to complain, I'll review and commit this
myself. If it works on my old HPUX box, it'll probably work everywhere ;-)
Ok, deal :-) That's probably the one other platform beside Bruce's
that gets reasonably-regular-testing and still doesn't have intptr_t.
I'll be off to my newyears party now, enjoy the patch! Happy new year
to you and other PostgreSQL hackers!
--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/
Tom Lane wrote:
Magnus Hagander <magnus@hagander.net> writes:
Attached patch is the part of the win64 patch that changes Datum to be
uintptr_t, and associated changes, with only very minor changes from
me. It also includes autoconf tests that I tricked Bruce into fixing
for me :-)Comments?
This is a joke no? Where's the logic to provide a definition of
intptr_t if the platform fails to? The lack of attention to updating
the comments about Datum doesn't give me a warm feeling either.BTW, it looks like the patch is showing a manual change to
pg_config.h.in. Don't do that. Run autoheader.
I wasn't aware autoheader existed. Is that new or has it alwasy been
part of autoconf?
Attached is the diff for pg_config.h.in generated by autoheader.
--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ If your life is a hard drive, Christ can be your backup. +
Attachments:
/rtmp/difftext/x-diffDownload
Index: pg_config.h.in
===================================================================
RCS file: /cvsroot/pgsql/src/include/pg_config.h.in,v
retrieving revision 1.143
diff -c -r1.143 pg_config.h.in
*** pg_config.h.in 1 Oct 2009 01:58:58 -0000 1.143
--- pg_config.h.in 31 Dec 2009 17:35:33 -0000
***************
*** 236,241 ****
--- 236,244 ----
/* 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,604 ****
--- 602,610 ----
/* 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
***************
*** 827,835 ****
--- 833,849 ----
#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
Bruce Momjian <bruce@momjian.us> writes:
Tom Lane wrote:
BTW, it looks like the patch is showing a manual change to
pg_config.h.in. Don't do that. Run autoheader.
I wasn't aware autoheader existed. Is that new or has it alwasy been
part of autoconf?
It's always been there, or at least for many years. pg_config.h.in
really ought to be thought of the same as configure: you don't edit
it, you just generate it.
regards, tom lane
Tom Lane wrote:
Bruce Momjian <bruce@momjian.us> writes:
Tom Lane wrote:
BTW, it looks like the patch is showing a manual change to
pg_config.h.in. Don't do that. Run autoheader.I wasn't aware autoheader existed. Is that new or has it alwasy been
part of autoconf?It's always been there, or at least for many years. pg_config.h.in
really ought to be thought of the same as configure: you don't edit
it, you just generate it.
Well, that's pretty confusing considering it has a .in suffix, just like
configure.in, which we do edit, but I get your point.
--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ If your life is a hard drive, Christ can be your backup. +
On tor, 2009-12-31 at 13:44 -0500, Bruce Momjian wrote:
Tom Lane wrote:
Bruce Momjian <bruce@momjian.us> writes:
Tom Lane wrote:
BTW, it looks like the patch is showing a manual change to
pg_config.h.in. Don't do that. Run autoheader.I wasn't aware autoheader existed. Is that new or has it alwasy been
part of autoconf?It's always been there, or at least for many years. pg_config.h.in
really ought to be thought of the same as configure: you don't edit
it, you just generate it.Well, that's pretty confusing considering it has a .in suffix, just like
configure.in, which we do edit, but I get your point.
I realize it's easy to miss, but the first line of pg_config.h.in tells
that it is generated.