diff options
| author | Bruce Momjian | 1998-06-15 18:40:05 +0000 |
|---|---|---|
| committer | Bruce Momjian | 1998-06-15 18:40:05 +0000 |
| commit | 27db9ecd0b15abca733a99dab3bf9771ad70507d (patch) | |
| tree | 047acdb5eca8e9b5c904c7285f9fdc81b4e527c2 /src/include | |
| parent | 3af536a15b64b9cfd8464af2032ccf5e66e79439 (diff) | |
Fix macros that were not properly surrounded by parens or braces.
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/access/attnum.h | 8 | ||||
| -rw-r--r-- | src/include/access/heapam.h | 88 | ||||
| -rw-r--r-- | src/include/access/itup.h | 62 | ||||
| -rw-r--r-- | src/include/c.h | 4 | ||||
| -rw-r--r-- | src/include/executor/execdebug.h | 19 | ||||
| -rw-r--r-- | src/include/storage/block.h | 27 | ||||
| -rw-r--r-- | src/include/storage/buf_internals.h | 38 | ||||
| -rw-r--r-- | src/include/storage/bufmgr.h | 5 | ||||
| -rw-r--r-- | src/include/storage/bufpage.h | 28 | ||||
| -rw-r--r-- | src/include/storage/itemid.h | 8 | ||||
| -rw-r--r-- | src/include/storage/itemptr.h | 51 | ||||
| -rw-r--r-- | src/include/storage/lock.h | 8 | ||||
| -rw-r--r-- | src/include/storage/s_lock.h | 13 | ||||
| -rw-r--r-- | src/include/utils/exc.h | 41 |
14 files changed, 214 insertions, 186 deletions
diff --git a/src/include/access/attnum.h b/src/include/access/attnum.h index 910e07fc111..eb1194f5f32 100644 --- a/src/include/access/attnum.h +++ b/src/include/access/attnum.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: attnum.h,v 1.6 1997/09/08 02:34:02 momjian Exp $ + * $Id: attnum.h,v 1.7 1998/06/15 18:39:52 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -47,8 +47,10 @@ typedef int16 AttrNumber; * Assumes the attribute number is for an user defined attribute. */ #define AttrNumberGetAttrOffset(attNum) \ - (AssertMacro(AttrNumberIsForUserDefinedAttr(attNum)) ? \ - ((attNum - 1)) : 0) +( \ + AssertMacro(AttrNumberIsForUserDefinedAttr(attNum)), \ + ((attNum) - 1) \ +) /* * AttributeOffsetGetAttributeNumber -- diff --git a/src/include/access/heapam.h b/src/include/access/heapam.h index 56aa0e66eb0..f0fff75d4ca 100644 --- a/src/include/access/heapam.h +++ b/src/include/access/heapam.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: heapam.h,v 1.32 1998/06/14 01:34:07 momjian Exp $ + * $Id: heapam.h,v 1.33 1998/06/15 18:39:53 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -92,43 +92,37 @@ typedef HeapAccessStatisticsData *HeapAccessStatistics; #define fastgetattr(tup, attnum, tupleDesc, isnull) \ ( \ - AssertMacro((attnum) > 0) ? \ + AssertMacro((attnum) > 0), \ + ((isnull) ? (*(isnull) = false) : (dummyret)NULL), \ + HeapTupleNoNulls(tup) ? \ ( \ - ((isnull) ? (*(isnull) = false) : (dummyret)NULL), \ - HeapTupleNoNulls(tup) ? \ + ((tupleDesc)->attrs[(attnum)-1]->attcacheoff != -1 || \ + (attnum) == 1) ? \ ( \ - ((tupleDesc)->attrs[(attnum)-1]->attcacheoff != -1 || \ - (attnum) == 1) ? \ - ( \ - (Datum)fetchatt(&((tupleDesc)->attrs[(attnum)-1]), \ - (char *) (tup) + (tup)->t_hoff + \ - ( \ - ((attnum) != 1) ? \ - (tupleDesc)->attrs[(attnum)-1]->attcacheoff \ - : \ - 0 \ - ) \ + (Datum)fetchatt(&((tupleDesc)->attrs[(attnum)-1]), \ + (char *) (tup) + (tup)->t_hoff + \ + ( \ + ((attnum) != 1) ? \ + (tupleDesc)->attrs[(attnum)-1]->attcacheoff \ + : \ + 0 \ ) \ ) \ - : \ - nocachegetattr((tup), (attnum), (tupleDesc), (isnull)) \ ) \ : \ - ( \ - att_isnull((attnum)-1, (tup)->t_bits) ? \ - ( \ - ((isnull) ? (*(isnull) = true) : (dummyret)NULL), \ - (Datum)NULL \ - ) \ - : \ - ( \ - nocachegetattr((tup), (attnum), (tupleDesc), (isnull)) \ - ) \ - ) \ + nocachegetattr((tup), (attnum), (tupleDesc), (isnull)) \ ) \ : \ ( \ - (Datum)NULL \ + att_isnull((attnum)-1, (tup)->t_bits) ? \ + ( \ + ((isnull) ? (*(isnull) = true) : (dummyret)NULL), \ + (Datum)NULL \ + ) \ + : \ + ( \ + nocachegetattr((tup), (attnum), (tupleDesc), (isnull)) \ + ) \ ) \ ) @@ -208,39 +202,33 @@ static Datum fastgetattr(HeapTuple tup, int attnum, TupleDesc tupleDesc, ( \ AssertMacro((tup) != NULL && \ (attnum) > FirstLowInvalidHeapAttributeNumber && \ - (attnum) != 0) ? \ + (attnum) != 0), \ + ((attnum) > (int) (tup)->t_natts) ? \ ( \ - ((attnum) > (int) (tup)->t_natts) ? \ + ((isnull) ? (*(isnull) = true) : (dummyret)NULL), \ + (Datum)NULL \ + ) \ + : \ + ( \ + ((attnum) > 0) ? \ ( \ - ((isnull) ? (*(isnull) = true) : (dummyret)NULL), \ - (Datum)NULL \ + fastgetattr((tup), (attnum), (tupleDesc), (isnull)) \ ) \ : \ ( \ - ((attnum) > 0) ? \ + ((isnull) ? (*(isnull) = false) : (dummyret)NULL), \ + ((attnum) == SelfItemPointerAttributeNumber) ? \ ( \ - fastgetattr((tup), (attnum), (tupleDesc), (isnull)) \ + (Datum)((char *)(tup) + \ + heap_sysoffset[-SelfItemPointerAttributeNumber-1]) \ ) \ : \ ( \ - ((isnull) ? (*(isnull) = false) : (dummyret)NULL), \ - ((attnum) == SelfItemPointerAttributeNumber) ? \ - ( \ - (Datum)((char *)(tup) + \ - heap_sysoffset[-SelfItemPointerAttributeNumber-1]) \ - ) \ - : \ - ( \ - (Datum)*(unsigned int *) \ - ((char *)(tup) + heap_sysoffset[-(attnum)-1]) \ - ) \ + (Datum)*(unsigned int *) \ + ((char *)(tup) + heap_sysoffset[-(attnum)-1]) \ ) \ ) \ ) \ - : \ - ( \ - (Datum)NULL \ - ) \ ) extern HeapAccessStatistics heap_access_stats; /* in stats.c */ diff --git a/src/include/access/itup.h b/src/include/access/itup.h index 68fa5e2a7b0..40d26f3feb1 100644 --- a/src/include/access/itup.h +++ b/src/include/access/itup.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: itup.h,v 1.13 1998/02/26 04:40:19 momjian Exp $ + * $Id: itup.h,v 1.14 1998/06/15 18:39:54 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -118,49 +118,43 @@ typedef struct PredInfo */ #define index_getattr(tup, attnum, tupleDesc, isnull) \ ( \ - AssertMacro(PointerIsValid(isnull) && (attnum) > 0) ? \ + AssertMacro(PointerIsValid(isnull) && (attnum) > 0), \ + *(isnull) = false, \ + IndexTupleNoNulls(tup) ? \ ( \ - *(isnull) = false, \ - IndexTupleNoNulls(tup) ? \ + ((tupleDesc)->attrs[(attnum)-1]->attcacheoff != -1 || \ + (attnum) == 1) ? \ ( \ - ((tupleDesc)->attrs[(attnum)-1]->attcacheoff != -1 || \ - (attnum) == 1) ? \ + (Datum)fetchatt(&((tupleDesc)->attrs[(attnum)-1]), \ + (char *) (tup) + \ ( \ - (Datum)fetchatt(&((tupleDesc)->attrs[(attnum)-1]), \ - (char *) (tup) + \ - ( \ - IndexTupleHasMinHeader(tup) ? \ - sizeof (*(tup)) \ - : \ - IndexInfoFindDataOffset((tup)->t_info) \ - ) + \ - ( \ - ((attnum) != 1) ? \ - (tupleDesc)->attrs[(attnum)-1]->attcacheoff \ - : \ - 0 \ - ) \ + IndexTupleHasMinHeader(tup) ? \ + sizeof (*(tup)) \ + : \ + IndexInfoFindDataOffset((tup)->t_info) \ + ) + \ + ( \ + ((attnum) != 1) ? \ + (tupleDesc)->attrs[(attnum)-1]->attcacheoff \ + : \ + 0 \ ) \ ) \ - : \ - nocache_index_getattr((tup), (attnum), (tupleDesc), (isnull)) \ ) \ : \ - ( \ - (att_isnull((attnum)-1, (char *)(tup) + sizeof(*(tup)))) ? \ - ( \ - *(isnull) = true, \ - (Datum)NULL \ - ) \ - : \ - ( \ - nocache_index_getattr((tup), (attnum), (tupleDesc), (isnull)) \ - ) \ - ) \ + nocache_index_getattr((tup), (attnum), (tupleDesc), (isnull)) \ ) \ : \ ( \ - (Datum)NULL \ + (att_isnull((attnum)-1, (char *)(tup) + sizeof(*(tup)))) ? \ + ( \ + *(isnull) = true, \ + (Datum)NULL \ + ) \ + : \ + ( \ + nocache_index_getattr((tup), (attnum), (tupleDesc), (isnull)) \ + ) \ ) \ ) diff --git a/src/include/c.h b/src/include/c.h index bbc8426e99c..f9b13fffc9b 100644 --- a/src/include/c.h +++ b/src/include/c.h @@ -7,7 +7,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: c.h,v 1.39 1998/04/06 17:27:49 momjian Exp $ + * $Id: c.h,v 1.40 1998/06/15 18:39:51 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -624,7 +624,7 @@ typedef struct Exception Trap(!(condition), FailedAssertion) #define AssertMacro(condition) \ - TrapMacro(!(condition), FailedAssertion) + (void)TrapMacro(!(condition), FailedAssertion) #define AssertArg(condition) \ Trap(!(condition), BadArg) diff --git a/src/include/executor/execdebug.h b/src/include/executor/execdebug.h index 4337b3d1b4c..d9a746a7255 100644 --- a/src/include/executor/execdebug.h +++ b/src/include/executor/execdebug.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: execdebug.h,v 1.4 1997/09/08 02:36:12 momjian Exp $ + * $Id: execdebug.h,v 1.5 1998/06/15 18:39:55 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -193,14 +193,15 @@ extern int NIndexTupleInserted; #define IncrIndexProcessed() NIndexTupleProcessed++ #define IncrIndexInserted() NIndexTupleInserted++ #else -#define IncrRetrieved() -#define IncrAppended() -#define IncrDeleted() -#define IncrReplaced() -#define IncrInserted() -#define IncrProcessed() -#define IncrIndexProcessed() -#define IncrIndexInserted() +/* stop compiler warnings */ +#define IncrRetrieved() (void)(0) +#define IncrAppended() (void)(0) +#define IncrDeleted() (void)(0) +#define IncrReplaced() (void)(0) +#define IncrInserted() (void)(0) +#define IncrProcessed() (void)(0) +#define IncrIndexProcessed() (void)(0) +#define IncrIndexInserted() (void)(0) #endif /* EXEC_TUPLECOUNT */ /* ---------------- diff --git a/src/include/storage/block.h b/src/include/storage/block.h index 02b181174f0..17b93786882 100644 --- a/src/include/storage/block.h +++ b/src/include/storage/block.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: block.h,v 1.5 1997/09/08 20:58:59 momjian Exp $ + * $Id: block.h,v 1.6 1998/06/15 18:40:00 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -79,19 +79,23 @@ typedef BlockIdData *BlockId; /* block identifier */ * Sets a block identifier to the specified value. */ #define BlockIdSet(blockId, blockNumber) \ - Assert(PointerIsValid(blockId)); \ - (blockId)->bi_hi = (blockNumber) >> 16; \ - (blockId)->bi_lo = (blockNumber) & 0xffff +( \ + AssertMacro(PointerIsValid(blockId)), \ + (blockId)->bi_hi = (blockNumber) >> 16, \ + (blockId)->bi_lo = (blockNumber) & 0xffff \ +) /* * BlockIdCopy -- * Copy a block identifier. */ #define BlockIdCopy(toBlockId, fromBlockId) \ - Assert(PointerIsValid(toBlockId)); \ - Assert(PointerIsValid(fromBlockId)); \ - (toBlockId)->bi_hi = (fromBlockId)->bi_hi; \ - (toBlockId)->bi_lo = (fromBlockId)->bi_lo +( \ + AssertMacro(PointerIsValid(toBlockId)), \ + AssertMacro(PointerIsValid(fromBlockId)), \ + (toBlockId)->bi_hi = (fromBlockId)->bi_hi, \ + (toBlockId)->bi_lo = (fromBlockId)->bi_lo \ +) /* * BlockIdEquals -- @@ -106,8 +110,9 @@ typedef BlockIdData *BlockId; /* block identifier */ * Retrieve the block number from a block identifier. */ #define BlockIdGetBlockNumber(blockId) \ - (AssertMacro(BlockIdIsValid(blockId)) ? \ - (BlockNumber) (((blockId)->bi_hi << 16) | ((uint16) (blockId)->bi_lo)) : \ - (BlockNumber) InvalidBlockNumber) +( \ + AssertMacro(BlockIdIsValid(blockId)), \ + (BlockNumber) (((blockId)->bi_hi << 16) | ((uint16) (blockId)->bi_lo)) \ +) #endif /* BLOCK_H */ diff --git a/src/include/storage/buf_internals.h b/src/include/storage/buf_internals.h index e3ccfb92886..ac9f76182cc 100644 --- a/src/include/storage/buf_internals.h +++ b/src/include/storage/buf_internals.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: buf_internals.h,v 1.21 1998/02/26 04:43:21 momjian Exp $ + * $Id: buf_internals.h,v 1.22 1998/06/15 18:40:01 momjian Exp $ * * NOTE * If BUFFERPAGE0 is defined, then 0 will be used as a @@ -55,26 +55,32 @@ struct buftag BlockNumber blockNum; /* blknum relative to begin of reln */ }; -#define CLEAR_BUFFERTAG(a)\ - (a)->relId.dbId = InvalidOid; \ - (a)->relId.relId = InvalidOid; \ - (a)->blockNum = InvalidBlockNumber +#define CLEAR_BUFFERTAG(a) \ +( \ + (a)->relId.dbId = InvalidOid, \ + (a)->relId.relId = InvalidOid, \ + (a)->blockNum = InvalidBlockNumber \ +) #define INIT_BUFFERTAG(a,xx_reln,xx_blockNum) \ -{ \ - (a)->blockNum = xx_blockNum;\ - (a)->relId = RelationGetLRelId(xx_reln); \ -} +( \ + (a)->blockNum = xx_blockNum, \ + (a)->relId = RelationGetLRelId(xx_reln) \ +) + #ifdef NOT_USED -#define COPY_BUFFERTAG(a,b)\ -{ \ - (a)->blockNum = (b)->blockNum;\ - LRelIdAssign(*(a),*(b));\ -} +#define COPY_BUFFERTAG(a,b) \ +( \ + (a)->blockNum = (b)->blockNum, \ + LRelIdAssign(*(a),*(b)) \ +) #define EQUAL_BUFFERTAG(a,b) \ - (((a)->blockNum == (b)->blockNum) &&\ - (OID_Equal((a)->relId.relId,(b)->relId.relId))) +( \ + ((a)->blockNum == (b)->blockNum && \ + OID_Equal((a)->relId.relId,(b)->relId.relId)) \ +) + #endif #define BAD_BUFFER_ID(bid) ((bid<1) || (bid>(NBuffers))) diff --git a/src/include/storage/bufmgr.h b/src/include/storage/bufmgr.h index f27e9d1ed3a..9b590227b5a 100644 --- a/src/include/storage/bufmgr.h +++ b/src/include/storage/bufmgr.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: bufmgr.h,v 1.19 1998/04/24 14:43:18 momjian Exp $ + * $Id: bufmgr.h,v 1.20 1998/06/15 18:40:02 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -117,8 +117,7 @@ extern int ShowPinTrace; */ #define BufferGetBlock(buffer) \ ( \ - (void)AssertMacro(BufferIsValid(buffer)), \ -\ + AssertMacro(BufferIsValid(buffer)), \ BufferIsLocal(buffer) ? \ ((Block) MAKE_PTR(LocalBufferDescriptors[-(buffer) - 1].data)) \ : \ diff --git a/src/include/storage/bufpage.h b/src/include/storage/bufpage.h index c0701fc963d..123192f914f 100644 --- a/src/include/storage/bufpage.h +++ b/src/include/storage/bufpage.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: bufpage.h,v 1.18 1998/04/24 14:43:23 momjian Exp $ + * $Id: bufpage.h,v 1.19 1998/06/15 18:40:02 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -161,8 +161,10 @@ typedef enum * Assumes page is valid. */ #define PageIsUsed(page) \ - (AssertMacro(PageIsValid(page)) ? \ - ((bool) (((PageHeader) (page))->pd_lower != 0)) : false) +( \ + AssertMacro(PageIsValid(page)), \ + ((bool) (((PageHeader) (page))->pd_lower != 0)) \ +) /* * PageIsEmpty -- @@ -243,9 +245,10 @@ typedef enum * Assumes page is locked. */ #define PageGetSpecialPointer(page) \ - (AssertMacro(PageIsValid(page)) ? \ - (char *) ((char *) (page) + ((PageHeader) (page))->pd_special) \ - : (char *)0 ) +( \ + AssertMacro(PageIsValid(page)), \ + (char *) ((char *) (page) + ((PageHeader) (page))->pd_special) \ +) /* * PageGetItem -- @@ -256,9 +259,11 @@ typedef enum * The semantics may change in the future. */ #define PageGetItem(page, itemId) \ - (AssertMacro(PageIsValid(page)) ? \ - AssertMacro((itemId)->lp_flags & LP_USED) ? \ - (Item)(((char *)(page)) + (itemId)->lp_off) : false : false) +( \ + AssertMacro(PageIsValid(page)), \ + AssertMacro((itemId)->lp_flags & LP_USED), \ + (Item)(((char *)(page)) + (itemId)->lp_off) \ +) /* * BufferGetPageSize -- @@ -272,7 +277,10 @@ typedef enum */ /* XXX dig out of buffer descriptor */ #define BufferGetPageSize(buffer) \ - (AssertMacro(BufferIsValid(buffer)) ? (Size)BLCKSZ : false) +( \ + AssertMacro(BufferIsValid(buffer)), \ + (Size)BLCKSZ \ +) /* * BufferGetPage -- diff --git a/src/include/storage/itemid.h b/src/include/storage/itemid.h index 7b683ab68c5..5a3953c32e5 100644 --- a/src/include/storage/itemid.h +++ b/src/include/storage/itemid.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: itemid.h,v 1.5 1998/01/13 04:05:12 scrappy Exp $ + * $Id: itemid.h,v 1.6 1998/06/15 18:40:03 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -70,7 +70,9 @@ typedef struct ItemIdData *ItemId; * Assumes disk item identifier is valid. */ #define ItemIdIsUsed(itemId) \ - (AssertMacro(ItemIdIsValid(itemId)) ? \ - (bool) (((itemId)->lp_flags & LP_USED) != 0) : false) +( \ + AssertMacro(ItemIdIsValid(itemId)), \ + (bool) (((itemId)->lp_flags & LP_USED) != 0) \ +) #endif /* ITEMID_H */ diff --git a/src/include/storage/itemptr.h b/src/include/storage/itemptr.h index 5bac77c9fcc..c6922a093f5 100644 --- a/src/include/storage/itemptr.h +++ b/src/include/storage/itemptr.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: itemptr.h,v 1.7 1997/09/08 21:54:25 momjian Exp $ + * $Id: itemptr.h,v 1.8 1998/06/15 18:40:03 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -48,60 +48,73 @@ typedef ItemPointerData *ItemPointer; * Returns the block number of a disk item pointer. */ #define ItemPointerGetBlockNumber(pointer) \ - (AssertMacro(ItemPointerIsValid(pointer)) ? \ - BlockIdGetBlockNumber(&(pointer)->ip_blkid) : (BlockNumber) 0) +( \ + AssertMacro(ItemPointerIsValid(pointer)), \ + BlockIdGetBlockNumber(&(pointer)->ip_blkid) \ +) /* * ItemPointerGetOffsetNumber -- * Returns the offset number of a disk item pointer. */ #define ItemPointerGetOffsetNumber(pointer) \ - (AssertMacro(ItemPointerIsValid(pointer)) ? \ - (pointer)->ip_posid : \ - InvalidOffsetNumber) +( \ + AssertMacro(ItemPointerIsValid(pointer)), \ + (pointer)->ip_posid \ +) /* * ItemPointerSet -- * Sets a disk item pointer to the specified block and offset. */ #define ItemPointerSet(pointer, blockNumber, offNum) \ - Assert(PointerIsValid(pointer)); \ - BlockIdSet(&((pointer)->ip_blkid), blockNumber); \ - (pointer)->ip_posid = offNum +( \ + AssertMacro(PointerIsValid(pointer)), \ + BlockIdSet(&((pointer)->ip_blkid), blockNumber), \ + (pointer)->ip_posid = offNum \ +) /* * ItemPointerSetBlockNumber -- * Sets a disk item pointer to the specified block. */ #define ItemPointerSetBlockNumber(pointer, blockNumber) \ - Assert(PointerIsValid(pointer)); \ - BlockIdSet(&((pointer)->ip_blkid), blockNumber) +( \ + AssertMacro(PointerIsValid(pointer)), \ + BlockIdSet(&((pointer)->ip_blkid), blockNumber) \ +) /* * ItemPointerSetOffsetNumber -- * Sets a disk item pointer to the specified offset. */ #define ItemPointerSetOffsetNumber(pointer, offsetNumber) \ - AssertMacro(PointerIsValid(pointer)); \ - (pointer)->ip_posid = (offsetNumber) +( \ + AssertMacro(PointerIsValid(pointer)), \ + (pointer)->ip_posid = (offsetNumber) \ +) /* * ItemPointerCopy -- * Copies the contents of one disk item pointer to another. */ #define ItemPointerCopy(fromPointer, toPointer) \ - Assert(PointerIsValid(toPointer)); \ - Assert(PointerIsValid(fromPointer)); \ - *(toPointer) = *(fromPointer) +( \ + AssertMacro(PointerIsValid(toPointer)), \ + AssertMacro(PointerIsValid(fromPointer)), \ + *(toPointer) = *(fromPointer) \ +) /* * ItemPointerSetInvalid -- * Sets a disk item pointer to be invalid. */ #define ItemPointerSetInvalid(pointer) \ - Assert(PointerIsValid(pointer)); \ - BlockIdSet(&((pointer)->ip_blkid), InvalidBlockNumber); \ - (pointer)->ip_posid = InvalidOffsetNumber +( \ + AssertMacro(PointerIsValid(pointer)), \ + BlockIdSet(&((pointer)->ip_blkid), InvalidBlockNumber), \ + (pointer)->ip_posid = InvalidOffsetNumber \ +) /* ---------------- * externs diff --git a/src/include/storage/lock.h b/src/include/storage/lock.h index 0cbca115e9c..05c6a0f4688 100644 --- a/src/include/storage/lock.h +++ b/src/include/storage/lock.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: lock.h,v 1.11 1998/02/26 04:43:28 momjian Exp $ + * $Id: lock.h,v 1.12 1998/06/15 18:40:03 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -191,8 +191,10 @@ typedef struct Lock #define LockGetLock_nHolders(l) l->nHolders #define LockDecrWaitHolders(lock, lockt) \ - lock->nHolding--; \ - lock->holders[lockt]-- +( \ + lock->nHolding--, \ + lock->holders[lockt]-- \ +) #define LockLockTable() SpinAcquire(LockMgrLock); #define UnlockLockTable() SpinRelease(LockMgrLock); diff --git a/src/include/storage/s_lock.h b/src/include/storage/s_lock.h index 2731d1d494a..369a3d8724f 100644 --- a/src/include/storage/s_lock.h +++ b/src/include/storage/s_lock.h @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/include/storage/s_lock.h,v 1.34 1998/05/06 23:25:14 momjian Exp $ + * $Header: /cvsroot/pgsql/src/include/storage/s_lock.h,v 1.35 1998/06/15 18:40:04 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -209,19 +209,22 @@ extern void s_lock(slock_t *lock); #else /* S_LOCK_DEBUG */ -#define S_LOCK(lock) if (1) { \ +#define S_LOCK(lock) \ +do { \ int spins = 0; \ - while (TAS(lock)) { \ + while (TAS(lock)) \ + { \ struct timeval delay; \ delay.tv_sec = 0; \ delay.tv_usec = s_spincycle[spins++ % S_NSPINCYCLE]; \ (void) select(0, NULL, NULL, NULL, &delay); \ - if (spins > S_MAX_BUSY) { \ + if (spins > S_MAX_BUSY) \ + { \ /* It's been well over a minute... */ \ s_lock_stuck(lock, __FILE__, __LINE__); \ } \ } \ -} else +} while(0) #endif /* S_LOCK_DEBUG */ #endif /* S_LOCK */ diff --git a/src/include/utils/exc.h b/src/include/utils/exc.h index 7400f9ce038..809361c639c 100644 --- a/src/include/utils/exc.h +++ b/src/include/utils/exc.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: exc.h,v 1.12 1998/02/26 04:43:59 momjian Exp $ + * $Id: exc.h,v 1.13 1998/06/15 18:40:05 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -47,23 +47,28 @@ typedef struct ExcFrame extern ExcFrame *ExcCurFrameP; -#define ExcBegin() \ - { \ - ExcFrame exception; \ - \ - exception.link = ExcCurFrameP; \ - if (sigsetjmp(exception.context, 1) == 0) { \ - ExcCurFrameP = &exception; \ - { -#define ExcExcept() \ - } \ - ExcCurFrameP = exception.link; \ - } else { \ - { -#define ExcEnd() \ - } \ - } \ - } +/* These are not used anywhere 1998/6/15 */ +#define ExcBegin() \ +do { \ + ExcFrame exception; \ + \ + exception.link = ExcCurFrameP; \ + if (sigsetjmp(exception.context, 1) == 0) \ + { \ + ExcCurFrameP = &exception; + +#define ExcExcept() \ + } \ + ExcCurFrameP = exception.link; \ + } \ + else \ + { \ + { + +#define ExcEnd() \ + } \ + } \ +} while(0) #define raise4(x, t, d, message) \ ExcRaise(&(x), (ExcDetail)(t), (ExcData)(d), (ExcMessage)(message)) |
