Обсуждение: 17f446784d54da827f74c2acc0fa772a41b92354 breaks orafce build

Поиск
Список
Период
Сортировка

17f446784d54da827f74c2acc0fa772a41b92354 breaks orafce build

От
Pavel Stehule
Дата:
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.

Unfortunately I am not able to fix it. The master can be build without any problem

Regards

Pavel


Re:17f446784d54da827f74c2acc0fa772a41b92354 breaks orafce build

От
"zengman"
Дата:
Hi,

If you are in a hurry, you can try modifying the code of 'orafce' in this way.
```
postgres@zxm-VMware-Virtual-Platform:~/code/18/contrib/orafce$ git diff
diff --git a/Makefile b/Makefile
index ac72aa5..5772627 100644
--- a/Makefile
+++ b/Makefile
@@ -95,7 +95,7 @@ REGRESS = orafce\
 
 #REGRESS_OPTS = --load-language=plpgsql --schedule=parallel_schedule --encoding=utf8
 REGRESS_OPTS = --schedule=parallel_schedule --encoding=utf8
-
+override CFLAGS += -D'static_assert=_Static_assert'
 # override CFLAGS += -Wextra -Wimplicit-fallthrough=0
 
 ifdef NO_PGXS
diff --git a/datefce.c b/datefce.c
index 3cc42cd..fc1e5d6 100644
--- a/datefce.c
+++ b/datefce.c
@@ -1281,7 +1281,11 @@ orafce_sys_extract_utc_oracle_date(PG_FUNCTION_ARGS)
 {
        TimestampTz loc_ts;
 
-#if PG_VERSION_NUM >=  130000
+#if PG_VERSION_NUM >= 180000
+
+       loc_ts = timestamp2timestamptz_safe(PG_GETARG_TIMESTAMP(0), NULL);
+
+#elif PG_VERSION_NUM >= 130000
 
        loc_ts = timestamp2timestamptz_opt_overflow(PG_GETARG_TIMESTAMP(0), NULL);
 ```

--
Regards,
Man Zeng
www.openhalo.org

Re: 17f446784d54da827f74c2acc0fa772a41b92354 breaks orafce build

От
Pavel Stehule
Дата:


pá 26. 12. 2025 v 10:42 odesílatel zengman <zengman@halodbtech.com> napsal:
Hi,

If you are in a hurry, you can try modifying the code of 'orafce' in this way.
```
postgres@zxm-VMware-Virtual-Platform:~/code/18/contrib/orafce$ git diff
diff --git a/Makefile b/Makefile
index ac72aa5..5772627 100644
--- a/Makefile
+++ b/Makefile
@@ -95,7 +95,7 @@ REGRESS = orafce\

 #REGRESS_OPTS = --load-language=plpgsql --schedule=parallel_schedule --encoding=utf8
 REGRESS_OPTS = --schedule=parallel_schedule --encoding=utf8
-
+override CFLAGS += -D'static_assert=_Static_assert'
 # override CFLAGS += -Wextra -Wimplicit-fallthrough=0

it can be temporal fix - what is interesting, I have no problem with build of plpgql_check
 

 ifdef NO_PGXS
diff --git a/datefce.c b/datefce.c
index 3cc42cd..fc1e5d6 100644
--- a/datefce.c
+++ b/datefce.c
@@ -1281,7 +1281,11 @@ orafce_sys_extract_utc_oracle_date(PG_FUNCTION_ARGS)
 {
        TimestampTz loc_ts;

-#if PG_VERSION_NUM >=  130000
+#if PG_VERSION_NUM >= 180000
+
+       loc_ts = timestamp2timestamptz_safe(PG_GETARG_TIMESTAMP(0), NULL);
+
+#elif PG_VERSION_NUM >= 130000

        loc_ts = timestamp2timestamptz_opt_overflow(PG_GETARG_TIMESTAMP(0), NULL);
 ```

this is already fixed
 

--
Regards,
Man Zeng
www.openhalo.org

Re: 17f446784d54da827f74c2acc0fa772a41b92354 breaks orafce build

От
Japin Li
Дата:
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.



Re: 17f446784d54da827f74c2acc0fa772a41b92354 breaks orafce build

От
Pavel Stehule
Дата:


pá 26. 12. 2025 v 11:50 odesílatel Japin Li <japinli@hotmail.com> napsal:
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



it is maybe some pgxs issue - meson build is ok

Regards

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

Re: 17f446784d54da827f74c2acc0fa772a41b92354 breaks orafce build

