Macro redefinition warning after aeb07c55fab5c17a600b77ffcdc3b71425d6a8e7

From: "Tristan Partin" <tristan(at)partin(dot)io>
To: "pgsql-hackers" <pgsql-hackers(at)postgresql(dot)org>
Cc: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Macro redefinition warning after aeb07c55fab5c17a600b77ffcdc3b71425d6a8e7
Date: 2026-07-01 16:32:17
Message-ID: DJNDN9UQS9GP.11L4NJ1HHE1ZJ@partin.io
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

When compiling, I get the following warnings:

[338/2397] Compiling C object src/timezone/zic.p/zic.c.o
In file included from ../src/timezone/zic.c:22:
../src/timezone/private.h:187:9: warning: ‘unreachable’ redefined
187 | #define unreachable() pg_unreachable()
| ^~~~~~~~~~~
In file included from ../src/include/c.h:68,
from ../src/include/postgres_fe.h:28,
from ../src/timezone/zic.c:11:
/nix/store/hkldzpgigap7kkqzdr5j4qqyy5ac4l6x-gcc-16.1.0/lib/gcc/x86_64-unknown-linux-gnu/16.1.0/include/stddef.h:468:9: note: this is the location of the previous definition
468 | #define unreachable() (__builtin_unreachable ())
| ^~~~~~~~~~~
[1218/2397] Compiling C object src/backend/postgres_lib.a.p/.._timezone_strftime.c.o
In file included from ../src/timezone/strftime.c:45:
../src/timezone/private.h:187:9: warning: ‘unreachable’ redefined
187 | #define unreachable() pg_unreachable()
| ^~~~~~~~~~~
In file included from ../src/include/c.h:68,
from ../src/include/postgres.h:48,
from ../src/timezone/strftime.c:41:
/nix/store/hkldzpgigap7kkqzdr5j4qqyy5ac4l6x-gcc-16.1.0/lib/gcc/x86_64-unknown-linux-gnu/16.1.0/include/stddef.h:468:9: note: this is the location of the previous definition
468 | #define unreachable() (__builtin_unreachable ())
| ^~~~~~~~~~~
[1225/2397] Compiling C object src/backend/postgres_lib.a.p/.._timezone_localtime.c.o
In file included from ../src/timezone/localtime.c:24:
../src/timezone/private.h:187:9: warning: ‘unreachable’ redefined
187 | #define unreachable() pg_unreachable()
| ^~~~~~~~~~~
In file included from ../src/include/c.h:68,
from ../src/timezone/localtime.c:17:
/nix/store/hkldzpgigap7kkqzdr5j4qqyy5ac4l6x-gcc-16.1.0/lib/gcc/x86_64-unknown-linux-gnu/16.1.0/include/stddef.h:468:9: note: this is the location of the previous definition
468 | #define unreachable() (__builtin_unreachable ())
| ^~~~~~~~~~~
[1310/2397] Compiling C object src/bin/initdb/initdb.p/.._.._timezone_localtime.c.o
In file included from ../src/timezone/localtime.c:24:
../src/timezone/private.h:187:9: warning: ‘unreachable’ redefined
187 | #define unreachable() pg_unreachable()
| ^~~~~~~~~~~
In file included from ../src/include/c.h:68,
from ../src/timezone/localtime.c:17:
/nix/store/hkldzpgigap7kkqzdr5j4qqyy5ac4l6x-gcc-16.1.0/lib/gcc/x86_64-unknown-linux-gnu/16.1.0/include/stddef.h:468:9: note: this is the location of the previous definition
468 | #define unreachable() (__builtin_unreachable ())
| ^~~~~~~~~~~

The upstream code for private.h's definition of unreachable() looks
quite a bit different than ours[0]. Seems like maybe our defintion was
over simplified. I don't actually know how the code is pulled in.

Attached it a potential solution based on how we protect the
static_assert definition in the same file.

[0]: https://github.com/eggert/tz/blob/e14ee1cb61ca948b45f928ad187eaecc5a92d27e/private.h#L1055-L1069

--
Tristan Partin
PostgreSQL Contributors Team
AWS (https://aws.amazon.com)

Attachment Content-Type Size
unreachable.diff text/x-patch 359 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Haibo Yan 2026-07-01 16:45:14 Re: implement CAST(expr AS type FORMAT 'template')
Previous Message Ashutosh Bapat 2026-07-01 16:21:13 Re: PROPERTY GRAPH pg_dump ACL minimization