Swap order of extern/static and pg_nodiscard
Peter Eisentraut <peter@eisentraut.org>
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
Files
| Path | Change | +/− |
|---|---|---|
| src/include/c.h | modified | +3 −3 |
| src/include/common/base64.h | modified | +2 −2 |
| src/include/nodes/pg_list.h | modified | +34 −34 |
| src/include/storage/buffile.h | modified | +1 −1 |
| src/include/utils/guc.h | modified | +1 −1 |
| src/include/utils/palloc.h | modified | +4 −4 |
Discussion
- pg_attribute_noreturn(), MSVC, C11 17 messages · 2024-12-13 → 2025-03-14