От
Japin Li
Дата:
On Fri, 26 Dec 2025 at 12:16, Pavel Stehule <pavel.stehule@gmail.com> wrote:
> pá 26. 12. 2025 v 11:50 odesílatel Japin Li <japinli@hotmail.com> napsal:
>
>  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
>
> it is maybe some pgxs issue - meson build is ok

If think I've found the problem:

There's an assert.h file in the orafce directory, which causes <c.h> to
include this local version instead of the system's assert.h header.

After renaming the assert.h file in the orafce directory to assert1.h, the
problem was resolved and everything worked correctly.

diff --git a/assert.c b/assert.c
index 30f53ad..2e3385c 100644
--- a/assert.c
+++ b/assert.c
@@ -1,6 +1,6 @@
 #include "postgres.h"
 #include "funcapi.h"
-#include "assert.h"
+#include "assert1.h"
 #include "miscadmin.h"
 #include "utils/acl.h"
 #include "utils/builtins.h"
diff --git a/assert.h b/assert.h
deleted file mode 100644
index 45c2fc7..0000000
--- a/assert.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef __ASSERT__
-#define __ASSERT__
-
-#define ERRCODE_ORA_PACKAGES_INVALID_SCHEMA_NAME    MAKE_SQLSTATE('4','4','0','0','1')
-#define ERRCODE_ORA_PACKAGES_INVALID_OBJECT_NAME    MAKE_SQLSTATE('4','4','0','0','2')
-#define ERRCODE_ORA_PACKAGES_ISNOT_SIMPLE_SQL_NAME    MAKE_SQLSTATE('4','4','0','0','3')
-#define ERRCODE_ORA_PACKAGES_ISNOT_QUALIFIED_SQL_NAME    MAKE_SQLSTATE('4','4','0','0','4')
-
-#endif


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



Re: 17f446784d54da827f74c2acc0fa772a41b92354 breaks orafce build

От
"zengman"
Дата:
> it can be temporal fix - what is interesting, I have no problem with build of plpgql_check

Simply put, orafce comes with a local assert.h file while plpgsql_check does not. 
Just rename the local assert.h file in orafce and the issue will be fixed.

```
diff --git a/assert.c b/assert.c
index 30f53ad..78915ba 100644
--- a/assert.c
+++ b/assert.c
@@ -1,6 +1,6 @@
 #include "postgres.h"
 #include "funcapi.h"
-#include "assert.h"
+#include "ora_errcodes.h"
 #include "miscadmin.h"
 #include "utils/acl.h"
 #include "utils/builtins.h"
diff --git a/datefce.c b/datefce.c
index 3cc42cd..fc1e5d6 100644
--- a/datefce.c
+++ b/datefce.c
@@ -1281,7 +1281,11 @@ orafce_sys_extract_utc_oracle_date(PG_FUNCTION_ARGS)
 {
        TimestampTz loc_ts;
 
-#if PG_VERSION_NUM >=  130000
+#if PG_VERSION_NUM >= 180000
+
+       loc_ts = timestamp2timestamptz_safe(PG_GETARG_TIMESTAMP(0), NULL);
+
+#elif PG_VERSION_NUM >= 130000
 
        loc_ts = timestamp2timestamptz_opt_overflow(PG_GETARG_TIMESTAMP(0), NULL);
 
diff --git a/msvc/orafce.2010.vcxproj b/msvc/orafce.2010.vcxproj
index 8efe13d..58e4997 100644
--- a/msvc/orafce.2010.vcxproj
+++ b/msvc/orafce.2010.vcxproj
@@ -510,7 +510,7 @@
     <ClCompile Include="..\varchar2.c" />
   </ItemGroup>
   <ItemGroup>
-    <ClInclude Include="..\assert.h" />
+    <ClInclude Include="..\ora_errcodes.h" />^M
     <ClInclude Include="..\builtins.h" />
     <ClInclude Include="..\orafce.h" />
     <ClInclude Include="..\pipe.h" />
diff --git a/msvc/orafce.2010.vcxproj.filters b/msvc/orafce.2010.vcxproj.filters
index 57ac0c6..5c2fbb7 100644
--- a/msvc/orafce.2010.vcxproj.filters
+++ b/msvc/orafce.2010.vcxproj.filters
@@ -124,7 +124,7 @@
     </ClCompile>
   </ItemGroup>
   <ItemGroup>
-    <ClInclude Include="..\assert.h">
+    <ClInclude Include="..\ora_errcodes.h">^M
       <Filter>include</Filter>
     </ClInclude>
     <ClInclude Include="..\builtins.h">
diff --git a/assert.h b/ora_errcodes.h
similarity index 100%
rename from assert.h
rename to ora_errcodes.h
```

