From c72d50b0374246da3927a02a2d91938cb442b157 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Sat, 28 Dec 2024 11:00:24 +0100 Subject: [PATCH 3/4] Swap order of extern/static and pg_nodiscard Clang in C23 mode requires all attributes to be before extern or static. So just swap these. This also keeps the order consistent with the previously introduced pg_noreturn. --- src/include/nodes/pg_list.h | 68 +++++++++++++++++------------------ src/include/storage/buffile.h | 2 +- src/include/utils/guc.h | 2 +- src/include/utils/palloc.h | 8 ++--- 4 files changed, 40 insertions(+), 40 deletions(-) diff --git a/src/include/nodes/pg_list.h b/src/include/nodes/pg_list.h index d131350e107..293981b2742 100644 --- a/src/include/nodes/pg_list.h +++ b/src/include/nodes/pg_list.h @@ -608,23 +608,23 @@ extern List *list_make5_impl(NodeTag t, ListCell datum1, ListCell datum2, ListCell datum3, ListCell datum4, ListCell datum5); -extern pg_nodiscard List *lappend(List *list, void *datum); -extern pg_nodiscard List *lappend_int(List *list, int datum); -extern pg_nodiscard List *lappend_oid(List *list, Oid datum); -extern pg_nodiscard List *lappend_xid(List *list, TransactionId datum); +pg_nodiscard extern List *lappend(List *list, void *datum); +pg_nodiscard extern List *lappend_int(List *list, int datum); +pg_nodiscard extern List *lappend_oid(List *list, Oid datum); +pg_nodiscard extern List *lappend_xid(List *list, TransactionId datum); -extern pg_nodiscard List *list_insert_nth(List *list, int pos, void *datum); -extern pg_nodiscard List *list_insert_nth_int(List *list, int pos, int datum); -extern pg_nodiscard List *list_insert_nth_oid(List *list, int pos, Oid datum); +pg_nodiscard extern List *list_insert_nth(List *list, int pos, void *datum); +pg_nodiscard extern List *list_insert_nth_int(List *list, int pos, int datum); +pg_nodiscard extern List *list_insert_nth_oid(List *list, int pos, Oid datum); -extern pg_nodiscard List *lcons(void *datum, List *list); -extern pg_nodiscard List *lcons_int(int datum, List *list); -extern pg_nodiscard List *lcons_oid(Oid datum, List *list); +pg_nodiscard extern List *lcons(void *datum, List *list); +pg_nodiscard extern List *lcons_int(int datum, List *list); +pg_nodiscard extern List *lcons_oid(Oid datum, List *list); -extern pg_nodiscard List *list_concat(List *list1, const List *list2); -extern pg_nodiscard List *list_concat_copy(const List *list1, const List *list2); +pg_nodiscard extern List *list_concat(List *list1, const List *list2); +pg_nodiscard extern List *list_concat_copy(const List *list1, const List *list2); -extern pg_nodiscard List *list_truncate(List *list, int new_size); +pg_nodiscard extern List *list_truncate(List *list, int new_size); extern bool list_member(const List *list, const void *datum); extern bool list_member_ptr(const List *list, const void *datum); @@ -632,15 +632,15 @@ extern bool list_member_int(const List *list, int datum); extern bool list_member_oid(const List *list, Oid datum); extern bool list_member_xid(const List *list, TransactionId datum); -extern pg_nodiscard List *list_delete(List *list, void *datum); -extern pg_nodiscard List *list_delete_ptr(List *list, void *datum); -extern pg_nodiscard List *list_delete_int(List *list, int datum); -extern pg_nodiscard List *list_delete_oid(List *list, Oid datum); -extern pg_nodiscard List *list_delete_first(List *list); -extern pg_nodiscard List *list_delete_last(List *list); -extern pg_nodiscard List *list_delete_first_n(List *list, int n); -extern pg_nodiscard List *list_delete_nth_cell(List *list, int n); -extern pg_nodiscard List *list_delete_cell(List *list, ListCell *cell); +pg_nodiscard extern List *list_delete(List *list, void *datum); +pg_nodiscard extern List *list_delete_ptr(List *list, void *datum); +pg_nodiscard extern List *list_delete_int(List *list, int datum); +pg_nodiscard extern List *list_delete_oid(List *list, Oid datum); +pg_nodiscard extern List *list_delete_first(List *list); +pg_nodiscard extern List *list_delete_last(List *list); +pg_nodiscard extern List *list_delete_first_n(List *list, int n); +pg_nodiscard extern List *list_delete_nth_cell(List *list, int n); +pg_nodiscard extern List *list_delete_cell(List *list, ListCell *cell); extern List *list_union(const List *list1, const List *list2); extern List *list_union_ptr(const List *list1, const List *list2); @@ -657,25 +657,25 @@ extern List *list_difference_ptr(const List *list1, const List *list2); extern List *list_difference_int(const List *list1, const List *list2); extern List *list_difference_oid(const List *list1, const List *list2); -extern pg_nodiscard List *list_append_unique(List *list, void *datum); -extern pg_nodiscard List *list_append_unique_ptr(List *list, void *datum); -extern pg_nodiscard List *list_append_unique_int(List *list, int datum); -extern pg_nodiscard List *list_append_unique_oid(List *list, Oid datum); +pg_nodiscard extern List *list_append_unique(List *list, void *datum); +pg_nodiscard extern List *list_append_unique_ptr(List *list, void *datum); +pg_nodiscard extern List *list_append_unique_int(List *list, int datum); +pg_nodiscard extern List *list_append_unique_oid(List *list, Oid datum); -extern pg_nodiscard List *list_concat_unique(List *list1, const List *list2); -extern pg_nodiscard List *list_concat_unique_ptr(List *list1, const List *list2); -extern pg_nodiscard List *list_concat_unique_int(List *list1, const List *list2); -extern pg_nodiscard List *list_concat_unique_oid(List *list1, const List *list2); +pg_nodiscard extern List *list_concat_unique(List *list1, const List *list2); +pg_nodiscard extern List *list_concat_unique_ptr(List *list1, const List *list2); +pg_nodiscard extern List *list_concat_unique_int(List *list1, const List *list2); +pg_nodiscard extern List *list_concat_unique_oid(List *list1, const List *list2); extern void list_deduplicate_oid(List *list); extern void list_free(List *list); extern void list_free_deep(List *list); -extern pg_nodiscard List *list_copy(const List *oldlist); -extern pg_nodiscard List *list_copy_head(const List *oldlist, int len); -extern pg_nodiscard List *list_copy_tail(const List *oldlist, int nskip); -extern pg_nodiscard List *list_copy_deep(const List *oldlist); +pg_nodiscard extern List *list_copy(const List *oldlist); +pg_nodiscard extern List *list_copy_head(const List *oldlist, int len); +pg_nodiscard extern List *list_copy_tail(const List *oldlist, int nskip); +pg_nodiscard extern List *list_copy_deep(const List *oldlist); typedef int (*list_sort_comparator) (const ListCell *a, const ListCell *b); extern void list_sort(List *list, list_sort_comparator cmp); diff --git a/src/include/storage/buffile.h b/src/include/storage/buffile.h index 5f6d7c8e3ff..19356dc779b 100644 --- a/src/include/storage/buffile.h +++ b/src/include/storage/buffile.h @@ -38,7 +38,7 @@ typedef struct BufFile BufFile; extern BufFile *BufFileCreateTemp(bool interXact); extern void BufFileClose(BufFile *file); -extern pg_nodiscard size_t BufFileRead(BufFile *file, void *ptr, size_t size); +pg_nodiscard extern size_t BufFileRead(BufFile *file, void *ptr, size_t size); extern void BufFileReadExact(BufFile *file, void *ptr, size_t size); extern size_t BufFileReadMaybeEOF(BufFile *file, void *ptr, size_t size, bool eofOK); extern void BufFileWrite(BufFile *file, const void *ptr, size_t size); diff --git a/src/include/utils/guc.h b/src/include/utils/guc.h index 840b0fe57ff..4c56f487806 100644 --- a/src/include/utils/guc.h +++ b/src/include/utils/guc.h @@ -440,7 +440,7 @@ extern ArrayType *GUCArrayDelete(ArrayType *array, const char *name); extern ArrayType *GUCArrayReset(ArrayType *array); extern void *guc_malloc(int elevel, size_t size); -extern pg_nodiscard void *guc_realloc(int elevel, void *old, size_t size); +pg_nodiscard extern void *guc_realloc(int elevel, void *old, size_t size); extern char *guc_strdup(int elevel, const char *src); extern void guc_free(void *ptr); diff --git a/src/include/utils/palloc.h b/src/include/utils/palloc.h index 773a5d2c347..94024b48065 100644 --- a/src/include/utils/palloc.h +++ b/src/include/utils/palloc.h @@ -79,10 +79,10 @@ extern void *palloc(Size size); extern void *palloc0(Size size); extern void *palloc_extended(Size size, int flags); extern void *palloc_aligned(Size size, Size alignto, int flags); -extern pg_nodiscard void *repalloc(void *pointer, Size size); -extern pg_nodiscard void *repalloc_extended(void *pointer, +pg_nodiscard extern void *repalloc(void *pointer, Size size); +pg_nodiscard extern void *repalloc_extended(void *pointer, Size size, int flags); -extern pg_nodiscard void *repalloc0(void *pointer, Size oldsize, Size size); +pg_nodiscard extern void *repalloc0(void *pointer, Size oldsize, Size size); extern void pfree(void *pointer); /* @@ -110,7 +110,7 @@ extern void pfree(void *pointer); /* Higher-limit allocators. */ extern void *MemoryContextAllocHuge(MemoryContext context, Size size); -extern pg_nodiscard void *repalloc_huge(void *pointer, Size size); +pg_nodiscard extern void *repalloc_huge(void *pointer, Size size); /* * Although this header file is nominally backend-only, certain frontend -- 2.47.1