Macro redefinition warning after aeb07c55fab5c17a600b77ffcdc3b71425d6a8e7
Tristan Partin <tristan@partin.io>
From: "Tristan Partin" <tristan@partin.io>
To: "pgsql-hackers" <pgsql-hackers@postgresql.org>
Cc: "Tom Lane" <tgl@sss.pgh.pa.us>
Date: 2026-07-01T16:32:17Z
Lists: pgsql-hackers
Attachments
- unreachable.diff (text/x-patch) patch
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)
Commits
-
Fix macro-redefinition warning introduced by aeb07c55f.
- 85656c1bef4a master landed