--
Regards,
Man Zeng
www.openhalo.org

Re: 17f446784d54da827f74c2acc0fa772a41b92354 breaks orafce build

От
"zengman"
Дата:
> If think I've found the problem:

> There's an assert.h file in the orafce directory, which causes <c.h> to
> include this local version instead of the system's assert.h header.

> After renaming the assert.h file in the orafce directory to assert1.h, the
> problem was resolved and everything worked correctly.

Oh, because I wasn't subscribed and wasn't copied, I didn't notice that it had been resolved.

--
Regards,
Man Zeng
www.openhalo.org

Re: 17f446784d54da827f74c2acc0fa772a41b92354 breaks orafce build

От
Japin Li
Дата:
On Fri, 26 Dec 2025 at 22:04, "zengman" <zengman@halodbtech.com> wrote:
>> If think I've found the problem:
>
>> There's an assert.h file in the orafce directory, which causes <c.h> to
>> include this local version instead of the system's assert.h header.
>
>> After renaming the assert.h file in the orafce directory to assert1.h, the
>> problem was resolved and everything worked correctly.
>
> Oh, because I wasn't subscribed and wasn't copied, I didn't notice that it had been resolved.
>

Apologies for that; I overlooked CC'ing you.

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



Re: 17f446784d54da827f74c2acc0fa772a41b92354 breaks orafce build

От
"zengman"
Дата:
> Apologies for that; I overlooked CC'ing you.

Hi all,I have an idea: We can add this definition to `src/include/c.h`:
```
#ifndef static_assert
#define static_assert _Static_assert
#endif
```
What do you all think?

--
Regards,
Man Zeng
www.openhalo.org

Re: 17f446784d54da827f74c2acc0fa772a41b92354 breaks orafce build

От
Peter Eisentraut
Дата:
On 26.12.25 16:03, zengman wrote:
>> Apologies for that; I overlooked CC'ing you.
> 
> Hi all,I have an idea: We can add this definition to `src/include/c.h`:
> ```
> #ifndef static_assert
> #define static_assert _Static_assert
> #endif
> ```

No, this wouldn't work with C23 and beyond.

The correct fix is to rename the local assert.h file, as has already 
been proposed.




Re: 17f446784d54da827f74c2acc0fa772a41b92354 breaks orafce build

От
"zengman"
Дата:
> No, this wouldn't work with C23 and beyond.

> The correct fix is to rename the local assert.h file, as has already
> been proposed.

OK. Thank you for your guidance.

Re: 17f446784d54da827f74c2acc0fa772a41b92354 breaks orafce build

От
Pavel Stehule
Дата:
Hi

pá 26. 12. 2025 v 13:40 odesílatel Japin Li <japinli@hotmail.com> napsal:
On Fri, 26 Dec 2025 at 12:16, Pavel Stehule <pavel.stehule@gmail.com> wrote:
> pá 26. 12. 2025 v 11:50 odesílatel Japin Li <japinli@hotmail.com> napsal:
>
>  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
>
> it is maybe some pgxs issue - meson build is ok

If think I've found the problem:

There's an assert.h file in the orafce directory, which causes <c.h> to
include this local version instead of the system's assert.h header.

After renaming the assert.h file in the orafce directory to assert1.h, the
problem was resolved and everything worked correctly.

yes, it was there.


Thank you very much for this idea.  It really helps.

Best regards

Pavel


diff --git a/assert.c b/assert.c
index 30f53ad..2e3385c 100644
--- a/assert.c
+++ b/assert.c
@@ -1,6 +1,6 @@
 #include "postgres.h"
 #include "funcapi.h"
-#include "assert.h"
+#include "assert1.h"
 #include "miscadmin.h"
 #include "utils/acl.h"
 #include "utils/builtins.h"
diff --git a/assert.h b/assert.h
deleted file mode 100644
index 45c2fc7..0000000
--- a/assert.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef __ASSERT__
-#define __ASSERT__
-
-#define ERRCODE_ORA_PACKAGES_INVALID_SCHEMA_NAME       MAKE_SQLSTATE('4','4','0','0','1')
-#define ERRCODE_ORA_PACKAGES_INVALID_OBJECT_NAME       MAKE_SQLSTATE('4','4','0','0','2')
-#define ERRCODE_ORA_PACKAGES_ISNOT_SIMPLE_SQL_NAME     MAKE_SQLSTATE('4','4','0','0','3')
-#define ERRCODE_ORA_PACKAGES_ISNOT_QUALIFIED_SQL_NAME  MAKE_SQLSTATE('4','4','0','0','4')
-
-#endif


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