public inbox for [email protected]
help / color / mirror / Atom feedFrom: Peter Eisentraut <[email protected]>
To: [email protected]
Subject: pgsql: pg_noreturn to replace pg_attribute_noreturn()
Date: Thu, 13 Mar 2025 11:47:13 +0000
Message-ID: <[email protected]> (raw)
pg_noreturn to replace pg_attribute_noreturn()
We want to support a "noreturn" decoration on more compilers besides
just GCC-compatible ones, but for that we need to move the decoration
in front of the function declaration instead of either behind it or
wherever, which is the current style afforded by GCC-style attributes.
Also rename the macro to "pg_noreturn" to be similar to the C11
standard "noreturn".
pg_noreturn is now supported on all compilers that support C11 (using
_Noreturn), as well as GCC-compatible ones (using __attribute__, as
before), as well as MSVC (using __declspec). (When PostgreSQL
requires C11, the latter two variants can be dropped.)
Now, all supported compilers effectively support pg_noreturn, so the
extra code for !HAVE_PG_ATTRIBUTE_NORETURN can be dropped.
This also fixes a possible problem if third-party code includes
stdnoreturn.h, because then the current definition of
#define pg_attribute_noreturn() __attribute__((noreturn))
would cause an error.
Note that the C standard does not support a noreturn attribute on
function pointer types. So we have to drop these here. There are
only two instances at this time, so it's not a big loss. In one case,
we can make up for it by adding the pg_noreturn to a wrapper function
and adding a pg_unreachable(), in the other case, the latter was
already done before.
Reviewed-by: Dagfinn Ilmari Mannsåker <[email protected]>
Reviewed-by: Andres Freund <[email protected]>
Discussion: https://www.postgresql.org/message-id/flat/pxr5b3z7jmkpenssra5zroxi7qzzp6eswuggokw64axmdixpnk@zbwxuq...
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/3691edfab97187789b8a1cbb9dce4acf0ecd8f5a
Modified Files
--------------
contrib/dblink/dblink.c | 6 ++---
contrib/pgcrypto/px.h | 2 +-
src/backend/access/transam/xlogrecovery.c | 3 +--
src/backend/backup/basebackup_incremental.c | 6 ++---
src/backend/postmaster/autovacuum.c | 2 +-
src/backend/postmaster/launch_backend.c | 2 +-
src/backend/postmaster/postmaster.c | 2 +-
src/backend/replication/logical/tablesync.c | 3 +--
src/backend/replication/walsender.c | 2 +-
src/backend/utils/adt/ri_triggers.c | 8 +++---
src/backend/utils/fmgr/dfmgr.c | 4 +--
src/backend/utils/hash/dynahash.c | 2 +-
src/backend/utils/mmgr/slab.c | 2 +-
src/bin/pg_combinebackup/load_manifest.c | 6 ++---
src/bin/pg_dump/pg_backup_utils.h | 2 +-
src/bin/pg_upgrade/pg_upgrade.h | 2 +-
src/bin/pg_verifybackup/pg_verifybackup.c | 6 ++---
src/bin/pg_verifybackup/pg_verifybackup.h | 4 +--
src/bin/pgbench/pgbench.h | 12 ++++-----
src/common/parse_manifest.c | 5 ++--
src/include/bootstrap/bootstrap.h | 4 +--
src/include/c.h | 34 +++++++++++++++++-------
src/include/commands/defrem.h | 2 +-
src/include/common/parse_manifest.h | 3 +--
src/include/mb/pg_wchar.h | 6 ++---
src/include/parser/parse_relation.h | 6 ++---
src/include/parser/scanner.h | 2 +-
src/include/postmaster/autovacuum.h | 4 +--
src/include/postmaster/bgworker_internals.h | 2 +-
src/include/postmaster/bgwriter.h | 4 +--
src/include/postmaster/pgarch.h | 2 +-
src/include/postmaster/postmaster.h | 4 +--
src/include/postmaster/startup.h | 2 +-
src/include/postmaster/syslogger.h | 2 +-
src/include/postmaster/walsummarizer.h | 2 +-
src/include/postmaster/walwriter.h | 2 +-
src/include/replication/slotsync.h | 2 +-
src/include/replication/walreceiver.h | 2 +-
src/include/replication/walsender_private.h | 2 +-
src/include/storage/ipc.h | 2 +-
src/include/storage/lock.h | 2 +-
src/include/tcop/backend_startup.h | 2 +-
src/include/tcop/tcopprot.h | 12 ++++-----
src/include/utils/elog.h | 13 ++-------
src/include/utils/float.h | 6 ++---
src/include/utils/help_config.h | 2 +-
src/include/utils/memutils_internal.h | 4 +--
src/interfaces/ecpg/preproc/preproc_extern.h | 2 +-
src/pl/plpgsql/src/plpgsql.h | 2 +-
src/test/modules/libpq_pipeline/libpq_pipeline.c | 5 ++--
src/test/modules/test_shm_mq/test_shm_mq.h | 2 +-
src/test/modules/worker_spi/worker_spi.c | 2 +-
src/timezone/zic.c | 4 +--
src/tools/pg_bsd_indent/err.h | 8 +++---
54 files changed, 118 insertions(+), 118 deletions(-)
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected]
Subject: Re: pgsql: pg_noreturn to replace pg_attribute_noreturn()
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox