Skip to content

Commit 87de40d

Browse files
committed
Merge remote-tracking branch 'origin/merge-16.14-stable' into BABEL_4_10_STABLE__PG_16_14
2 parents 229b480 + 3b67c8f commit 87de40d

265 files changed

Lines changed: 8644 additions & 2774 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

config/c-compiler.m4

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
# Select the format archetype to be used by gcc to check printf-type functions.
88
# We prefer "gnu_printf", as that most closely matches the features supported
99
# by src/port/snprintf.c (particularly the %m conversion spec). However,
10-
# on some NetBSD versions, that doesn't work while "__syslog__" does.
11-
# If all else fails, use "printf".
10+
# on clang and on some NetBSD versions, that doesn't work while "__syslog__"
11+
# does. If all else fails, use "printf".
1212
AC_DEFUN([PGAC_PRINTF_ARCHETYPE],
13-
[AC_CACHE_CHECK([for printf format archetype], pgac_cv_printf_archetype,
13+
[AC_CACHE_CHECK([for C printf format archetype], pgac_cv_printf_archetype,
1414
[pgac_cv_printf_archetype=gnu_printf
1515
PGAC_TEST_PRINTF_ARCHETYPE
1616
if [[ "$ac_archetype_ok" = no ]]; then
@@ -20,8 +20,8 @@ if [[ "$ac_archetype_ok" = no ]]; then
2020
pgac_cv_printf_archetype=printf
2121
fi
2222
fi])
23-
AC_DEFINE_UNQUOTED([PG_PRINTF_ATTRIBUTE], [$pgac_cv_printf_archetype],
24-
[Define to best printf format archetype, usually gnu_printf if available.])
23+
AC_DEFINE_UNQUOTED([PG_C_PRINTF_ATTRIBUTE], [$pgac_cv_printf_archetype],
24+
[Define to best C printf format archetype, usually gnu_printf if available.])
2525
])# PGAC_PRINTF_ARCHETYPE
2626

2727
# Subroutine: test $pgac_cv_printf_archetype, set $ac_archetype_ok to yes or no
@@ -92,6 +92,42 @@ undefine([Ac_cachevar])dnl
9292
])# PGAC_TYPE_64BIT_INT
9393

9494

95+
# PGAC_CXX_PRINTF_ARCHETYPE
96+
# -------------------------
97+
# Because we support using gcc as C compiler with clang as C++ compiler,
98+
# we have to be prepared to use different printf archetypes in C++ code.
99+
# So, do the above test all over in C++.
100+
AC_DEFUN([PGAC_CXX_PRINTF_ARCHETYPE],
101+
[AC_CACHE_CHECK([for C++ printf format archetype], pgac_cv_cxx_printf_archetype,
102+
[pgac_cv_cxx_printf_archetype=gnu_printf
103+
PGAC_TEST_CXX_PRINTF_ARCHETYPE
104+
if [[ "$ac_archetype_ok" = no ]]; then
105+
pgac_cv_cxx_printf_archetype=__syslog__
106+
PGAC_TEST_CXX_PRINTF_ARCHETYPE
107+
if [[ "$ac_archetype_ok" = no ]]; then
108+
pgac_cv_cxx_printf_archetype=printf
109+
fi
110+
fi])
111+
AC_DEFINE_UNQUOTED([PG_CXX_PRINTF_ATTRIBUTE], [$pgac_cv_cxx_printf_archetype],
112+
[Define to best C++ printf format archetype, usually gnu_printf if available.])
113+
])# PGAC_CXX_PRINTF_ARCHETYPE
114+
115+
# Subroutine: test $pgac_cv_cxx_printf_archetype, set $ac_archetype_ok to yes or no
116+
AC_DEFUN([PGAC_TEST_CXX_PRINTF_ARCHETYPE],
117+
[ac_save_cxx_werror_flag=$ac_cxx_werror_flag
118+
ac_cxx_werror_flag=yes
119+
AC_LANG_PUSH(C++)
120+
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
121+
[extern void pgac_write(int ignore, const char *fmt,...)
122+
__attribute__((format($pgac_cv_cxx_printf_archetype, 2, 3)));],
123+
[pgac_write(0, "error %s: %m", "foo");])],
124+
[ac_archetype_ok=yes],
125+
[ac_archetype_ok=no])
126+
AC_LANG_POP([])
127+
ac_cxx_werror_flag=$ac_save_cxx_werror_flag
128+
])# PGAC_TEST_CXX_PRINTF_ARCHETYPE
129+
130+
95131
# PGAC_TYPE_128BIT_INT
96132
# --------------------
97133
# Check if __int128 is a working 128 bit integer type, and if so

