diff options
author | Peter Eisentraut | 2025-03-14 06:18:07 +0000 |
---|---|---|
committer | Peter Eisentraut | 2025-03-14 06:18:07 +0000 |
commit | 05cbd6cb22d235d2e52ac309266a5fc50053dc16 (patch) | |
tree | b38252b6531fdbc0219443cdd92f40dea6ce10a8 /src/include/utils/guc.h | |
parent | 01261fb07888642efa98ba8d4117654bfd2a413d (diff) |
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 <[email protected]>
Reviewed-by: Andres Freund <[email protected]>
Discussion: https://www.postgresql.org/message-id/flat/pxr5b3z7jmkpenssra5zroxi7qzzp6eswuggokw64axmdixpnk@zbwxuq7gbbcw
Diffstat (limited to 'src/include/utils/guc.h')
-rw-r--r-- | src/include/utils/guc.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/include/utils/guc.h b/src/include/utils/guc.h index 1233e07d7da..24444cbc365 100644 --- a/src/include/utils/guc.h +++ b/src/include/utils/guc.h @@ -444,7 +444,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); |