From patchwork Wed Jun 17 20:13:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 190895 Delivered-To: patch@linaro.org Received: by 2002:a92:cf06:0:0:0:0:0 with SMTP id c6csp767430ilo; Wed, 17 Jun 2020 13:14:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJznqlFu5aIjpFcGSA18zIOp4l4OICtG3dkSiB9zOGTemSEqUfcxgewIxCuXQv5woOOY5r4E X-Received: by 2002:a37:b0b:: with SMTP id 11mr440770qkl.22.1592424892748; Wed, 17 Jun 2020 13:14:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592424892; cv=none; d=google.com; s=arc-20160816; b=F9FlsgBLiIEB5dUSdFkSNKSiV/Xcavx25uYXC3OoqTxAzQRExRec1fvnNzXL1umbdF ekHL+uG2/6MSs74RpamvId9je8KOSaAI9qZfcIaBDLCjdd6ZqLzrekiFUr6c6QTOW1to kSSPWNhHeyA1JuSJMlGapoNkP0Wk9b6cjNfqn0vU65l7ndbl5AY8sWxXLdsLDajtyF++ 2f/EPFy0mh9SThrfTmi8U7adHpWF24+8R57C/SZk9Qls/AH6Af9Nnxbz4PNNPrfly5hX YETGx2XEglnKkPxfJ33WWHK79BnP4uYqz8mWZlax42zoe2ktoo3cZ6zfZ6iGVjd796lp /37g== 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=4r5DXyEg7egNkGt1Nf25Vhx3ygxyImevDYCxFLgjPzU=; b=ZHmPPdkKOaOYJRvd5kYXBcGXulleRhBLO0d9cd5Bv/xO0HVwmOJuXryXETms9M6z33 qw/PQa8CRI31sRthq7C+hXGLZGOlKPUinsoSOGoP9AsCvJQopXCnj7A59kuo5irr8qCD jLZauMJfyWp+b5JVielV+UzX5fKYDA5v6fHBbrEBVCo/lEMbFUcNmS0Nxd/k5JjVMJDW 5+29SzU2lrmUpA6cvg5petPYY07C3jnR3ZrxZ9yqp6yXWSW3qy67zPmQPT2kPFH/J30I o6wx70DpwvSIRPOUeVCtneGTsBbebwYhAXv3sd/EIxQ6PI3gkQ9TQIPqD6J+xWOHqfue mj1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=nEHHWw3o; 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 h123si399875qke.183.2020.06.17.13.14.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 17 Jun 2020 13:14:52 -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=nEHHWw3o; 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]:37122 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jleSS-0008Hz-7R for patch@linaro.org; Wed, 17 Jun 2020 16:14:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52832) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jleQy-0005jT-9N for qemu-devel@nongnu.org; Wed, 17 Jun 2020 16:13:20 -0400 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]:41742) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jleQw-0000IJ-Cj for qemu-devel@nongnu.org; Wed, 17 Jun 2020 16:13:19 -0400 Received: by mail-pf1-x434.google.com with SMTP id 10so1670908pfx.8 for ; Wed, 17 Jun 2020 13:13:18 -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=4r5DXyEg7egNkGt1Nf25Vhx3ygxyImevDYCxFLgjPzU=; b=nEHHWw3oibbmDoeUs+w54bTWDfuirqvZX9ZTZbPvYL13/GJskcUo2gN3f1TtE1fCkd HAe9L6kJtrghT5PJiDYAxg9ImPeBrLPmAPtOLW/m1hwocJ39ovvXqLgugnMNYaVNpNxl +HUzdxxfPGjIPrtbNZNSWKH0wDD7Sqbv9DJmAOVRXBch827VTDol7o1QaAC7iGHOqfcw oifQK6nfO+YVOM2JEc5KBuJ3dGfVFRZgPUL7MALJoBN22evHlkyvpMONuEdIYHp7ZBFx fcC5wLezqK3Lz1Dt2vpvtmoXR/Uc2d+GISRiuOsYbVCT8wjGrD1xRApMGP/GDHw4GZz9 B+TA== 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=4r5DXyEg7egNkGt1Nf25Vhx3ygxyImevDYCxFLgjPzU=; b=MNkdxI52w2TdAfHIQ0QL/JZYoJEbQuM0IsTn4ddFIRurylgWaPP0d0g772n8/wG4bG n46HwtOgOqXlTK5kacn9FCzqAuWxLNWRMC+6yn0XnStCCFoBseQ47OcuZ6q7bbCH3rdx EDllaOibXTJPjLr9AdZHEquvSpr/v9wKNE8T7HqUrcn6qxa8DlLdujT55De7toM945kK S9nX/WfUqxQSanf9+WeGMZRRKrUTpmeZrOS3tDbnzVI94aM32J2y5A2bqFTKR4pUMhoP qJoHw9ARAg9qpzWCROBNDKYsQ1wMnspQFNR/0BwV5dB7p4NOkXRHB4jhYOXykTSlQQ4v PqYw== X-Gm-Message-State: AOAM533PBCrEz3kn7PhsaOMq7M0QRyZXYJLp8lFFn6LBLjPztwsDGQQ5 kSnIpZsf4LBwMqSI/6hHeViI7wW6E7I= X-Received: by 2002:a62:a510:: with SMTP id v16mr455570pfm.154.1592424796560; Wed, 17 Jun 2020 13:13:16 -0700 (PDT) Received: from localhost.localdomain (174-21-143-238.tukw.qwest.net. [174.21.143.238]) by smtp.gmail.com with ESMTPSA id h9sm659259pfe.32.2020.06.17.13.13.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 13:13:15 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v4 3/6] configure: Clean up warning flag lists Date: Wed, 17 Jun 2020 13:13:06 -0700 Message-Id: <20200617201309.1640952-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200617201309.1640952-1-richard.henderson@linaro.org> References: <20200617201309.1640952-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::434; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x434.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: philmd@redhat.com, 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. Reviewed-by: Alex Bennée Reviewed-by: Philippe Mathieu-Daudé Suggested-by: Eric Blake Signed-off-by: Richard Henderson --- configure | 42 ++++++++++++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 10 deletions(-) -- 2.25.1 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;