summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/include')
-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
6 files changed, 47 insertions, 31 deletions
diff --git a/src/include/access/tupmacs.h b/src/include/access/tupmacs.h
index 824adc9b7be..a1828470e26 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 36401259deb..ea712d6ac69 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 1af24681fd7..a3a80f053b9 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 a3b3b7374b0..573a53edb86 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 c1e4f77386f..ea6d81e52d2 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 174fa60d6ec..228ffdff577 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__)