aboutsummaryrefslogtreecommitdiff
path: root/configure
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2022-12-22 09:28:56 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2023-05-18 13:35:28 +0200
commit95caf1fb4230d64f7b5e117c6ea988ae38f76aa0 (patch)
treeb7af154ba26faf01e773ac4ce50f6052019324cb /configure
parent911d4caaa267c43a5aa727f5a100e9122158e989 (diff)
build: move warning flag selection to meson
Meson already knows to test with the positive form of the flag, which simplifies the test. Warnings are now tested explicitly for the C++ compiler, instead of hardcoding those that are only available for the C language. At this point all compiler flags in QEMU_CFLAGS are global and only depend on the OS. No feature tests are performed in configure. Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure86
1 files changed, 0 insertions, 86 deletions
diff --git a/configure b/configure
index e215b60ce7..cb42749d25 100755
--- a/configure
+++ b/configure
@@ -79,7 +79,6 @@ fi
TMPB="qemu-conf"
TMPC="${TMPDIR1}/${TMPB}.c"
TMPO="${TMPDIR1}/${TMPB}.o"
-TMPM="${TMPDIR1}/${TMPB}.m"
TMPE="${TMPDIR1}/${TMPB}.exe"
rm -f config.log
@@ -162,15 +161,6 @@ do_cc() {
do_compiler_werror "$cc" $CPU_CFLAGS "$@"
}
-do_objc() {
- do_compiler_werror "$objcc" $CPU_CFLAGS "$@"
-}
-
-# Append $2 to the variable named $1, with space separation
-add_to() {
- eval $1=\${$1:+\"\$$1 \"}\$2
-}
-
compile_object() {
local_cflags="$1"
do_cc $CFLAGS $EXTRA_CFLAGS $CONFIGURE_CFLAGS $QEMU_CFLAGS $local_cflags -c -o $TMPO $TMPC
@@ -1186,81 +1176,6 @@ if ! compile_prog "" "" ; then
error_exit "You need at least GCC v7.4 or Clang v10.0 (or XCode Clang v12.0)"
fi
-# Accumulate -Wfoo and -Wno-bar separately.
-# We will list all of the enable flags first, and the disable flags second.
-# Note that we do not add -Werror, because that would enable it for all
-# configure tests. If a configure test failed due to -Werror this would
-# just silently disable some features, so it's too error prone.
-
-warn_flags=
-add_to warn_flags -Wundef
-add_to warn_flags -Wwrite-strings
-add_to warn_flags -Wmissing-prototypes
-add_to warn_flags -Wstrict-prototypes
-add_to warn_flags -Wredundant-decls
-add_to warn_flags -Wold-style-declaration
-add_to warn_flags -Wold-style-definition
-add_to warn_flags -Wtype-limits
-add_to warn_flags -Wformat-security
-add_to warn_flags -Wformat-y2k
-add_to warn_flags -Winit-self
-add_to warn_flags -Wignored-qualifiers
-add_to warn_flags -Wempty-body
-add_to warn_flags -Wnested-externs
-add_to warn_flags -Wendif-labels
-add_to warn_flags -Wexpansion-to-defined
-add_to warn_flags -Wimplicit-fallthrough=2
-add_to warn_flags -Wmissing-format-attribute
-
-if test "$targetos" != "darwin"; then
- add_to warn_flags -Wthread-safety
-fi
-
-nowarn_flags=
-add_to nowarn_flags -Wno-initializer-overrides
-add_to nowarn_flags -Wno-missing-include-dirs
-add_to nowarn_flags -Wno-shift-negative-value
-add_to nowarn_flags -Wno-string-plus-int
-add_to nowarn_flags -Wno-typedef-redefinition
-add_to nowarn_flags -Wno-tautological-type-limit-compare
-add_to nowarn_flags -Wno-psabi
-add_to nowarn_flags -Wno-gnu-variable-sized-type-not-at-end
-
-gcc_flags="$warn_flags $nowarn_flags"
-
-cc_has_warning_flag() {
- write_c_skeleton;
-
- # Use the positive sense of the flag when testing for -Wno-wombat
- # support (gcc will happily accept the -Wno- form of unknown
- # warning options).
- optflag="$(echo $1 | sed -e 's/^-Wno-/-W/')"
- compile_prog "-Werror $optflag" ""
-}
-
-objcc_has_warning_flag() {
- cat > $TMPM <<EOF
-int main(void) { return 0; }
-EOF
-
- # Use the positive sense of the flag when testing for -Wno-wombat
- # support (gcc will happily accept the -Wno- form of unknown
- # warning options).
- optflag="$(echo $1 | sed -e 's/^-Wno-/-W/')"
- do_objc -Werror $optflag \
- $OBJCFLAGS $EXTRA_OBJCFLAGS $CONFIGURE_OBJCFLAGS $QEMU_OBJCFLAGS \
- -o $TMPE $TMPM
-}
-
-for flag in $gcc_flags; do
- if cc_has_warning_flag $flag ; then
- QEMU_CFLAGS="$QEMU_CFLAGS $flag"
- fi
- if objcc_has_warning_flag $flag ; then
- QEMU_OBJCFLAGS="$QEMU_OBJCFLAGS $flag"
- fi
-done
-
if test "$static" = "yes" ; then
if test "$plugins" = "yes"; then
error_exit "static and plugins are mutually incompatible"
@@ -2017,7 +1932,6 @@ echo "NINJA=$ninja" >> $config_host_mak
echo "PKG_CONFIG=${pkg_config}" >> $config_host_mak
echo "CC=$cc" >> $config_host_mak
echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
-echo "QEMU_OBJCFLAGS=$QEMU_OBJCFLAGS" >> $config_host_mak
echo "EXESUF=$EXESUF" >> $config_host_mak
# use included Linux headers