Use standard C23 and C++ attributes if available
Peter Eisentraut <peter@eisentraut.org>
Author:
Peter Eisentraut <peter@eisentraut.org>
Date: 2026-04-01T06:15:02Z
Releases:
19 (unreleased)
Use standard C23 and C++ attributes if available Use the standard C23 and C++ attributes [[nodiscard]], [[noreturn]], and [[maybe_unused]], if available. This makes pg_nodiscard and pg_attribute_unused() available in not-GCC-compatible compilers that support C23 as well as in C++. For pg_noreturn, we can now drop the GCC-specific and MSVC-specific fallbacks, because the C11 and the C++ implementation will now cover all required cases. Note, in a few places, we need to change the position of the attribute because it's not valid in that place in C23. Discussion: https://www.postgresql.org/message-id/flat/pxr5b3z7jmkpenssra5zroxi7qzzp6eswuggokw64axmdixpnk@zbwxuq7gbbcw
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/utils/mmgr/slab.c | modified | +1 −1 |
| src/include/c.h | modified | +22 −16 |
| src/include/lib/radixtree.h | modified | +1 −1 |
| src/test/modules/worker_spi/worker_spi.c | modified | +1 −1 |
Discussion
- pg_attribute_noreturn(), MSVC, C11 17 messages · 2024-12-13 → 2025-03-14