On Fri, 26 Dec 2025 at 12:16, Pavel Stehule <[email protected]> wrote:
> pá 26. 12. 2025 v 11:50 odesílatel Japin Li <[email protected]> napsal:
>
>  On Fri, 26 Dec 2025 at 09:12, Pavel Stehule <[email protected]> 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 <[email protected]>
>  > 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.


Reply via email to