From nobody Mon Feb 9 01:45:38 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1617879529; cv=none; d=zohomail.com; s=zohoarc; b=U4cvYGTPTKewgmB/fwSl0yxGCZ5whidqFObyx6yRVjmxtDj+BAOYgmWa0FO9eZxzkVLgLws80Bn6HkQ8SfnVKtOayom3NU6ufoPXRjXQvrUahF6/LcvH/psCxEcl6gfxDoZOMUfVO5PeLnex3N8jNCsPVISuuHN83j1uYLip93E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617879529; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=E/vWOhn7AP7EH1R1UsvCMeC10stj6j5smDJ7M+gRhck=; b=AX6pv9poxOVQHsSi5F/GAfu2JEjKCOQrZ9bT7s24EoDYQkW4Qn5TuZSqUNMxhUmD1aL0Eo9iwtbgaSxIMRHtVBSHxRKhYiTlKSOFWYdZydTImSjOW3xCeZ6hesAMmJLY3b17qCXLbTu/Wps7D1Llp88c2lKGkI1ieYvoHxsCZq8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1617879529117963.3294306703089; Thu, 8 Apr 2021 03:58:49 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-498-0yAplSHxMBuFM0eRNJ4hIw-1; Thu, 08 Apr 2021 06:58:45 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D70C018BA28E; Thu, 8 Apr 2021 10:58:37 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B311351C96; Thu, 8 Apr 2021 10:58:37 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 7589C1806D11; Thu, 8 Apr 2021 10:58:37 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 138AwXbH006244 for ; Thu, 8 Apr 2021 06:58:33 -0400 Received: by smtp.corp.redhat.com (Postfix) id 922F710016FD; Thu, 8 Apr 2021 10:58:33 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-115-81.ams2.redhat.com [10.36.115.81]) by smtp.corp.redhat.com (Postfix) with ESMTP id BB8CE10013D7; Thu, 8 Apr 2021 10:58:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617879527; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=E/vWOhn7AP7EH1R1UsvCMeC10stj6j5smDJ7M+gRhck=; b=BawvOJO1S0KuuL/Cnk+UjxIIl34ON+SKhPpxnFoPNUytXNCzd4oPGMWd0+DGEyJ/CbmaWU z7FbE/5v8QXvMEsD7c29y9w1fvQ34jXSPMYj7LSZt4IeRn8Fj0hjVj8JZHQH9xv1DjE/II 8MTvdw8dsNL/E89T8SsfzY7nhc/DMGU= X-MC-Unique: 0yAplSHxMBuFM0eRNJ4hIw-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 4/6] meson: avoid checking compiler flags twice Date: Thu, 8 Apr 2021 11:58:21 +0100 Message-Id: <20210408105823.462584-5-berrange@redhat.com> In-Reply-To: <20210408105823.462584-1-berrange@redhat.com> References: <20210408105823.462584-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) In several cases we check if a compiler flag is supported, and then add it to the 'cc_flags' array. The entire 'cc_flags' array is then later tested to see if each flag is supported, which duplicates the check in some cases. Move the check of cc_flags earlier, and for the extra flags append directly to supported_cc_flags to avoid the duplicate check Signed-off-by: Daniel P. Berrang=C3=A9 --- meson.build | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/meson.build b/meson.build index 55dde6d963..cf0e4f5715 100644 --- a/meson.build +++ b/meson.build @@ -398,6 +398,8 @@ cc_flags +=3D [ '-Wwrite-strings', ] =20 +supported_cc_flags =3D cc.get_supported_arguments(cc_flags) + # on aarch64 error: -fstack-protector not supported for this target if host_machine.cpu_family() !=3D 'aarch64' if host_machine.system() in [ 'linux', 'freebsd', 'windows' ] @@ -406,7 +408,7 @@ if host_machine.cpu_family() !=3D 'aarch64' '-fstack-protector-strong', '-fstack-protector-all', ]) - cc_flags +=3D fstack_cflags + supported_cc_flags +=3D fstack_cflags =20 # When building with mingw using -fstack-protector requires libssp lib= rary # which is included by using -fstack-protector with linker. @@ -416,7 +418,7 @@ if host_machine.cpu_family() !=3D 'aarch64' endif endif =20 -if cc.has_argument('-Wlogical-op') +if supported_cc_flags.contains('-Wlogical-op') # Broken in 6.0 and later # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D69602 w_logical_op_args =3D ['-O2', '-Wlogical-op', '-Werror'] @@ -445,7 +447,7 @@ w_double_promotion_code =3D ''' } ''' if cc.compiles(w_double_promotion_code, args: w_double_promotion_args, nam= e: '-Wdouble-promotion') - cc_flags +=3D ['-Wdouble-promotion'] + supported_cc_flags +=3D ['-Wdouble-promotion'] endif =20 # Clang complains about unused static inline functions which are common @@ -458,10 +460,9 @@ w_unused_function_code =3D ''' ''' # -Wunused-function is implied by -Wall, we must turn it off explicitly. if not cc.compiles(w_unused_function_code, args: w_unused_function_args) - cc_flags +=3D ['-Wno-unused-function'] + supported_cc_flags +=3D ['-Wno-unused-function'] endif =20 -supported_cc_flags =3D cc.get_supported_arguments(cc_flags) add_project_arguments(supported_cc_flags, language: 'c') =20 if cc.has_argument('-Wsuggest-attribute=3Dformat') --=20 2.30.2