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 8A7E145B5F; Thu, 17 Oct 2024 16:23:11 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 784184067E; Thu, 17 Oct 2024 16:22:44 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) by mails.dpdk.org (Postfix) with ESMTP id B79EA40666 for ; Thu, 17 Oct 2024 16:22:39 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729174960; x=1760710960; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=NgVysHJSwOK4XaJwsKISh/EGsK5o6+7iM4FrHl4+sm4=; b=lp1V5cWUOe9OMDQGuj0z6v1tzgk0oX4Dwd+f0JQgTi5JlZJvtOs8oY48 Vcv0X7qfHDH22YTRwpn06bIviWU+CB6BLP2qoScQl87LB3EWL84HrpNMI v5p+mXre+carJAFrJz/K3mZCwxrSIUftgtkRX2qCC7xh4jsOBOwa3k86N GxSjidLhx6zSqGkspmXk16FG9B6ezSJEMnC+qIwzCPpQKt8D2OM38d6FB bj4s4MPSAW4S2QxyN99I62X8q858OiWOtZZXSKBhccWCCPMIBxs3PPNh8 71+xgv7/+tpM3nOqDyUPkGdQq0gr8/YjK9p1f0Nu4VCZcsLYXUq3H1joR A==; X-CSE-ConnectionGUID: bnVh+GbeRryUIGN8BKv3pQ== X-CSE-MsgGUID: dzFW3K1cT/mqwWiabsfrLg== X-IronPort-AV: E=McAfee;i="6700,10204,11228"; a="28131737" X-IronPort-AV: E=Sophos;i="6.11,211,1725346800"; d="scan'208";a="28131737" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Oct 2024 07:22:40 -0700 X-CSE-ConnectionGUID: QIyWvGE8R4W06yPCp4cnsA== X-CSE-MsgGUID: CfH/JpAGRwyk9GuaVrzfgA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,211,1725346800"; d="scan'208";a="101867852" Received: from unknown (HELO silpixa00401385.ir.intel.com) ([10.237.214.25]) by fmviesa002.fm.intel.com with ESMTP; 17 Oct 2024 07:22:38 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson , Radu Nicolau , Akhil Goyal , Maxime Coquelin , Chenbo Xia Subject: [PATCH 6/6] build: limit scope of packed member warning disabling Date: Thu, 17 Oct 2024 15:22:13 +0100 Message-ID: <20241017142214.1669370-7-bruce.richardson@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241017142214.1669370-1-bruce.richardson@intel.com> References: <20241017142214.1669370-1-bruce.richardson@intel.com> MIME-Version: 1.0 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 --- 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 6a6b56a27e..8b1a0fe779 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 2733306698..1653990f3b 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