Use standard C23 and C++ attributes if available

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Use standard C23 and C++ attributes if available
Date: 2026-02-19 08:54:30
Message-ID: a7e4ad20-57d9-4dfb-bdac-6e4246251d02@eisentraut.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

This is related to the C++ compatibility work in [0].

This patch proposes to use the standard C23 and C++ attributes
[[nodiscard]], [[noreturn]], and [[maybe_unused]], if available.

The immediate practical impact is that for pg_noreturn, we can drop the
GCC-specific and MSVC-specific fallbacks, because the C11 and the C++
implementation will now cover all required cases.

For the other two attributes, this makes them available in
not-GCC-compatible compilers that support C23 as well as in C++. This
set is theoretical at the moment, but it might become more practical if
either MSVC gets some C23 support or we improve the support for C++
extensions with MSVC (see also [0]).

[0]:
https://www.postgresql.org/message-id/df78eaac-c2eb-4344-852e-0965c75c5ad6%40eisentraut.org

Attachment Content-Type Size
0001-Use-standard-C23-and-C-attributes-if-available.patch text/plain 5.5 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Nazir Bilal Yavuz 2026-02-19 09:01:02 Re: Speed up COPY FROM text/CSV parsing using SIMD
Previous Message Ashutosh Bapat 2026-02-19 08:48:22 Re: some validate_relation_kind() tidying