mirror of
https://github.com/postgres/postgres.git
synced 2025-11-24 00:23:06 +03:00
Add declaration-level assertions for compile-time checks
Those new assertions can be used at file scope, outside of any function for compilation checks. This commit provides implementations for C and C++, and fallback implementations. Author: Peter Smith Reviewed-by: Andres Freund, Kyotaro Horiguchi, Dagfinn Ilmari Mannsåker, Michael Paquier Discussion: https://postgr.es/m/201DD0641B056142AC8C6645EC1B5F62014B8E8030@SYD1217
This commit is contained in:
@@ -418,6 +418,16 @@ do { \
|
||||
((overwrite) ? PAI_OVERWRITE : 0) | \
|
||||
((is_heap) ? PAI_IS_HEAP : 0))
|
||||
|
||||
/*
|
||||
* Check that BLCKSZ is a multiple of sizeof(size_t). In PageIsVerified(),
|
||||
* it is much faster to check if a page is full of zeroes using the native
|
||||
* word size. Note that this assertion is kept within a header to make
|
||||
* sure that StaticAssertDecl() works across various combinations of
|
||||
* platforms and compilers.
|
||||
*/
|
||||
StaticAssertDecl(BLCKSZ == ((BLCKSZ / sizeof(size_t)) * sizeof(size_t)),
|
||||
"BLCKSZ has to be a multiple of sizeof(size_t)");
|
||||
|
||||
extern void PageInit(Page page, Size pageSize, Size specialSize);
|
||||
extern bool PageIsVerified(Page page, BlockNumber blkno);
|
||||
extern OffsetNumber PageAddItemExtended(Page page, Item item, Size size,
|
||||
|
||||
Reference in New Issue
Block a user