From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 042FD45BCB; Fri, 25 Oct 2024 18:51:51 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5AA4E40655; Fri, 25 Oct 2024 18:51:26 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) by mails.dpdk.org (Postfix) with ESMTP id A9BB4402AE for ; Fri, 25 Oct 2024 18:51:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729875078; x=1761411078; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Zz8pJl6mAEBjBZwRZ3xResJht79dOIhMoBYxuEoDqok=; b=e1FP4urjUyQkpEpEbJGI1umGhrL+RW65Oc9piTJngWg6WqYqcdgLW+QG NfYBe4fo5MNmXb/wVxRm1RCR3kt6e1rMiQDB7AS2yvsmejKPvjoCP/7xh BybQZHxHCY4iSs0LmUcSzdPyNvthW1LNxQUSkYrhbOGz+MOHnfOoPjhwS 8h776RC6JFesUVV0zzJlJXEZGwBYmz3DGtgM6+HHkzek0DmyDbmKMsEyl VF7z30VwtX4Yyg4MzHEi2OgnPaVOkvv4d3KIiVSYaYu3ee/9fd3xbeqSS LC00rO6OCwPDuzLv6bIobizywcZJeY7NAWKRu6jHnYj1O2JrjubviEmeh Q==; X-CSE-ConnectionGUID: YyoUi/RUQqGHh+k2gCGqRg== X-CSE-MsgGUID: T6f0+Vx7Qt+C6FYiW1aR/Q== X-IronPort-AV: E=McAfee;i="6700,10204,11236"; a="54956183" X-IronPort-AV: E=Sophos;i="6.11,232,1725346800"; d="scan'208";a="54956183" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Oct 2024 09:50:46 -0700 X-CSE-ConnectionGUID: 5MaixqzCSAWCRlpRcCmNSQ== X-CSE-MsgGUID: Kne7txZwTPauYmM/XEu6WA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,232,1725346800"; d="scan'208";a="118417534" Received: from unknown (HELO silpixa00401385.ir.intel.com) ([10.237.214.25]) by orviesa001.jf.intel.com with ESMTP; 25 Oct 2024 09:50:44 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: david.marchand@redhat.com, Bruce Richardson , Stephen Hemminger , =?UTF-8?q?Morten=20Br=C3=B8rup?= , Radu Nicolau , Akhil Goyal , Maxime Coquelin , Chenbo Xia Subject: [PATCH v2 6/6] build: limit scope of packed member warning disabling Date: Fri, 25 Oct 2024 17:50:19 +0100 Message-ID: <20241025165020.1856733-7-bruce.richardson@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241025165020.1856733-1-bruce.richardson@intel.com> References: <20241017142214.1669370-1-bruce.richardson@intel.com> <20241025165020.1856733-1-bruce.richardson@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org The flag '-Wno-address-of-packed-member' is a global warning flag in DPDK. Rather than disabling this warning globally, it is better to just have it enabled for components that may need it. This patch limits the scope of it in the following ways: * limit the use of the flag to the drivers subfolder only - all libs and apps should be buildable without the warning. * exception is made for the vhost library and the ipsec-secgw example for now, as making them buildable with the warning enabled is more complicated. This exception can hopefully be removed in future. Limiting the scope further within the drivers directory is also left for future consideration. However, since HW drivers often have to use packed structures to align with hardware-implemented data layouts, it may be more practical to keep the warning disabled in the longer term. Signed-off-by: Bruce Richardson Acked-by: Stephen Hemminger Acked-by: Morten Brørup --- config/meson.build | 1 - drivers/meson.build | 9 ++++++--- examples/ipsec-secgw/meson.build | 6 ++++++ lib/vhost/meson.build | 5 ++++- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/config/meson.build b/config/meson.build index 8dae811378..5095d2fbcb 100644 --- a/config/meson.build +++ b/config/meson.build @@ -325,7 +325,6 @@ warning_flags = [ '-Wwrite-strings', # globally disabled warnings - '-Wno-address-of-packed-member', '-Wno-packed-not-aligned', '-Wno-missing-field-initializers', ] diff --git a/drivers/meson.build b/drivers/meson.build index 5270160c56..4a27f197a8 100644 --- a/drivers/meson.build +++ b/drivers/meson.build @@ -59,9 +59,12 @@ default_cflags = machine_args default_cflags += ['-DALLOW_EXPERIMENTAL_API'] default_cflags += ['-DALLOW_INTERNAL_API'] -if cc.has_argument('-Wno-format-truncation') - default_cflags += '-Wno-format-truncation' -endif +warning_disable_cflags = ['-Wno-format-truncation', '-Wno-address-of-packed-member'] +foreach cflag:warning_disable_cflags + if cc.has_argument(cflag) + default_cflags += cflag + endif +endforeach dpdk_drivers_build_dir = meson.current_build_dir() diff --git a/examples/ipsec-secgw/meson.build b/examples/ipsec-secgw/meson.build index ccdaef1c4d..023d9cf039 100644 --- a/examples/ipsec-secgw/meson.build +++ b/examples/ipsec-secgw/meson.build @@ -23,3 +23,9 @@ sources = files( 'sp4.c', 'sp6.c', ) +app_cflags = ['-Wno-address-of-packed-member'] +foreach flag:app_cflags + if cc.has_argument(flag) + cflags += flag + endif +endforeach diff --git a/lib/vhost/meson.build b/lib/vhost/meson.build index 41b622a9be..51bcf17244 100644 --- a/lib/vhost/meson.build +++ b/lib/vhost/meson.build @@ -16,7 +16,10 @@ elif (toolchain == 'icc' and cc.version().version_compare('>=16.0.0')) cflags += '-DVHOST_ICC_UNROLL_PRAGMA' endif dpdk_conf.set('RTE_LIBRTE_VHOST_POSTCOPY', cc.has_header('linux/userfaultfd.h')) -cflags += '-fno-strict-aliasing' +cflags += [ + '-fno-strict-aliasing', + '-Wno-address-of-packed-member', +] sources = files( 'fd_man.c', -- 2.43.0