Thread

Commits

  1. Fix macro-redefinition warning introduced by aeb07c55f.

  1. Macro redefinition warning after aeb07c55fab5c17a600b77ffcdc3b71425d6a8e7

    Tristan Partin <tristan@partin.io> — 2026-07-01T16:32:17Z

    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)
    
  2. Re: Macro redefinition warning after aeb07c55fab5c17a600b77ffcdc3b71425d6a8e7

    Masahiko Sawada <sawada.mshk@gmail.com> — 2026-07-01T17:30:30Z

    On Wed, Jul 1, 2026 at 9:32 AM Tristan Partin <tristan@partin.io> wrote:
    >
    > When compiling, I get the following warnings:
    
    FYI I got the same warnings (Fedora 43, gcc 1.2.1).
    
    Regards,
    
    -- 
    Masahiko Sawada
    Amazon Web Services: https://aws.amazon.com
    
    
    
    
  3. Re: Macro redefinition warning after aeb07c55fab5c17a600b77ffcdc3b71425d6a8e7

    Tom Lane <tgl@sss.pgh.pa.us> — 2026-07-01T17:32:57Z

    "Tristan Partin" <tristan@partin.io> writes:
    > 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()
    > 	      |         ^~~~~~~~~~~
    
    Thanks for the report.
    
    > The upstream code for private.h's definition of unreachable() looks 
    > quite a bit different than ours[0].
    
    Yeah.  I intentionally used our version rather than hoping that
    theirs would work in our environment.  I still think that's the
    right way, so I'm inclined to fix this by throwing in an "#undef".
    
    			regards, tom lane