mirror of
https://github.com/postgres/postgres.git
synced 2025-09-11 00:12:06 +03:00
Swap order of extern/static and pg_nodiscard
When pg_nodiscard was first added, the C standard draft had it as a function specifier, and so the code comment about placement was written with that in mind. The final C23 standard has it as an attribute and the placement rules are a bit different for that. Specifically, it needs to be before extern or static. (Or at least both current clang and gcc require that.) So just swap these. (To be clear: The current implementation with gcc attributes doesn't care. This change is just for maximum forward compatibility for non-gcc compilers.) This also keeps the order consistent with the previously introduced pg_noreturn. Also update the code comment to reflect the mentioned developments since its introduction. Reviewed-by: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org> Reviewed-by: Andres Freund <andres@anarazel.de> Discussion: https://www.postgresql.org/message-id/flat/pxr5b3z7jmkpenssra5zroxi7qzzp6eswuggokw64axmdixpnk@zbwxuq7gbbcw
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user