configure

Lines changed: 125 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#! /bin/sh
22
# Guess values for system-dependent variables and create Makefiles.
3-
# Generated by GNU Autoconf 2.69 for PostgreSQL 16.13.
3+
# Generated by GNU Autoconf 2.69 for PostgreSQL 16.14.
44
#
55
# Report bugs to <pgsql-bugs@lists.postgresql.org>.
66
#
@@ -582,8 +582,8 @@ MAKEFLAGS=
582582
# Identity of this package.
583583
PACKAGE_NAME='PostgreSQL'
584584
PACKAGE_TARNAME='postgresql'
585-
PACKAGE_VERSION='16.13'
586-
PACKAGE_STRING='PostgreSQL 16.13'
585+
PACKAGE_VERSION='16.14'
586+
PACKAGE_STRING='PostgreSQL 16.14'
587587
PACKAGE_BUGREPORT='pgsql-bugs@lists.postgresql.org'
588588
PACKAGE_URL='https://www.postgresql.org/'
589589

@@ -1448,7 +1448,7 @@ if test "$ac_init_help" = "long"; then
14481448
# Omit some internal or obsolete options to make the list less imposing.
14491449
# This message is too long to be a string in the A/UX 3.1 sh.
14501450
cat <<_ACEOF
1451-
\`configure' configures PostgreSQL 16.13 to adapt to many kinds of systems.
1451+
\`configure' configures PostgreSQL 16.14 to adapt to many kinds of systems.
14521452

14531453
Usage: $0 [OPTION]... [VAR=VALUE]...
14541454

@@ -1513,7 +1513,7 @@ fi
15131513

15141514
if test -n "$ac_init_help"; then
15151515
case $ac_init_help in
1516-
short | recursive ) echo "Configuration of PostgreSQL 16.13:";;
1516+
short | recursive ) echo "Configuration of PostgreSQL 16.14:";;
15171517
esac
15181518
cat <<\_ACEOF
15191519

@@ -1688,7 +1688,7 @@ fi
16881688
test -n "$ac_init_help" && exit $ac_status
16891689
if $ac_init_version; then
16901690
cat <<\_ACEOF
1691-
PostgreSQL configure 16.13
1691+
PostgreSQL configure 16.14
16921692
generated by GNU Autoconf 2.69
16931693

16941694
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2441,7 +2441,7 @@ cat >config.log <<_ACEOF
24412441
This file contains any messages produced by compilers while
24422442
running configure, to aid debugging if configure makes a mistake.
24432443

2444-
It was created by PostgreSQL $as_me 16.13, which was
2444+
It was created by PostgreSQL $as_me 16.14, which was
24452445
generated by GNU Autoconf 2.69. Invocation command line was
24462446

24472447
$ $0 $@
@@ -14783,8 +14783,8 @@ _ACEOF
1478314783
;;
1478414784
esac
1478514785

14786-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for printf format archetype" >&5
14787-
$as_echo_n "checking for printf format archetype... " >&6; }
14786+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C printf format archetype" >&5
14787+
$as_echo_n "checking for C printf format archetype... " >&6; }
1478814788
if ${pgac_cv_printf_archetype+:} false; then :
1478914789
$as_echo_n "(cached) " >&6
1479014790
else
@@ -14844,7 +14844,97 @@ fi
1484414844
$as_echo "$pgac_cv_printf_archetype" >&6; }
1484514845

1484614846
cat >>confdefs.h <<_ACEOF
14847-
#define PG_PRINTF_ATTRIBUTE $pgac_cv_printf_archetype
14847+
#define PG_C_PRINTF_ATTRIBUTE $pgac_cv_printf_archetype
14848+
_ACEOF
14849+
14850+
14851+
14852+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ printf format archetype" >&5
14853+
$as_echo_n "checking for C++ printf format archetype... " >&6; }
14854+
if ${pgac_cv_cxx_printf_archetype+:} false; then :
14855+
$as_echo_n "(cached) " >&6
14856+
else
14857+
pgac_cv_cxx_printf_archetype=gnu_printf
14858+
ac_save_cxx_werror_flag=$ac_cxx_werror_flag
14859+
ac_cxx_werror_flag=yes
14860+
ac_ext=cpp
14861+
ac_cpp='$CXXCPP $CPPFLAGS'
14862+
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
14863+
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
14864+
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
14865+
14866+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
14867+
/* end confdefs.h. */
14868+
extern void pgac_write(int ignore, const char *fmt,...)
14869+
__attribute__((format($pgac_cv_cxx_printf_archetype, 2, 3)));
14870+
int
14871+
main ()
14872+
{
14873+
pgac_write(0, "error %s: %m", "foo");
14874+
;
14875+
return 0;
14876+
}
14877+
_ACEOF
14878+
if ac_fn_cxx_try_compile "$LINENO"; then :
14879+
ac_archetype_ok=yes
14880+
else
14881+
ac_archetype_ok=no
14882+
fi
14883+
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
14884+
ac_ext=c
14885+
ac_cpp='$CPP $CPPFLAGS'
14886+
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
14887+
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
14888+
ac_compiler_gnu=$ac_cv_c_compiler_gnu
14889+
14890+
ac_cxx_werror_flag=$ac_save_cxx_werror_flag
14891+
14892+
if [ "$ac_archetype_ok" = no ]; then
14893+
pgac_cv_cxx_printf_archetype=__syslog__
14894+
ac_save_cxx_werror_flag=$ac_cxx_werror_flag
14895+
ac_cxx_werror_flag=yes
14896+
ac_ext=cpp
14897+
ac_cpp='$CXXCPP $CPPFLAGS'
14898+
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
14899+
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
14900+
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
14901+
14902+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
14903+
/* end confdefs.h. */
14904+
extern void pgac_write(int ignore, const char *fmt,...)
14905+
__attribute__((format($pgac_cv_cxx_printf_archetype, 2, 3)));
14906+
int
14907+
main ()
14908+
{
14909+
pgac_write(0, "error %s: %m", "foo");
14910+
;
14911+
return 0;
14912+
}
14913+
_ACEOF
14914+
if ac_fn_cxx_try_compile "$LINENO"; then :
14915+
ac_archetype_ok=yes
14916+
else
14917+
ac_archetype_ok=no
14918+
fi
14919+
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
14920+
ac_ext=c
14921+
ac_cpp='$CPP $CPPFLAGS'
14922+
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
14923+
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
14924+
ac_compiler_gnu=$ac_cv_c_compiler_gnu
14925+
14926+
ac_cxx_werror_flag=$ac_save_cxx_werror_flag
14927+
14928+
if [ "$ac_archetype_ok" = no ]; then
14929+
pgac_cv_cxx_printf_archetype=printf
14930+
fi
14931+
fi
14932+
fi
14933+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_cxx_printf_archetype" >&5
14934+
$as_echo "$pgac_cv_cxx_printf_archetype" >&6; }
14935+
14936+
cat >>confdefs.h <<_ACEOF
14937+
#define PG_CXX_PRINTF_ATTRIBUTE $pgac_cv_cxx_printf_archetype
1484814938
_ACEOF
1484914939

1485014940

@@ -16231,6 +16321,16 @@ fi
1623116321
cat >>confdefs.h <<_ACEOF
1623216322
#define HAVE_DECL_STRNLEN $ac_have_decl
1623316323
_ACEOF
16324+
ac_fn_c_check_decl "$LINENO" "timingsafe_bcmp" "ac_cv_have_decl_timingsafe_bcmp" "$ac_includes_default"
16325+
if test "x$ac_cv_have_decl_timingsafe_bcmp" = xyes; then :
16326+
ac_have_decl=1
16327+
else
16328+
ac_have_decl=0
16329+
fi
16330+
16331+
cat >>confdefs.h <<_ACEOF
16332+
#define HAVE_DECL_TIMINGSAFE_BCMP $ac_have_decl
16333+
_ACEOF
1623416334

1623516335

1623616336
# We can't use AC_REPLACE_FUNCS to replace these functions, because it
@@ -16423,6 +16523,19 @@ esac
1642316523

1642416524
fi
1642516525

16526+
ac_fn_c_check_func "$LINENO" "timingsafe_bcmp" "ac_cv_func_timingsafe_bcmp"
16527+
if test "x$ac_cv_func_timingsafe_bcmp" = xyes; then :
16528+
$as_echo "#define HAVE_TIMINGSAFE_BCMP 1" >>confdefs.h
16529+
16530+
else
16531+
case " $LIBOBJS " in
16532+
*" timingsafe_bcmp.$ac_objext "* ) ;;
16533+
*) LIBOBJS="$LIBOBJS timingsafe_bcmp.$ac_objext"
16534+
;;
16535+
esac
16536+
16537+
fi
16538+
1642616539

1642716540

1642816541
if test "$enable_thread_safety" = yes; then
@@ -20047,7 +20160,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
2004720160
# report actual input values of CONFIG_FILES etc. instead of their
2004820161
# values after options handling.
2004920162
ac_log="
20050-
This file was extended by PostgreSQL $as_me 16.13, which was
20163+
This file was extended by PostgreSQL $as_me 16.14, which was
2005120164
generated by GNU Autoconf 2.69. Invocation command line was
2005220165

2005320166
CONFIG_FILES = $CONFIG_FILES
@@ -20118,7 +20231,7 @@ _ACEOF
2011820231
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
2011920232
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
2012020233
ac_cs_version="\\
20121-
PostgreSQL config.status 16.13
20234+
PostgreSQL config.status 16.14
2012220235
configured by $0, generated by GNU Autoconf 2.69,
2012320236
with options \\"\$ac_cs_config\\"
2012420237

configure.ac

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ dnl Read the Autoconf manual for details.
1717
dnl
1818
m4_pattern_forbid(^PGAC_)dnl to catch undefined macros
1919

20-
AC_INIT([PostgreSQL], [16.13], [pgsql-bugs@lists.postgresql.org], [], [https://www.postgresql.org/])
20+
AC_INIT([PostgreSQL], [16.14], [pgsql-bugs@lists.postgresql.org], [], [https://www.postgresql.org/])
2121

2222
m4_if(m4_defn([m4_PACKAGE_VERSION]), [2.69], [], [m4_fatal([Autoconf version 2.69 is required.
2323
Untested combinations of 'autoconf' and PostgreSQL versions are not
@@ -1665,6 +1665,7 @@ m4_defun([AC_PROG_CC_STDC], []) dnl We don't want that.
16651665
AC_C_BIGENDIAN
16661666
AC_C_INLINE
16671667
PGAC_PRINTF_ARCHETYPE
1668+
PGAC_CXX_PRINTF_ARCHETYPE
16681669
PGAC_C_STATIC_ASSERT
16691670
PGAC_C_TYPEOF
16701671
PGAC_C_TYPES_COMPATIBLE
@@ -1841,7 +1842,7 @@ AC_CHECK_DECLS(posix_fadvise, [], [], [#include <fcntl.h>])
18411842
]) # fi
18421843

18431844
AC_CHECK_DECLS(fdatasync, [], [], [#include <unistd.h>])
1844-
AC_CHECK_DECLS([strlcat, strlcpy, strnlen])
1845+
AC_CHECK_DECLS([strlcat, strlcpy, strnlen, timingsafe_bcmp])
18451846

18461847
# We can't use AC_REPLACE_FUNCS to replace these functions, because it
18471848
# won't handle deployment target restrictions on macOS
@@ -1863,6 +1864,7 @@ AC_REPLACE_FUNCS(m4_normalize([
18631864
strlcat
18641865
strlcpy
18651866
strnlen
1867+
timingsafe_bcmp
18661868
]))
18671869

18681870
if test "$enable_thread_safety" = yes; then

contrib/basic_archive/basic_archive.c

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,11 @@ basic_archive_startup(ArchiveModuleState *state)
114114
/*
115115
* check_archive_directory
116116
*
117-
* Checks that the provided archive directory exists.
117+
* Checks that the provided archive directory path isn't too long.
118118
*/
119119
static bool
120120
check_archive_directory(char **newval, void **extra, GucSource source)
121121
{
122-
struct stat st;
123-
124122
/*
125123
* The default value is an empty string, so we have to accept that value.
126124
* Our check_configured callback also checks for this and prevents
@@ -139,17 +137,6 @@ check_archive_directory(char **newval, void **extra, GucSource source)
139137
return false;
140138
}
141139

142-
/*
143-
* Do a basic sanity check that the specified archive directory exists. It
144-
* could be removed at some point in the future, so we still need to be
145-
* prepared for it not to exist in the actual archiving logic.
146-
*/
147-
if (stat(*newval, &st) != 0 || !S_ISDIR(st.st_mode))
148-
{
149-
GUC_check_errdetail("Specified archive directory does not exist.");
150-
return false;
151-
}
152-
153140
return true;
154141
}
155142

contrib/hstore_plperl/hstore_plperl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ plperl_to_hstore(PG_FUNCTION_ARGS)
118118

119119
pcount = hv_iterinit(hv);
120120

121-
pairs = palloc(pcount * sizeof(Pairs));
121+
pairs = palloc_array(Pairs, pcount);
122122

123123
i = 0;
124124
while ((he = hv_iternext(hv)))

contrib/hstore_plpython/hstore_plpython.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ plpython_to_hstore(PG_FUNCTION_ARGS)
147147
Py_ssize_t i;
148148
Pairs *pairs;
149149

150-
pairs = palloc(pcount * sizeof(*pairs));
150+
pairs = palloc_array(Pairs, pcount);
151151

152152
for (i = 0; i < pcount; i++)
153153
{

0 commit comments

Comments
 (0)