Hi all, The following functions in ilist.h and bufpage.h use some arguments only in assertions: - dlist_next_node - dlist_prev_node - slist_has_next - slist_next_node - PageValidateSpecialPointer
Without PG_USED_FOR_ASSERTS_ONLY, this can lead to compilation warnings when not using assertions, and one example of that is plpgsql_check. We don't have examples on HEAD where PG_USED_FOR_ASSERTS_ONLY is used on arguments, but that looks to work properly with gcc. Thoughts? -- Michael
diff --git a/src/include/lib/ilist.h b/src/include/lib/ilist.h
index aa196428ed..0c5e1d375f 100644
--- a/src/include/lib/ilist.h
+++ b/src/include/lib/ilist.h
@@ -418,7 +418,8 @@ dlist_has_prev(dlist_head *head, dlist_node *node)
* Return the next node in the list (there must be one).
*/
static inline dlist_node *
-dlist_next_node(dlist_head *head, dlist_node *node)
+dlist_next_node(dlist_head *head PG_USED_FOR_ASSERTS_ONLY,
+ dlist_node *node)
{
Assert(dlist_has_next(head, node));
return node->next;
@@ -428,7 +429,8 @@ dlist_next_node(dlist_head *head, dlist_node *node)
* Return previous node in the list (there must be one).
*/
static inline dlist_node *
-dlist_prev_node(dlist_head *head, dlist_node *node)
+dlist_prev_node(dlist_head *head PG_USED_FOR_ASSERTS_ONLY,
+ dlist_node *node)
{
Assert(dlist_has_prev(head, node));
return node->prev;
@@ -608,7 +610,8 @@ slist_pop_head_node(slist_head *head)
* Check whether 'node' has a following node.
*/
static inline bool
-slist_has_next(slist_head *head, slist_node *node)
+slist_has_next(slist_head *head PG_USED_FOR_ASSERTS_ONLY,
+ slist_node *node)
{
slist_check(head);
@@ -619,7 +622,8 @@ slist_has_next(slist_head *head, slist_node *node)
* Return the next node in the list (there must be one).
*/
static inline slist_node *
-slist_next_node(slist_head *head, slist_node *node)
+slist_next_node(slist_head *head PG_USED_FOR_ASSERTS_ONLY,
+ slist_node *node)
{
Assert(slist_has_next(head, node));
return node->next;
diff --git a/src/include/storage/bufpage.h b/src/include/storage/bufpage.h
index 359b749f7f..85414a53d6 100644
--- a/src/include/storage/bufpage.h
+++ b/src/include/storage/bufpage.h
@@ -310,7 +310,7 @@ typedef PageHeaderData *PageHeader;
* specifics from the macro failure within this function.
*/
static inline bool
-PageValidateSpecialPointer(Page page)
+PageValidateSpecialPointer(Page page PG_USED_FOR_ASSERTS_ONLY)
{
Assert(PageIsValid(page));
Assert(((PageHeader) (page))->pd_special <= BLCKSZ);
signature.asc
Description: PGP signature
