From patchwork Wed Jun 17 04:37:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 188111 Delivered-To: patch@linaro.org Received: by 2002:a92:cf06:0:0:0:0:0 with SMTP id c6csp123882ilo; Tue, 16 Jun 2020 21:38:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzyvKNMHY+s+Gg7dQdA1v3Rl46hZzDgWwYnIkWKl49NATcRXaj7mYT/KSNsh0aWDogPvvaA X-Received: by 2002:a05:6902:6cd:: with SMTP id m13mr9660706ybt.29.1592368700380; Tue, 16 Jun 2020 21:38:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592368700; cv=none; d=google.com; s=arc-20160816; b=vHCFW+hCgFglUDETBEMCmiIF3liF63SaelJHh1eHE2VE0/TbuRoPLtxUgY6vhmOrMN ejQX16JBspQ9322J+s9d79Unb1ga4Z0BHEcIcnxaPzwMis+70G5KC+b9tHk6+TuF1zS2 KHOwpFMgWHEPVsEcngwJUFOH4kBNajn5zyULEJ9M2PJ1+3AgBw4dy30kJ6fpDe0GqX95 rBFX1WHglu1ijFO3giMIv4r33z2LIhguDjCA+pOH1m8E6DbojSDMtYa0rUU+IRMtlkGh LzbQKN3OH7FdhAY2wLRnFQkaeogyoMWu/qqgHb0GP+ucPWOCXzLkzCX2mjnjvCUwuqmc nz+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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=kaW8P+svDRMLkdL4p/i5g0Y7teIr71hNo2cIxCcePk4=; b=nCvGBk5JM3XYXVw+SnCVBU7K4oYQ3YaaHomWMYtio1/w4Hm78NYfoN8lcte5qql5Yt YUaaZWaCuwdEaPjVQbR50BRmJUR762+tUGLE/t+4VPgAUeb+pqFsDnVTzH4jLS1pfu8C qKoqdqbFGoXIu/1Rg0XT1sU2kts/l3NQMbUHFVt9cHnFqrRDKSmg+N3OMR6CPaw5pDaC W/A8l8/xZQpxbx2vAOU+ZtSxf//T/Lr+Vw074EvEAGO9fiABOiqUL5f5aHj8ii1iFpg5 IXqDzS+Jdj5g20NvAqHPPUzL5xqvOvPB0n8RnIelZ3YcDRsxQIcZLBAq7bU6L31V9Jq7 QdiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=J1Wq3Lkm; 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 t128si18717744ybf.135.2020.06.16.21.38.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 16 Jun 2020 21:38:20 -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=J1Wq3Lkm; 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]:60858 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlPq7-0006q3-RS for patch@linaro.org; Wed, 17 Jun 2020 00:38:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36110) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlPpu-0006ml-GG for qemu-devel@nongnu.org; Wed, 17 Jun 2020 00:38:06 -0400 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]:35791) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlPps-0001TK-PC for qemu-devel@nongnu.org; Wed, 17 Jun 2020 00:38:06 -0400 Received: by mail-pg1-x541.google.com with SMTP id s135so666286pgs.2 for ; Tue, 16 Jun 2020 21:38:04 -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=kaW8P+svDRMLkdL4p/i5g0Y7teIr71hNo2cIxCcePk4=; b=J1Wq3Lkmyr8GkiYUSAzwY17jqQdCsba1fHo/hT4atUgo177CYGxQx0ExSOYcZ4j63L e6ZrVPSCR5PrJtneZ+kE+GdCKeaHnPPJgTlsqTw0fFuMFsgwE18zp3aL+LCLykw2yjJ0 kvNWdU6ujbM6ZXxKfqI7ilbXg2ULH/axFtnZLms8VsNoMgkpkigvGWQk89iwxFfPTDEQ bSmVFvJno3amnO1mZ/BX28WYtH1NJRpTW1ptk/BK0aP+JlMn3B9KsM8syD6KKGCbG3/h KwISR/A8FSu0CckjFezySDxd75WRAvOMjToWYLyY7/zu/nPUwn/yVQfjCTuSqppEddn0 +A8w== 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=kaW8P+svDRMLkdL4p/i5g0Y7teIr71hNo2cIxCcePk4=; b=H3XVVWG0eZdb6MonTY94zuhHXSr13Tct0CbAZ2v3uzCv13ykp6wrDA8SdxzbkmmaiX 14mDzN3HGrZdAmM6lcHJV4y+WKsC/hmIulKRANDqMH7Y+0sYTGIjzbJwSe3GVWG2Ac5F Ib5AnjvWq+fZs7i+HBt5xtKQ984chmbWN/v+s5CqIoSdaIQ9EpRLcrEWPKB5p6JR5LZy ED1XX9wTZsohKgvrs69okJpSlS2oStb2FJo1mD+6Ms+Hp6A9r9AIOapriotWA4XJMuOD 3sQYysntjXidqzV6y+IjHruS29D9cuvfbpG93M6SiEZQt7al0uCaHYM5038M/qxGQkR9 jtRg== X-Gm-Message-State: AOAM532f0x4Fh5r7fFbq54Y0dRPaF9BIfC8Xdyw8yE+7tC1G45J73A+f y5xobnrtQy42w9EuTTcWkRSt+6ytGGQ= X-Received: by 2002:a62:7f58:: with SMTP id a85mr5185003pfd.89.1592368682954; Tue, 16 Jun 2020 21:38:02 -0700 (PDT) Received: from localhost.localdomain (174-21-143-238.tukw.qwest.net. [174.21.143.238]) by smtp.gmail.com with ESMTPSA id x3sm18585808pfi.57.2020.06.16.21.38.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jun 2020 21:38:02 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 3/5] configure: Clean up warning flag lists Date: Tue, 16 Jun 2020 21:37:55 -0700 Message-Id: <20200617043757.1623337-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200617043757.1623337-1-richard.henderson@linaro.org> References: <20200617043757.1623337-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::541; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x541.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: , Cc: alex.bennee@linaro.org 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 | 42 ++++++++++++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 10 deletions(-) -- 2.25.1 Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Alex Bennée diff --git a/configure b/configure index b01b5e3bed..a8bef95282 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 @@ -2024,16 +2029,33 @@ 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. + +warn_flags= +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 + +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 + +gcc_flags="$warn_flags $nowarn_flags" cc_has_warning_flag() { write_c_skeleton;