Revert "Replace pg_restrict by standard restrict"
authorPeter Eisentraut <peter@eisentraut.org>
Wed, 14 Jan 2026 14:12:25 +0000 (15:12 +0100)
committerPeter Eisentraut <peter@eisentraut.org>
Wed, 14 Jan 2026 14:12:25 +0000 (15:12 +0100)
commitfa16e7fd84886643f480c36614fa11d45fc6d26f
tree11441c47a979133619937530175e3e3f41b16484
parent794ba8b6a4c8ce409a37e84444c9519f7f1e5385
Revert "Replace pg_restrict by standard restrict"

This reverts commit f0f2c0c1aef95757c4e7f144d5577e2b0d814279.

The original problem that led to the use of pg_restrict was that MSVC
couldn't handle plain restrict, and defining it to something else
would conflict with its __declspec(restrict) that is used in system
header files.  In C11 mode, this is no longer a problem, as MSVC
handles plain restrict.  This led to the commit to replace pg_restrict
with restrict.  But this did not take C++ into account.  Standard C++
does not have restrict, so we defined it as something else (for
example, MSVC supports __restrict).  But this then again conflicts
with __declspec(restrict) in system header files.  So we have to
revert this attempt.  The comments are updated to clarify that the
reason for this is now C++ only.

Reported-by: Jelte Fennema-Nio <postgres@jeltef.nl>
Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://www.postgresql.org/message-id/CAGECzQRoD7chJP1-dneSrhxUJv%2BBRcigoGOO4UwGzaShLot2Yw%40mail.gmail.com
12 files changed:
configure
configure.ac
meson.build
src/bin/pg_verifybackup/pg_verifybackup.c
src/bin/pg_verifybackup/pg_verifybackup.h
src/common/logging.c
src/common/string.c
src/include/c.h
src/include/common/logging.h
src/include/common/string.h
src/include/libpq/pqformat.h
src/include/pg_config.h.in