]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Revert "Change copyObject() to use typeof_unqual"
authorPeter Eisentraut <peter@eisentraut.org>
Sat, 7 Feb 2026 09:08:38 +0000 (10:08 +0100)
committerPeter Eisentraut <peter@eisentraut.org>
Sat, 7 Feb 2026 09:08:38 +0000 (10:08 +0100)
This reverts commit 4cfce4e62c8f09f5b1f6a7f69760ca46a74406e2.

This implementation fails to compile on newer MSVC that support
__typeof_unqual__.  (Older versions did not support it and compiled
fine.)  Revert for now and research further.

Reported-by: Bryan Green <dbryan.green@gmail.com>
Discussion: https://www.postgresql.org/message-id/b03ddcd4-2a16-49ee-b105-e7f609f3c514%40gmail.com

config/c-compiler.m4
configure
configure.ac
meson.build
src/include/nodes/nodes.h
src/include/pg_config.h.in

index 7179a73bd2c8efec2ca08821d3580eaa64ff3f8b..1509dbfa2abe7b018d277fd6c0da0394635d4192 100644 (file)
@@ -192,31 +192,6 @@ if test "$pgac_cv_c_typeof" != no; then
 fi])# PGAC_C_TYPEOF
 
 
-# PGAC_C_TYPEOF_UNQUAL
-# --------------------
-# Check if the C compiler understands typeof_unqual or a variant.  Define
-# HAVE_TYPEOF_UNQUAL if so, and define 'typeof_unqual' to the actual key word.
-#
-AC_DEFUN([PGAC_C_TYPEOF_UNQUAL],
-[AC_CACHE_CHECK(for typeof_unqual, pgac_cv_c_typeof_unqual,
-[pgac_cv_c_typeof_unqual=no
-for pgac_kw in typeof_unqual __typeof_unqual__; do
-  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
-[int x = 0;
-$pgac_kw(x) y;
-y = x;
-return y;])],
-[pgac_cv_c_typeof_unqual=$pgac_kw])
-  test "$pgac_cv_c_typeof_unqual" != no && break
-done])
-if test "$pgac_cv_c_typeof_unqual" != no; then
-  AC_DEFINE(HAVE_TYPEOF_UNQUAL, 1,
-            [Define to 1 if your compiler understands `typeof_unqual' or something similar.])
-  if test "$pgac_cv_c_typeof_unqual" != typeof_unqual; then
-    AC_DEFINE_UNQUOTED(typeof_unqual, $pgac_cv_c_typeof_unqual, [Define to how the compiler spells `typeof_unqual'.])
-  fi
-fi])# PGAC_C_TYPEOF_UNQUAL
-
 
 # PGAC_C_TYPES_COMPATIBLE
 # -----------------------
index ba293931878037e6fc37b5db5fbf413ca289ce71..a10a2c85c6ab43c2e6b1ff3500666388784e04fc 100755 (executable)
--- a/configure
+++ b/configure
@@ -15010,48 +15010,6 @@ _ACEOF
 
   fi
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for typeof_unqual" >&5
-$as_echo_n "checking for typeof_unqual... " >&6; }
-if ${pgac_cv_c_typeof_unqual+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  pgac_cv_c_typeof_unqual=no
-for pgac_kw in typeof_unqual __typeof_unqual__; do
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-int x = 0;
-$pgac_kw(x) y;
-y = x;
-return y;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  pgac_cv_c_typeof_unqual=$pgac_kw
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  test "$pgac_cv_c_typeof_unqual" != no && break
-done
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_c_typeof_unqual" >&5
-$as_echo "$pgac_cv_c_typeof_unqual" >&6; }
-if test "$pgac_cv_c_typeof_unqual" != no; then
-
-$as_echo "#define HAVE_TYPEOF_UNQUAL 1" >>confdefs.h
-
-  if test "$pgac_cv_c_typeof_unqual" != typeof_unqual; then
-
-cat >>confdefs.h <<_ACEOF
-#define typeof_unqual $pgac_cv_c_typeof_unqual
-_ACEOF
-
-  fi
-fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __builtin_types_compatible_p" >&5
 $as_echo_n "checking for __builtin_types_compatible_p... " >&6; }
 if ${pgac_cv__types_compatible+:} false; then :
index 412fe358a2f81989eaf78fbf696d99d0838abeb2..814e64a967efa934d6bb9d72db7f7a5acf40c494 100644 (file)
@@ -1717,7 +1717,6 @@ PGAC_PRINTF_ARCHETYPE
 PGAC_CXX_PRINTF_ARCHETYPE
 PGAC_C_STATEMENT_EXPRESSIONS
 PGAC_C_TYPEOF
-PGAC_C_TYPEOF_UNQUAL
 PGAC_C_TYPES_COMPATIBLE
 PGAC_C_BUILTIN_CONSTANT_P
 PGAC_C_BUILTIN_OP_OVERFLOW
index 0722b16927e00527091e98dee593997f30a33fa6..df907b62da337d82566fd5852c9953c2edb499e8 100644 (file)
@@ -2880,30 +2880,6 @@ int main(void)
   endif
 endforeach
 
-# Check if the C compiler understands typeof_unqual or a variant.  Define
-# HAVE_TYPEOF_UNQUAL if so, and define 'typeof_unqual' to the actual key word.
-foreach kw : ['typeof_unqual', '__typeof_unqual__']
-  if cc.compiles('''
-int main(void)
-{
-    int x = 0;
-    @0@(x) y;
-    y = x;
-    return y;
-}
-'''.format(kw),
-    name: kw,
-    args: test_c_args, include_directories: postgres_inc)
-
-    cdata.set('HAVE_TYPEOF_UNQUAL', 1)
-    if kw != 'typeof_unqual'
-      cdata.set('typeof_unqual', kw)
-    endif
-
-    break
-  endif
-endforeach
-
 
 # MSVC doesn't cope well with defining restrict to __restrict, the
 # spelling it understands, because it conflicts with
index ba6dd7f389906be54a3cb037dd49a2ba9e0baa0d..b6ad28618ab874d0b74236e904bf30a2a6f6e504 100644 (file)
@@ -226,8 +226,8 @@ extern int16 *readAttrNumberCols(int numCols);
 extern void *copyObjectImpl(const void *from);
 
 /* cast result back to argument type, if supported by compiler */
-#ifdef HAVE_TYPEOF_UNQUAL
-#define copyObject(obj) ((typeof_unqual(*(obj)) *) copyObjectImpl(obj))
+#ifdef HAVE_TYPEOF
+#define copyObject(obj) ((typeof(obj)) copyObjectImpl(obj))
 #else
 #define copyObject(obj) copyObjectImpl(obj)
 #endif
index c089f2252c383e66a88fedee54bd288a1a285b43..339268dc8ef44674370ff8e789a4fe5e25d1dc6f 100644 (file)
 /* Define to 1 if your compiler understands `typeof' or something similar. */
 #undef HAVE_TYPEOF
 
-/* Define to 1 if your compiler understands `typeof_unqual' or something
-   similar. */
-#undef HAVE_TYPEOF_UNQUAL
-
 /* Define to 1 if you have the <uchar.h> header file. */
 #undef HAVE_UCHAR_H
 
 
 /* Define to how the compiler spells `typeof'. */
 #undef typeof
-
-/* Define to how the compiler spells `typeof_unqual'. */
-#undef typeof_unqual