Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 56dffb5

Browse files
committed
Turn special page pointer validation to static inline function
Inclusion of multiple macros inside another macro was pushing MSVC past its size liimit. Reported by buildfarm.
1 parent 1ff3f42 commit 56dffb5

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

src/include/storage/bufpage.h

+20-3
Original file line numberDiff line numberDiff line change
@@ -297,15 +297,32 @@ typedef PageHeaderData *PageHeader;
297297
#define PageGetSpecialSize(page) \
298298
((uint16) (PageGetPageSize(page) - ((PageHeader)(page))->pd_special))
299299

300+
/*
301+
* Using assertions, validate that the page special pointer is OK.
302+
*
303+
* This is intended to catch use of the pointer before page initialization.
304+
* It is implemented as a function do to the limitations of the MSVC compiler,
305+
* which choked on doing all these tests within another macro. We return true
306+
* so that MacroAssert() can be used while still getting the specifics from
307+
* the macro failure within this function.
308+
*/
309+
static inline bool
310+
PageValidateSpecialPointer(Page page)
311+
{
312+
Assert(PageIsValid(page));
313+
Assert(((PageHeader) (page))->pd_special <= BLCKSZ);
314+
Assert(((PageHeader) (page))->pd_special >= SizeOfPageHeaderData);
315+
316+
return true;
317+
}
318+
300319
/*
301320
* PageGetSpecialPointer
302321
* Returns pointer to special space on a page.
303322
*/
304323
#define PageGetSpecialPointer(page) \
305324
( \
306-
AssertMacro(PageIsValid(page)), \
307-
AssertMacro(((PageHeader) (page))->pd_special <= BLCKSZ), \
308-
AssertMacro(((PageHeader) (page))->pd_special >= SizeOfPageHeaderData), \
325+
AssertMacro(PageValidateSpecialPointer(page)), \
309326
(char *) ((char *) (page) + ((PageHeader) (page))->pd_special) \
310327
)
311328

0 commit comments

Comments
 (0)