From patchwork Wed Jun 10 20:39:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 187782 Delivered-To: patch@linaro.org Received: by 2002:a92:cf06:0:0:0:0:0 with SMTP id c6csp817006ilo; Wed, 10 Jun 2020 13:41:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyVr9OC7QwaiNg9t7vp14Xv6ArJljPJDePqqJbHdIusJmEnBib1hhUrYZld9j59qAlVBU07 X-Received: by 2002:a25:50cc:: with SMTP id e195mr8783067ybb.483.1591821671972; Wed, 10 Jun 2020 13:41:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591821671; cv=none; d=google.com; s=arc-20160816; b=UfvILd8DZJqhPm31iRLuZPmE+lPlmnhdvVWstOyDXt/wF3FWSuWm6FEIqmpoMWJWtr UT7GMhqrqpdbgWit91havcL2KlAp3YsjKPjuq0V1LI1g5IN5dZA/4okcGbqvctG4Vpqk O78ytmbFCCwJ6oORJlNAoz2DEooYq6ekTnxpMzr4AJYoTmWAAnYHgMX8PupLbvPKzW3C N+bsChLzVkedACa8yMGVjWmMjN/DW/t0cmsy/GmvimhyrIL37tsLCvKR9HlVzMFBrf2d ZiklDIL0LsoZ124pTIzJhJyFRHAlZl2iTc6g0D7GynsgxmXUHsZI3pvmheApoU3PGOcM 9YYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=u1sk/YIU6t6fS+f6iDKix7y1NRK6wPD2A6SC61UJXGE=; b=apLBlMA5aAkVdst+2v6Klpd/imaJT5asz/663hPA1AnEBFY4Qo05x9o3A4F/b1zEZn o3ARI6WnDTLgf6DYT3ONuXhlc23puFe++sbvvRF/APfSrBQyjr9yVtDipaKqus02g1XS LK9u83BTFqb1eBth0bRNAvY3VrI+cJZ36+6L16/egVheineQK/DaRJb/VCxxOcefmpOQ uSwtri06HC0fzdzOzgEjMWP8w7LbuGQ1tbUhe6zDAuXhrF5AU+TZnv6RMiJkD54mLxXD /iO0OJPmShleaO5hBvT9QsQXFtP6PF7YF8XHpcGqC2yvu9uGhTdUZAeTunCEyabTmBU0 RJTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=QWdiry0J; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id w66si519737ybc.388.2020.06.10.13.41.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 10 Jun 2020 13:41:11 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=QWdiry0J; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:35246 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jj7X5-0003Uy-B6 for patch@linaro.org; Wed, 10 Jun 2020 16:41:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49166) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jj7Vt-0003Sz-4S for qemu-devel@nongnu.org; Wed, 10 Jun 2020 16:39:57 -0400 Received: from mail-pg1-x533.google.com ([2607:f8b0:4864:20::533]:36774) by eggs.gnu.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jj7Vs-0007hC-0k for qemu-devel@nongnu.org; Wed, 10 Jun 2020 16:39:56 -0400 Received: by mail-pg1-x533.google.com with SMTP id t7so1504980pgt.3 for ; Wed, 10 Jun 2020 13:39:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=u1sk/YIU6t6fS+f6iDKix7y1NRK6wPD2A6SC61UJXGE=; b=QWdiry0JryBfLnFEa0ekOd2vxhlMwgTy6YsT8PomYJETDLv0RanM7JovtKNPpdn9+0 8bYdcIUGwkgsd2BSZO05zCpvVIG57bRUtryKcZUdFnzvQefmvcAOopXLGiehHkzkmVhw eJeRI18lLK3wdmEJ/WxlqhdRQNfT+ckyiCdhu5nDoUFeUkAfZQcDQXtOcBmC1jEA8hO8 Zm71IEtHyB2zS1Cr5UOz7XjZen15BoNWyWtTlSMoi9EKLQUSJipKv+nBF3rbxW65VOPv QPNaZhraFX0J9rloHlPj3eA2djbGnBEJPk49phu67un8ALFxOz8iI+7K32vsPJ/xvEZ7 VfYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=u1sk/YIU6t6fS+f6iDKix7y1NRK6wPD2A6SC61UJXGE=; b=n8eiP7uuB35NhXxf0/2sg4RsY8kZQBFLoWw0p2I9lOIKRF16gQSavc7EqgtWuEU/jL pv4aG+1Bw6zGLN6o3kHHSXuaCfNOWnLI/q+nj627y5h/gxcCAmmrGUnJtKaJ8WnKKX5E zTolixgj5dv/TZK6GDOY5UehUH6dWpDKenn58cnnvE1awJZlU/CR44k+bqtub9UMkxMr GR/XoAbEMHbsbhR8Uhv3oSTdHD0CXdmI+qA25s9Eo+R4XBx7hFoQ8LPjbmakEPto4USI pW1SjYoWor8DZ7IisIQX+3tS6xU9ogkPhlPrUfcYARpjc1FkuK8uxUP04MZvpO6UsuL5 /0hw== X-Gm-Message-State: AOAM532pTljHw+RoydYZZdDSF7nnrg8KdKC9kdGus+bo1LglABOJ2mPg K6tnFc0IYB+srDbYxtKKv4cIE1Lacik= X-Received: by 2002:aa7:96b0:: with SMTP id g16mr4357312pfk.126.1591821587967; Wed, 10 Jun 2020 13:39:47 -0700 (PDT) Received: from localhost.localdomain (174-21-143-238.tukw.qwest.net. [174.21.143.238]) by smtp.gmail.com with ESMTPSA id g6sm740648pfb.164.2020.06.10.13.39.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jun 2020 13:39:47 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 3/5] configure: Clean up warning flag lists Date: Wed, 10 Jun 2020 13:39:40 -0700 Message-Id: <20200610203942.887374-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200610203942.887374-1-richard.henderson@linaro.org> References: <20200610203942.887374-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::533; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x533.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Use a helper function to tidy the assembly of gcc_flags. Separate flags that disable warnings from those that enable, and sort the disable warnings to the end. Suggested-by: Eric Blake Signed-off-by: Richard Henderson --- configure | 40 ++++++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 10 deletions(-) -- 2.25.1 diff --git a/configure b/configure index 597e909b53..464202e375 100755 --- a/configure +++ b/configure @@ -97,6 +97,11 @@ do_cxx() { do_compiler "$cxx" "$@" } +# Append $2 to the variable named $1, with space separation +add_to() { + eval $1=\${$1:+\"\$$1 \"}\$2 +} + update_cxxflags() { # Set QEMU_CXXFLAGS from QEMU_CFLAGS by filtering out those # options which some versions of GCC's C++ compiler complain about @@ -2007,16 +2012,31 @@ if ! compile_prog "" "" ; then error_exit "You need at least GCC v4.8 or Clang v3.4 (or XCode Clang v5.1)" fi -gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits" -gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags" -gcc_flags="-Wno-missing-include-dirs -Wempty-body -Wnested-externs $gcc_flags" -gcc_flags="-Wendif-labels -Wno-shift-negative-value $gcc_flags" -gcc_flags="-Wno-initializer-overrides -Wexpansion-to-defined $gcc_flags" -gcc_flags="-Wno-string-plus-int -Wno-typedef-redefinition $gcc_flags" -# Note that we do not add -Werror to gcc_flags here, 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. +# 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. + +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 -Wno-initializer-overrides +add_to warn_flags -Wexpansion-to-defined + +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 + +gcc_flags="$warn_flags $nowarn_flags" cc_has_warning_flag() { write_c_skeleton;