From nobody Mon Feb 9 13:00:58 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1617879525; cv=none; d=zohomail.com; s=zohoarc; b=QVcNk3vk3m/ZKFTH/klReaXtWiHk0uhvN18l5fxaeR0YFXr00YOhiBdl7TDMhicbeIH/8SzNXBG7xRCfHM8dJ2a5rMjwElyWUBNQ+JtIf5EG/1uwxYhTYm2vObjVeZNIX1IlH5JzxCLuZbgY24xsUnsf/QrsFXGSYiZymFNFWXY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617879525; 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=E9ugXfsJtwSzKst3R1gVaakzGvHhHwnOx3Y1Op5wfkE=; b=VDVyoGMnwRT8UeMj07c/3OIRU/kzzeAoBq9HQc0l+JnQi9WvRVwW8f/2b7j6wxaoltSpzTZNLUbgtiNskCl4lYfuopHtuwnyeTCrFoysxV7Ta10Db4xvkHQJnLBIPR0mp/3w700mbx1EMNVaqjb4yxALFEcggTyKxe4FbCUV6D0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 161787952545473.53297885561062; Thu, 8 Apr 2021 03:58:45 -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-551-b59T5JR1PAWLc_0X5Mv9zQ-1; Thu, 08 Apr 2021 06:58:41 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id F4046107ACE3; Thu, 8 Apr 2021 10:58:35 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CE3B45C1C4; Thu, 8 Apr 2021 10:58:35 +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 978235534B; Thu, 8 Apr 2021 10:58:35 +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 138AwVD3006234 for ; Thu, 8 Apr 2021 06:58:32 -0400 Received: by smtp.corp.redhat.com (Postfix) id EB35B1037EBD; Thu, 8 Apr 2021 10:58:31 +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 1F16610013D7; Thu, 8 Apr 2021 10:58:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617879524; 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=E9ugXfsJtwSzKst3R1gVaakzGvHhHwnOx3Y1Op5wfkE=; b=F+ECIxhwWf7gPvAuotK+TsmzHBZWV6lu7i4THebVxDeg8SvJOhkNi7JSh2ukTHElZHtwRg PPaoI6GNhJhHcQprbaVQbZ0KDZKn/fWdRLdS/crtbxAcRKVqO04XV9SpfDiLbBuqQWyhqB 02qUPRsMZ3JVUnHkU8wOclF21W1JxE4= X-MC-Unique: b59T5JR1PAWLc_0X5Mv9zQ-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 3/6] meson: merge all cc_flags arrays into one Date: Thu, 8 Apr 2021 11:58:20 +0100 Message-Id: <20210408105823.462584-4-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.16 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) The split of arrays is fairly arbitrary and a hang over from the way we had to structure lists of flags when we used GNULIB's compiler flag checking m4 logic. The separate lists leads to cases where we enable a flag in one list and have contradictory setting in another list, which leads to confusion. Signed-off-by: Daniel P. Berrang=C3=A9 --- meson.build | 116 +++++++++++++++++++--------------------------------- 1 file changed, 43 insertions(+), 73 deletions(-) diff --git a/meson.build b/meson.build index 97d9c52165..55dde6d963 100644 --- a/meson.build +++ b/meson.build @@ -211,7 +211,23 @@ if git_werror.enabled() or git_werror.auto() and git cc_flags +=3D [ '-Werror' ] endif =20 + +# gcc --help=3Dwarnings outputs +ptrdiff_max =3D cc.sizeof('ptrdiff_t', prefix: '#include ') +size_max =3D cc.sizeof('size_t', prefix: '#include ') +# Compute max safe object size by checking ptrdiff_t and size_t sizes. +# Ideally we would get PTRDIFF_MAX and SIZE_MAX values but it would +# give us (2147483647L) and we would have to remove the () and the suffix +# in order to convert it to numbers to be able to pick the smaller one. +alloc_max =3D run_command( + 'python3', '-c', + 'print(min(2**(@0@ * 8 - 1) - 1, 2**(@1@ * 8) - 1))'.format(ptrdiff_max,= size_max), +) + cc_flags +=3D [ + '-fasynchronous-unwind-tables', + '-fexceptions', + '-fipa-pure-const', '-fno-common', '-W', '-Wabsolute-value', @@ -219,6 +235,9 @@ cc_flags +=3D [ '-Waddress-of-packed-member', '-Waggressive-loop-optimizations', '-Wall', + '-Walloc-size-larger-than=3D@0@'.format(alloc_max.stdout().strip()), + '-Warray-bounds=3D2', + '-Wattribute-alias=3D2', '-Wattribute-warning', '-Wattributes', '-Wbool-compare', @@ -228,7 +247,8 @@ cc_flags +=3D [ '-Wcannot-profile', '-Wcast-align', '-Wcast-align=3Dstrict', - '-Wcast-function-type', + # We do "bad" function casts all the time for event callbacks + '-Wno-cast-function-type', '-Wchar-subscripts', '-Wclobbered', '-Wcomment', @@ -251,17 +271,24 @@ cc_flags +=3D [ '-Wextra', '-Wformat-contains-nul', '-Wformat-extra-args', - '-Wformat-nonliteral', + # -Wformat=3D2 implies -Wformat-nonliteral so we need to manually exclud= e it + '-Wno-format-nonliteral', + '-Wformat-overflow=3D2', '-Wformat-security', + # -Wformat enables this by default, and we should keep it, + # but need to rewrite various areas of code first + '-Wno-format-truncation', '-Wformat-y2k', '-Wformat-zero-length', '-Wframe-address', + '-Wframe-larger-than=3D4096', '-Wfree-nonheap-object', '-Whsa', '-Wif-not-aligned', '-Wignored-attributes', '-Wignored-qualifiers', '-Wimplicit', + '-Wimplicit-fallthrough=3D5', '-Wimplicit-function-declaration', '-Wimplicit-int', '-Wincompatible-pointer-types', @@ -272,6 +299,7 @@ cc_flags +=3D [ '-Wint-to-pointer-cast', '-Winvalid-memory-model', '-Winvalid-pch', + '-Wjump-misses-init', '-Wlogical-not-parentheses', '-Wlogical-op', '-Wmain', @@ -293,6 +321,7 @@ cc_flags +=3D [ '-Wnested-externs', '-Wnonnull', '-Wnonnull-compare', + '-Wnormalized=3Dnfc', '-Wnull-dereference', '-Wodr', '-Wold-style-declaration', @@ -318,32 +347,41 @@ cc_flags +=3D [ '-Wshift-count-negative', '-Wshift-count-overflow', '-Wshift-negative-value', + '-Wshift-overflow=3D2', + # So we have -W enabled, and then have to explicitly turn off... + '-Wno-sign-compare', '-Wsizeof-array-argument', '-Wsizeof-pointer-div', '-Wsizeof-pointer-memaccess', '-Wstrict-aliasing', '-Wstrict-prototypes', + '-Wstringop-overflow=3D2', '-Wstringop-truncation', '-Wsuggest-attribute=3Dcold', - '-Wsuggest-attribute=3Dconst', + '-Wno-suggest-attribute=3Dconst', '-Wsuggest-attribute=3Dformat', '-Wsuggest-attribute=3Dnoreturn', - '-Wsuggest-attribute=3Dpure', + '-Wno-suggest-attribute=3Dpure', '-Wsuggest-final-methods', '-Wsuggest-final-types', '-Wswitch', '-Wswitch-bool', + '-Wswitch-enum', '-Wswitch-unreachable', '-Wsync-nand', '-Wtautological-compare', '-Wtrampolines', '-Wtrigraphs', '-Wtype-limits', + # Clang incorrectly complains about dup typedefs win gnu99 mode + # so use this Clang-specific arg to keep it quiet + '-Wno-typedef-redefinition', '-Wuninitialized', '-Wunknown-pragmas', '-Wunused', '-Wunused-but-set-parameter', '-Wunused-but-set-variable', + '-Wunused-const-variable=3D2', '-Wunused-function', '-Wunused-label', '-Wunused-local-typedefs', @@ -355,79 +393,11 @@ cc_flags +=3D [ '-Wvariadic-macros', '-Wvector-operation-performance', '-Wvla', + '-Wvla-larger-then=3D4031', '-Wvolatile-register-var', '-Wwrite-strings', ] =20 -# gcc --help=3Dwarnings outputs -ptrdiff_max =3D cc.sizeof('ptrdiff_t', prefix: '#include ') -size_max =3D cc.sizeof('size_t', prefix: '#include ') -# Compute max safe object size by checking ptrdiff_t and size_t sizes. -# Ideally we would get PTRDIFF_MAX and SIZE_MAX values but it would -# give us (2147483647L) and we would have to remove the () and the suffix -# in order to convert it to numbers to be able to pick the smaller one. -alloc_max =3D run_command( - 'python3', '-c', - 'print(min(2**(@0@ * 8 - 1) - 1, 2**(@1@ * 8) - 1))'.format(ptrdiff_max,= size_max), -) -cc_flags +=3D [ - '-Walloc-size-larger-than=3D@0@'.format(alloc_max.stdout().strip()), - '-Warray-bounds=3D2', - '-Wattribute-alias=3D2', - '-Wformat-overflow=3D2', - '-Wformat-truncation=3D2', - '-Wimplicit-fallthrough=3D5', - '-Wnormalized=3Dnfc', - '-Wshift-overflow=3D2', - '-Wstringop-overflow=3D2', - '-Wunused-const-variable=3D2', - '-Wvla-larger-then=3D4031', -] - -cc_flags +=3D [ - # So we have -W enabled, and then have to explicitly turn off... - '-Wno-sign-compare', - - # We do "bad" function casts all the time for event callbacks - '-Wno-cast-function-type', - - # Clang incorrectly complains about dup typedefs win gnu99 mode - # so use this Clang-specific arg to keep it quiet - '-Wno-typedef-redefinition', - - # We don't use -Wc++-compat so we have to enable it explicitly - '-Wjump-misses-init', - - # -Wswitch is enabled but that doesn't report missing enums if a default: - # is present - '-Wswitch-enum', - - # -Wformat=3D2 implies -Wformat-nonliteral so we need to manually exclud= e it - '-Wno-format-nonliteral', - - # -Wformat enables this by default, and we should keep it, - # but need to rewrite various areas of code first - '-Wno-format-truncation', - - # This should be < 256 really. Currently we're down to 4096, - # but using 1024 bytes sized buffers (mostly for virStrerror) - # stops us from going down further - '-Wframe-larger-than=3D4096', - - # extra special flags - '-fexceptions', - '-fasynchronous-unwind-tables', - - # Need -fipa-pure-const in order to make -Wsuggest-attribute=3Dpure - # fire even without -O. - '-fipa-pure-const', - - # We should eventually enable this, but right now there are at - # least 75 functions triggering warnings. - '-Wno-suggest-attribute=3Dpure', - '-Wno-suggest-attribute=3Dconst', -] - # 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' ] --=20 2.30.2