@@ -5240,7 +5240,7 @@ else
52405240fi
52415241
52425242# When generating bitcode (for inlining) we always want to use -O2
5243- # even when --enable-debug is specified. The bitcodeit's not going to
5243+ # even when --enable-debug is specified. The bitcodeis not going to
52445244# be used for line-by-line debugging, and JIT inlining doesn't work
52455245# without at least -O1 (otherwise clang will emit 'noinline'
52465246# attributes everywhere), which is bad for testing. Still allow the
@@ -6090,9 +6090,14 @@ if test x"$pgac_cv_prog_CC_cflags__ftree_vectorize" = x"yes"; then
60906090fi
60916091
60926092
6093- # We want to suppress clang's unhelpful unused-command-line-argument warnings
6094- # but gcc won't complain about unrecognized -Wno-foo switches, so we have to
6095- # test for the positive form and if that works, add the negative form
6093+ #
6094+ # The following tests want to suppress various unhelpful warnings by adding
6095+ # -Wno-foo switches. But gcc won't complain about unrecognized -Wno-foo
6096+ # switches, so we have to test for the positive form and if that works,
6097+ # add the negative form. Note that tests of this form typically need to
6098+ # be duplicated in the BITCODE_CFLAGS setup stanza below.
6099+ #
6100+ # Suppress clang's unhelpful unused-command-line-argument warnings.
60966101 NOT_THE_CFLAGS=""
60976102 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -Wunused-command-line-argument, for NOT_THE_CFLAGS" >&5
60986103$as_echo_n "checking whether ${CC} supports -Wunused-command-line-argument, for NOT_THE_CFLAGS... " >&6; }
61376142 CFLAGS="$CFLAGS -Wno-unused-command-line-argument"
61386143 fi
61396144 # Remove clang 12+'s compound-token-split-by-macro, as this causes a lot
6140- # of warnings when building plperl because of Perl. Like previously, test
6141- # for the positive form and add the negative form
6145+ # of warnings when building plperl because of usages in the Perl headers.
61426146 NOT_THE_CFLAGS=""
61436147 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -Wcompound-token-split-by-macro, for NOT_THE_CFLAGS" >&5
61446148$as_echo_n "checking whether ${CC} supports -Wcompound-token-split-by-macro, for NOT_THE_CFLAGS... " >&6; }
@@ -6737,9 +6741,12 @@ fi
67376741
67386742
67396743
6740- # Determine flags used to emit bitcode for JIT inlining. Need to test
6741- # for behaviour changing compiler flags, to keep compatibility with
6742- # compiler used for normal postgres code.
6744+ # Determine flags used to emit bitcode for JIT inlining.
6745+ # 1. We must duplicate any behaviour-changing compiler flags used above,
6746+ # to keep compatibility with the compiler used for normal Postgres code.
6747+ # 2. We don't bother to duplicate extra-warnings switches --- seeing a
6748+ # warning in the main build is enough.
6749+ # 3. But we must duplicate -Wno-warning flags, else we'll see those anyway.
67436750if test "$with_llvm" = yes ; then
67446751 CLANGXX="$CLANG -xc++"
67456752
@@ -7007,6 +7014,175 @@ if test x"$pgac_cv_prog_CLANGXX_cxxflags__fexcess_precision_standard" = x"yes";
70077014 BITCODE_CXXFLAGS="${BITCODE_CXXFLAGS} -fexcess-precision=standard"
70087015fi
70097016
7017+
7018+ NOT_THE_CFLAGS=""
7019+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CLANG} supports -Wunused-command-line-argument, for NOT_THE_CFLAGS" >&5
7020+ $as_echo_n "checking whether ${CLANG} supports -Wunused-command-line-argument, for NOT_THE_CFLAGS... " >&6; }
7021+ if ${pgac_cv_prog_CLANG_cflags__Wunused_command_line_argument+:} false; then :
7022+ $as_echo_n "(cached) " >&6
7023+ else
7024+ pgac_save_CFLAGS=$CFLAGS
7025+ pgac_save_CC=$CC
7026+ CC=${CLANG}
7027+ CFLAGS="${NOT_THE_CFLAGS} -Wunused-command-line-argument"
7028+ ac_save_c_werror_flag=$ac_c_werror_flag
7029+ ac_c_werror_flag=yes
7030+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
7031+ /* end confdefs.h. */
7032+
7033+ int
7034+ main ()
7035+ {
7036+
7037+ ;
7038+ return 0;
7039+ }
7040+ _ACEOF
7041+ if ac_fn_c_try_compile "$LINENO"; then :
7042+ pgac_cv_prog_CLANG_cflags__Wunused_command_line_argument=yes
7043+ else
7044+ pgac_cv_prog_CLANG_cflags__Wunused_command_line_argument=no
7045+ fi
7046+ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
7047+ ac_c_werror_flag=$ac_save_c_werror_flag
7048+ CFLAGS="$pgac_save_CFLAGS"
7049+ CC="$pgac_save_CC"
7050+ fi
7051+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CLANG_cflags__Wunused_command_line_argument" >&5
7052+ $as_echo "$pgac_cv_prog_CLANG_cflags__Wunused_command_line_argument" >&6; }
7053+ if test x"$pgac_cv_prog_CLANG_cflags__Wunused_command_line_argument" = x"yes"; then
7054+ NOT_THE_CFLAGS="${NOT_THE_CFLAGS} -Wunused-command-line-argument"
7055+ fi
7056+
7057+ if test -n "$NOT_THE_CFLAGS"; then
7058+ BITCODE_CFLAGS="$BITCODE_CFLAGS -Wno-unused-command-line-argument"
7059+ fi
7060+ NOT_THE_CFLAGS=""
7061+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CLANG} supports -Wcompound-token-split-by-macro, for NOT_THE_CFLAGS" >&5
7062+ $as_echo_n "checking whether ${CLANG} supports -Wcompound-token-split-by-macro, for NOT_THE_CFLAGS... " >&6; }
7063+ if ${pgac_cv_prog_CLANG_cflags__Wcompound_token_split_by_macro+:} false; then :
7064+ $as_echo_n "(cached) " >&6
7065+ else
7066+ pgac_save_CFLAGS=$CFLAGS
7067+ pgac_save_CC=$CC
7068+ CC=${CLANG}
7069+ CFLAGS="${NOT_THE_CFLAGS} -Wcompound-token-split-by-macro"
7070+ ac_save_c_werror_flag=$ac_c_werror_flag
7071+ ac_c_werror_flag=yes
7072+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
7073+ /* end confdefs.h. */
7074+
7075+ int
7076+ main ()
7077+ {
7078+
7079+ ;
7080+ return 0;
7081+ }
7082+ _ACEOF
7083+ if ac_fn_c_try_compile "$LINENO"; then :
7084+ pgac_cv_prog_CLANG_cflags__Wcompound_token_split_by_macro=yes
7085+ else
7086+ pgac_cv_prog_CLANG_cflags__Wcompound_token_split_by_macro=no
7087+ fi
7088+ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
7089+ ac_c_werror_flag=$ac_save_c_werror_flag
7090+ CFLAGS="$pgac_save_CFLAGS"
7091+ CC="$pgac_save_CC"
7092+ fi
7093+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CLANG_cflags__Wcompound_token_split_by_macro" >&5
7094+ $as_echo "$pgac_cv_prog_CLANG_cflags__Wcompound_token_split_by_macro" >&6; }
7095+ if test x"$pgac_cv_prog_CLANG_cflags__Wcompound_token_split_by_macro" = x"yes"; then
7096+ NOT_THE_CFLAGS="${NOT_THE_CFLAGS} -Wcompound-token-split-by-macro"
7097+ fi
7098+
7099+ if test -n "$NOT_THE_CFLAGS"; then
7100+ BITCODE_CFLAGS="$BITCODE_CFLAGS -Wno-compound-token-split-by-macro"
7101+ fi
7102+ NOT_THE_CFLAGS=""
7103+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CLANG} supports -Wformat-truncation, for NOT_THE_CFLAGS" >&5
7104+ $as_echo_n "checking whether ${CLANG} supports -Wformat-truncation, for NOT_THE_CFLAGS... " >&6; }
7105+ if ${pgac_cv_prog_CLANG_cflags__Wformat_truncation+:} false; then :
7106+ $as_echo_n "(cached) " >&6
7107+ else
7108+ pgac_save_CFLAGS=$CFLAGS
7109+ pgac_save_CC=$CC
7110+ CC=${CLANG}
7111+ CFLAGS="${NOT_THE_CFLAGS} -Wformat-truncation"
7112+ ac_save_c_werror_flag=$ac_c_werror_flag
7113+ ac_c_werror_flag=yes
7114+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
7115+ /* end confdefs.h. */
7116+
7117+ int
7118+ main ()
7119+ {
7120+
7121+ ;
7122+ return 0;
7123+ }
7124+ _ACEOF
7125+ if ac_fn_c_try_compile "$LINENO"; then :
7126+ pgac_cv_prog_CLANG_cflags__Wformat_truncation=yes
7127+ else
7128+ pgac_cv_prog_CLANG_cflags__Wformat_truncation=no
7129+ fi
7130+ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
7131+ ac_c_werror_flag=$ac_save_c_werror_flag
7132+ CFLAGS="$pgac_save_CFLAGS"
7133+ CC="$pgac_save_CC"
7134+ fi
7135+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CLANG_cflags__Wformat_truncation" >&5
7136+ $as_echo "$pgac_cv_prog_CLANG_cflags__Wformat_truncation" >&6; }
7137+ if test x"$pgac_cv_prog_CLANG_cflags__Wformat_truncation" = x"yes"; then
7138+ NOT_THE_CFLAGS="${NOT_THE_CFLAGS} -Wformat-truncation"
7139+ fi
7140+
7141+ if test -n "$NOT_THE_CFLAGS"; then
7142+ BITCODE_CFLAGS="$BITCODE_CFLAGS -Wno-format-truncation"
7143+ fi
7144+ NOT_THE_CFLAGS=""
7145+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CLANG} supports -Wstringop-truncation, for NOT_THE_CFLAGS" >&5
7146+ $as_echo_n "checking whether ${CLANG} supports -Wstringop-truncation, for NOT_THE_CFLAGS... " >&6; }
7147+ if ${pgac_cv_prog_CLANG_cflags__Wstringop_truncation+:} false; then :
7148+ $as_echo_n "(cached) " >&6
7149+ else
7150+ pgac_save_CFLAGS=$CFLAGS
7151+ pgac_save_CC=$CC
7152+ CC=${CLANG}
7153+ CFLAGS="${NOT_THE_CFLAGS} -Wstringop-truncation"
7154+ ac_save_c_werror_flag=$ac_c_werror_flag
7155+ ac_c_werror_flag=yes
7156+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
7157+ /* end confdefs.h. */
7158+
7159+ int
7160+ main ()
7161+ {
7162+
7163+ ;
7164+ return 0;
7165+ }
7166+ _ACEOF
7167+ if ac_fn_c_try_compile "$LINENO"; then :
7168+ pgac_cv_prog_CLANG_cflags__Wstringop_truncation=yes
7169+ else
7170+ pgac_cv_prog_CLANG_cflags__Wstringop_truncation=no
7171+ fi
7172+ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
7173+ ac_c_werror_flag=$ac_save_c_werror_flag
7174+ CFLAGS="$pgac_save_CFLAGS"
7175+ CC="$pgac_save_CC"
7176+ fi
7177+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CLANG_cflags__Wstringop_truncation" >&5
7178+ $as_echo "$pgac_cv_prog_CLANG_cflags__Wstringop_truncation" >&6; }
7179+ if test x"$pgac_cv_prog_CLANG_cflags__Wstringop_truncation" = x"yes"; then
7180+ NOT_THE_CFLAGS="${NOT_THE_CFLAGS} -Wstringop-truncation"
7181+ fi
7182+
7183+ if test -n "$NOT_THE_CFLAGS"; then
7184+ BITCODE_CFLAGS="$BITCODE_CFLAGS -Wno-stringop-truncation"
7185+ fi
70107186fi
70117187
70127188# supply -g if --enable-debug