fi
# When generating bitcode (for inlining) we always want to use -O2
-# even when --enable-debug is specified. The bitcode it's not going to
+# even when --enable-debug is specified. The bitcode is not going to
# be used for line-by-line debugging, and JIT inlining doesn't work
# without at least -O1 (otherwise clang will emit 'noinline'
# attributes everywhere), which is bad for testing. Still allow the
fi
- # We want to suppress clang's unhelpful unused-command-line-argument warnings
- # but gcc won't complain about unrecognized -Wno-foo switches, so we have to
- # test for the positive form and if that works, add the negative form
+ #
+ # The following tests want to suppress various unhelpful warnings by adding
+ # -Wno-foo switches. But gcc won't complain about unrecognized -Wno-foo
+ # switches, so we have to test for the positive form and if that works,
+ # add the negative form. Note that tests of this form typically need to
+ # be duplicated in the BITCODE_CFLAGS setup stanza below.
+ #
+ # Suppress clang's unhelpful unused-command-line-argument warnings.
NOT_THE_CFLAGS=""
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -Wunused-command-line-argument, for NOT_THE_CFLAGS" >&5
$as_echo_n "checking whether ${CC} supports -Wunused-command-line-argument, for NOT_THE_CFLAGS... " >&6; }
CFLAGS="$CFLAGS -Wno-unused-command-line-argument"
fi
# Remove clang 12+'s compound-token-split-by-macro, as this causes a lot
- # of warnings when building plperl because of Perl. Like previously, test
- # for the positive form and add the negative form
+ # of warnings when building plperl because of usages in the Perl headers.
NOT_THE_CFLAGS=""
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -Wcompound-token-split-by-macro, for NOT_THE_CFLAGS" >&5
$as_echo_n "checking whether ${CC} supports -Wcompound-token-split-by-macro, for NOT_THE_CFLAGS... " >&6; }
-# Determine flags used to emit bitcode for JIT inlining. Need to test
-# for behaviour changing compiler flags, to keep compatibility with
-# compiler used for normal postgres code.
+# Determine flags used to emit bitcode for JIT inlining.
+# 1. We must duplicate any behaviour-changing compiler flags used above,
+# to keep compatibility with the compiler used for normal Postgres code.
+# 2. We don't bother to duplicate extra-warnings switches --- seeing a
+# warning in the main build is enough.
+# 3. But we must duplicate -Wno-warning flags, else we'll see those anyway.
if test "$with_llvm" = yes ; then
CLANGXX="$CLANG -xc++"
BITCODE_CXXFLAGS="${BITCODE_CXXFLAGS} -fexcess-precision=standard"
fi
+
+ NOT_THE_CFLAGS=""
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CLANG} supports -Wunused-command-line-argument, for NOT_THE_CFLAGS" >&5
+$as_echo_n "checking whether ${CLANG} supports -Wunused-command-line-argument, for NOT_THE_CFLAGS... " >&6; }
+if ${pgac_cv_prog_CLANG_cflags__Wunused_command_line_argument+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ pgac_save_CFLAGS=$CFLAGS
+pgac_save_CC=$CC
+CC=${CLANG}
+CFLAGS="${NOT_THE_CFLAGS} -Wunused-command-line-argument"
+ac_save_c_werror_flag=$ac_c_werror_flag
+ac_c_werror_flag=yes
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ pgac_cv_prog_CLANG_cflags__Wunused_command_line_argument=yes
+else
+ pgac_cv_prog_CLANG_cflags__Wunused_command_line_argument=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_c_werror_flag=$ac_save_c_werror_flag
+CFLAGS="$pgac_save_CFLAGS"
+CC="$pgac_save_CC"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CLANG_cflags__Wunused_command_line_argument" >&5
+$as_echo "$pgac_cv_prog_CLANG_cflags__Wunused_command_line_argument" >&6; }
+if test x"$pgac_cv_prog_CLANG_cflags__Wunused_command_line_argument" = x"yes"; then
+ NOT_THE_CFLAGS="${NOT_THE_CFLAGS} -Wunused-command-line-argument"
+fi
+
+ if test -n "$NOT_THE_CFLAGS"; then
+ BITCODE_CFLAGS="$BITCODE_CFLAGS -Wno-unused-command-line-argument"
+ fi
+ NOT_THE_CFLAGS=""
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CLANG} supports -Wcompound-token-split-by-macro, for NOT_THE_CFLAGS" >&5
+$as_echo_n "checking whether ${CLANG} supports -Wcompound-token-split-by-macro, for NOT_THE_CFLAGS... " >&6; }
+if ${pgac_cv_prog_CLANG_cflags__Wcompound_token_split_by_macro+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ pgac_save_CFLAGS=$CFLAGS
+pgac_save_CC=$CC
+CC=${CLANG}
+CFLAGS="${NOT_THE_CFLAGS} -Wcompound-token-split-by-macro"
+ac_save_c_werror_flag=$ac_c_werror_flag
+ac_c_werror_flag=yes
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ pgac_cv_prog_CLANG_cflags__Wcompound_token_split_by_macro=yes
+else
+ pgac_cv_prog_CLANG_cflags__Wcompound_token_split_by_macro=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_c_werror_flag=$ac_save_c_werror_flag
+CFLAGS="$pgac_save_CFLAGS"
+CC="$pgac_save_CC"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CLANG_cflags__Wcompound_token_split_by_macro" >&5
+$as_echo "$pgac_cv_prog_CLANG_cflags__Wcompound_token_split_by_macro" >&6; }
+if test x"$pgac_cv_prog_CLANG_cflags__Wcompound_token_split_by_macro" = x"yes"; then
+ NOT_THE_CFLAGS="${NOT_THE_CFLAGS} -Wcompound-token-split-by-macro"
+fi
+
+ if test -n "$NOT_THE_CFLAGS"; then
+ BITCODE_CFLAGS="$BITCODE_CFLAGS -Wno-compound-token-split-by-macro"
+ fi
+ NOT_THE_CFLAGS=""
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CLANG} supports -Wformat-truncation, for NOT_THE_CFLAGS" >&5
+$as_echo_n "checking whether ${CLANG} supports -Wformat-truncation, for NOT_THE_CFLAGS... " >&6; }
+if ${pgac_cv_prog_CLANG_cflags__Wformat_truncation+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ pgac_save_CFLAGS=$CFLAGS
+pgac_save_CC=$CC
+CC=${CLANG}
+CFLAGS="${NOT_THE_CFLAGS} -Wformat-truncation"
+ac_save_c_werror_flag=$ac_c_werror_flag
+ac_c_werror_flag=yes
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ pgac_cv_prog_CLANG_cflags__Wformat_truncation=yes
+else
+ pgac_cv_prog_CLANG_cflags__Wformat_truncation=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_c_werror_flag=$ac_save_c_werror_flag
+CFLAGS="$pgac_save_CFLAGS"
+CC="$pgac_save_CC"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CLANG_cflags__Wformat_truncation" >&5
+$as_echo "$pgac_cv_prog_CLANG_cflags__Wformat_truncation" >&6; }
+if test x"$pgac_cv_prog_CLANG_cflags__Wformat_truncation" = x"yes"; then
+ NOT_THE_CFLAGS="${NOT_THE_CFLAGS} -Wformat-truncation"
+fi
+
+ if test -n "$NOT_THE_CFLAGS"; then
+ BITCODE_CFLAGS="$BITCODE_CFLAGS -Wno-format-truncation"
+ fi
+ NOT_THE_CFLAGS=""
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CLANG} supports -Wstringop-truncation, for NOT_THE_CFLAGS" >&5
+$as_echo_n "checking whether ${CLANG} supports -Wstringop-truncation, for NOT_THE_CFLAGS... " >&6; }
+if ${pgac_cv_prog_CLANG_cflags__Wstringop_truncation+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ pgac_save_CFLAGS=$CFLAGS
+pgac_save_CC=$CC
+CC=${CLANG}
+CFLAGS="${NOT_THE_CFLAGS} -Wstringop-truncation"
+ac_save_c_werror_flag=$ac_c_werror_flag
+ac_c_werror_flag=yes
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ pgac_cv_prog_CLANG_cflags__Wstringop_truncation=yes
+else
+ pgac_cv_prog_CLANG_cflags__Wstringop_truncation=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_c_werror_flag=$ac_save_c_werror_flag
+CFLAGS="$pgac_save_CFLAGS"
+CC="$pgac_save_CC"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CLANG_cflags__Wstringop_truncation" >&5
+$as_echo "$pgac_cv_prog_CLANG_cflags__Wstringop_truncation" >&6; }
+if test x"$pgac_cv_prog_CLANG_cflags__Wstringop_truncation" = x"yes"; then
+ NOT_THE_CFLAGS="${NOT_THE_CFLAGS} -Wstringop-truncation"
+fi
+
+ if test -n "$NOT_THE_CFLAGS"; then
+ BITCODE_CFLAGS="$BITCODE_CFLAGS -Wno-stringop-truncation"
+ fi
fi
# supply -g if --enable-debug
fi
# When generating bitcode (for inlining) we always want to use -O2
-# even when --enable-debug is specified. The bitcode it's not going to
+# even when --enable-debug is specified. The bitcode is not going to
# be used for line-by-line debugging, and JIT inlining doesn't work
# without at least -O1 (otherwise clang will emit 'noinline'
# attributes everywhere), which is bad for testing. Still allow the
PGAC_PROG_CC_VAR_OPT(CFLAGS_UNROLL_LOOPS, [-funroll-loops])
# Optimization flags for specific files that benefit from vectorization
PGAC_PROG_CC_VAR_OPT(CFLAGS_VECTORIZE, [-ftree-vectorize])
- # We want to suppress clang's unhelpful unused-command-line-argument warnings
- # but gcc won't complain about unrecognized -Wno-foo switches, so we have to
- # test for the positive form and if that works, add the negative form
+ #
+ # The following tests want to suppress various unhelpful warnings by adding
+ # -Wno-foo switches. But gcc won't complain about unrecognized -Wno-foo
+ # switches, so we have to test for the positive form and if that works,
+ # add the negative form. Note that tests of this form typically need to
+ # be duplicated in the BITCODE_CFLAGS setup stanza below.
+ #
+ # Suppress clang's unhelpful unused-command-line-argument warnings.
NOT_THE_CFLAGS=""
PGAC_PROG_CC_VAR_OPT(NOT_THE_CFLAGS, [-Wunused-command-line-argument])
if test -n "$NOT_THE_CFLAGS"; then
CFLAGS="$CFLAGS -Wno-unused-command-line-argument"
fi
# Remove clang 12+'s compound-token-split-by-macro, as this causes a lot
- # of warnings when building plperl because of Perl. Like previously, test
- # for the positive form and add the negative form
+ # of warnings when building plperl because of usages in the Perl headers.
NOT_THE_CFLAGS=""
PGAC_PROG_CC_VAR_OPT(NOT_THE_CFLAGS, [-Wcompound-token-split-by-macro])
if test -n "$NOT_THE_CFLAGS"; then
AC_SUBST(CFLAGS_UNROLL_LOOPS)
AC_SUBST(CFLAGS_VECTORIZE)
-# Determine flags used to emit bitcode for JIT inlining. Need to test
-# for behaviour changing compiler flags, to keep compatibility with
-# compiler used for normal postgres code.
+# Determine flags used to emit bitcode for JIT inlining.
+# 1. We must duplicate any behaviour-changing compiler flags used above,
+# to keep compatibility with the compiler used for normal Postgres code.
+# 2. We don't bother to duplicate extra-warnings switches --- seeing a
+# warning in the main build is enough.
+# 3. But we must duplicate -Wno-warning flags, else we'll see those anyway.
if test "$with_llvm" = yes ; then
CLANGXX="$CLANG -xc++"
PGAC_PROG_VARCXX_VARFLAGS_OPT(CLANGXX, BITCODE_CXXFLAGS, [-fwrapv])
PGAC_PROG_VARCC_VARFLAGS_OPT(CLANG, BITCODE_CFLAGS, [-fexcess-precision=standard])
PGAC_PROG_VARCXX_VARFLAGS_OPT(CLANGXX, BITCODE_CXXFLAGS, [-fexcess-precision=standard])
+
+ NOT_THE_CFLAGS=""
+ PGAC_PROG_VARCC_VARFLAGS_OPT(CLANG, NOT_THE_CFLAGS, [-Wunused-command-line-argument])
+ if test -n "$NOT_THE_CFLAGS"; then
+ BITCODE_CFLAGS="$BITCODE_CFLAGS -Wno-unused-command-line-argument"
+ fi
+ NOT_THE_CFLAGS=""
+ PGAC_PROG_VARCC_VARFLAGS_OPT(CLANG, NOT_THE_CFLAGS, [-Wcompound-token-split-by-macro])
+ if test -n "$NOT_THE_CFLAGS"; then
+ BITCODE_CFLAGS="$BITCODE_CFLAGS -Wno-compound-token-split-by-macro"
+ fi
+ NOT_THE_CFLAGS=""
+ PGAC_PROG_VARCC_VARFLAGS_OPT(CLANG, NOT_THE_CFLAGS, [-Wformat-truncation])
+ if test -n "$NOT_THE_CFLAGS"; then
+ BITCODE_CFLAGS="$BITCODE_CFLAGS -Wno-format-truncation"
+ fi
+ NOT_THE_CFLAGS=""
+ PGAC_PROG_VARCC_VARFLAGS_OPT(CLANG, NOT_THE_CFLAGS, [-Wstringop-truncation])
+ if test -n "$NOT_THE_CFLAGS"; then
+ BITCODE_CFLAGS="$BITCODE_CFLAGS -Wno-stringop-truncation"
+ fi
fi
# supply -g if --enable-debug