Re: 17f446784d54da827f74c2acc0fa772a41b92354 breaks orafce build - Mailing list pgsql-hackers

From Japin Li
Subject Re: 17f446784d54da827f74c2acc0fa772a41b92354 breaks orafce build
Date
Msg-id MEAPR01MB3031E75F7626B8E8580A2090B6B0A@MEAPR01MB3031.ausprd01.prod.outlook.com
Whole thread Raw
In response to 17f446784d54da827f74c2acc0fa772a41b92354 breaks orafce build  (Pavel Stehule <pavel.stehule@gmail.com>)
Responses Re: 17f446784d54da827f74c2acc0fa772a41b92354 breaks orafce build
List pgsql-hackers
On Fri, 26 Dec 2025 at 09:12, Pavel Stehule <pavel.stehule@gmail.com> wrote:
> Hi
>
> I tried to build Orafce against the master without success. After some searching I found so patch 
>
> commit 17f446784d54da827f74c2acc0fa772a41b92354 -- fail
> Author: Peter Eisentraut <peter@eisentraut.org>
> Date:   Mon Dec 15 11:43:11 2025
>
>     Refactor static_assert() support.
>
> does it.
>
> It fails with strange errors
>
> /usr/local/pgsql/master/include/server/storage/lwlock.h:64:18: error: expected parameter declarator
>    64 | StaticAssertDecl(sizeof(LWLock) <= LWLOCK_PADDED_SIZE,
>       |                  ^
> /usr/local/pgsql/master/include/server/storage/lwlock.h:64:18: error: expected ')'
> /usr/local/pgsql/master/include/server/storage/lwlock.h:64:1: note: to match this '('
>    64 | StaticAssertDecl(sizeof(LWLock) <= LWLOCK_PADDED_SIZE,
>       | ^
> /usr/local/pgsql/master/include/server/c.h:941:15: note: expanded from macro 'StaticAssertDecl'
>   941 |         static_assert(condition, errmessage)
>       |                      ^
> In file included from orafce.c:2:
> /usr/local/pgsql/master/include/server/storage/lwlock.h:64:1: error: type specifier missing, defaults to 'int'; ISO
C99
> and later do not support implicit int [-Wimplicit-int]
>    64 | StaticAssertDecl(sizeof(LWLock) <= LWLOCK_PADDED_SIZE,
>       | ^
>       | int
> /usr/local/pgsql/master/include/server/c.h:941:2: note: expanded from macro 'StaticAssertDecl'
>   941 |         static_assert(condition, errmessage)
>       |         ^
> In file included from orafce.c:4:
> In file included from /usr/local/pgsql/master/include/server/utils/guc.h:17:
> In file included from /usr/local/pgsql/master/include/server/utils/array.h:64:
> /usr/local/pgsql/master/include/server/fmgr.h:508:18: error: expected parameter declarator
>   508 | StaticAssertDecl(sizeof(FMGR_ABI_EXTRA) <= sizeof(((Pg_abi_values *) 0)->abi_extra),
>       |                  ^
> /usr/local/pgsql/master/include/server/fmgr.h:508:18: error: expected ')'
> /usr/local/pgsql/master/include/server/fmgr.h:508:1: note: to match this '('
>   508 | StaticAssertDecl(sizeof(FMGR_ABI_EXTRA) <= sizeof(((Pg_abi_values *) 0)->abi_extra),
>       | ^
> /usr/local/pgsql/master/include/server/c.h:941:15: note: expanded from macro 'StaticAssertDecl'
>   941 |         static_assert(condition, errmessage)
>       |                      ^
> In file included from orafce.c:4:
> In file included from /usr/local/pgsql/master/include/server/utils/guc.h:17:
> In file included from /usr/local/pgsql/master/include/server/utils/array.h:64:
> /usr/local/pgsql/master/include/server/fmgr.h:508:1: error: type specifier missing, defaults to 'int'; ISO C99 and
later
> do not support implicit int [-Wimplicit-int]
>   508 | StaticAssertDecl(sizeof(FMGR_ABI_EXTRA) <= sizeof(((Pg_abi_values *) 0)->abi_extra),
>       | ^
>       | int
> /usr/local/pgsql/master/include/server/c.h:941:2: note: expanded from macro 'StaticAssertDecl'
>   941 |         static_assert(condition, errmessage)
>       |         ^
> 6 errors generated.
> make: *** [/usr/local/pgsql/master/lib/pgxs/src/makefiles/../../src/Makefile.global:1101: orafce.bc] Chyba 1
> /usr/lib64/ccache/clang -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -fexcess-precision=standard -
> Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -Wno-format-truncation -O2  -I. -I./ -
> I/usr/local/pgsql/master/include/server -I/usr/local/pgsql/master/include/internal -D_GNU_SOURCE
-I/usr/include/libxml2-
 
> DWITH_GZFILEOP    -flto=thin -emit-llvm -c -o orafce.bc orafce.c
> In file included from orafce.c:2:
> /usr/local/pgsql/master/include/server/storage/lwlock.h:64:18: error: expected parameter declarator
>    64 | StaticAssertDecl(sizeof(LWLock) <= LWLOCK_PADDED_SIZE,
>       |                  ^
> /usr/local/pgsql/master/include/server/storage/lwlock.h:64:18: error: expected ')'
> /usr/local/pgsql/master/include/server/storage/lwlock.h:64:1: note: to match this '('
>    64 | StaticAssertDecl(sizeof(LWLock) <= LWLOCK_PADDED_SIZE,
>       | ^
> /usr/local/pgsql/master/include/server/c.h:941:15: note: expanded from macro 'StaticAssertDecl'
>   941 |         static_assert(condition, errmessage)
>       |                      ^
> In file included from orafce.c:2:
> /usr/local/pgsql/master/include/server/storage/lwlock.h:64:1: error: type specifier missing, defaults to 'int'; ISO
C99
> and later do not support implicit int [-Wimplicit-int]
>    64 | StaticAssertDecl(sizeof(LWLock) <= LWLOCK_PADDED_SIZE,
>       | ^
>       | int
> /usr/local/pgsql/master/include/server/c.h:941:2: note: expanded from macro 'StaticAssertDecl'
>   941 |         static_assert(condition, errmessage)
>       |         ^
> In file included from orafce.c:4:
> In file included from /usr/local/pgsql/master/include/server/utils/guc.h:17:
> In file included from /usr/local/pgsql/master/include/server/utils/array.h:64:
> /usr/local/pgsql/master/include/server/fmgr.h:508:18: error: expected parameter declarator
>   508 | StaticAssertDecl(sizeof(FMGR_ABI_EXTRA) <= sizeof(((Pg_abi_values *) 0)->abi_extra),
>       |                  ^
> /usr/local/pgsql/master/include/server/fmgr.h:508:18: error: expected ')'
> /usr/local/pgsql/master/include/server/fmgr.h:508:1: note: to match this '('
>   508 | StaticAssertDecl(sizeof(FMGR_ABI_EXTRA) <= sizeof(((Pg_abi_values *) 0)->abi_extra),
>       | ^
> /usr/local/pgsql/master/include/server/c.h:941:15: note: expanded from macro 'StaticAssertDecl'
>   941 |         static_assert(condition, errmessage)
>       |                      ^
> In file included from orafce.c:4:
> In file included from /usr/local/pgsql/master/include/server/utils/guc.h:17:
> In file included from /usr/local/pgsql/master/include/server/utils/array.h:64:
> /usr/local/pgsql/master/include/server/fmgr.h:508:1: error: type specifier missing, defaults to 'int'; ISO C99 and
later
> do not support implicit int [-Wimplicit-int]
>   508 | StaticAssertDecl(sizeof(FMGR_ABI_EXTRA) <= sizeof(((Pg_abi_values *) 0)->abi_extra),
>       | ^
>       | int
> /usr/local/pgsql/master/include/server/c.h:941:2: note: expanded from macro 'StaticAssertDecl'
>   941 |         static_assert(condition, errmessage)
>       |         ^
> 6 errors generated.
> make: *** [/usr/local/pgsql/master/lib/pgxs/src/makefiles/../../src/Makefile.global:1101: orafce.bc] Chyba 1
>
> pavel@nemesis:~/src/postgresql/src$ gcc --version
> gcc (GCC) 15.2.1 20251211 (Red Hat 15.2.1-5)
> Copyright (C) 2025 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions.  There is NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
>

Hi,

I can reproduce the issue on Ubuntu 24.04 with GCC 13.3.0.

What is interesting is that the compiler cannot find the static_assert macro.

$ gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels
-Wmissing-format-attribute-Wimplicit-fallthrough=3 -Wcast-function-type -Wshadow=compatible-local -Wformat-security
-fno-strict-aliasing-fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -g -O0
-Wmissing-prototypes-Wincompatible-pointer-types -fsanitize=bounds -fPIC -fvisibility=hidden -I. -I./
-I/home/japin/Codes/pg/main/build/pg/include/postgresql/server
-I/home/japin/Codes/pg/main/build/pg/include/postgresql/internal-O0 -D_GNU_SOURCE  -I/usr/include/libxml2 -dM -E
regexp.c | grep -e __USE_ISOC -e STDC_VERSION -e static_assert
 
#define __USE_ISOC11 1
#define __USE_ISOC95 1
#define __USE_ISOC99 1
#define StaticAssertStmt(condition,errmessage) do { static_assert(condition, errmessage); } while(0)
#define StaticAssertExpr(condition,errmessage) ((void) ({ static_assert(condition, errmessage); true; }))
#define __STDC_VERSION__ 201710L
#define StaticAssertDecl(condition,errmessage) static_assert(condition, errmessage)

However, the following mini-code can find the static_assert macro.

$ cat <<EOF | gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels
-Wmissing-format-attribute-Wimplicit-fallthrough=3 -Wcast-function-type -Wshadow=compatible-local -Wformat-security
-fno-strict-aliasing-fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -g -O0
-Wmissing-prototypes-Wincompatible-pointer-types -fsanitize=bounds -fPIC -fvisibility=hidden -O0 -D_GNU_SOURCE -dM -E -
|grep -e __USE_ISOC -e STDC_VERSION -e static_assert 
#include <stdio.h>
#include <assert.h>
int main(void) { return 0; }
EOF

-- 
Regards,
Japin Li
ChengDu WenWu Information Technology Co., Ltd.



pgsql-hackers by date:

Previous
From: Fujii Masao
Date:
Subject: Re: Re: pg_recvlogical: Prevent flushed data from being re-sent after restarting replication
Next
From: Alexander Pyhalov
Date:
Subject: Limit memory usage by postgres_fdw batches