From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 49D05A0AC5 for ; Thu, 2 May 2019 16:13:23 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8CA411B108; Thu, 2 May 2019 16:13:22 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 2EECA1B107 for ; Thu, 2 May 2019 16:13:20 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 May 2019 07:13:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,421,1549958400"; d="scan'208";a="320849202" Received: from silpixa00400214.ir.intel.com (HELO silpixa00400214.ger.corp.intel.com) ([10.237.223.195]) by orsmga005.jf.intel.com with ESMTP; 02 May 2019 07:13:18 -0700 From: Reshma Pattan To: dev@dpdk.org Cc: david.marchand@redhat.com, bruce.richardson@intel.com, Reshma Pattan Date: Thu, 2 May 2019 15:13:16 +0100 Message-Id: <20190502141316.25907-1-reshma.pattan@intel.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190502093334.7546-1-reshma.pattan@intel.com> References: <20190502093334.7546-1-reshma.pattan@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2] mk: report address of packed member as warning X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Message-ID: <20190502141316.inDJ1VO_eN8U4FsQH5xG4w858pGGCr15kRSoUnhP_iw@z> gcc 9 on Fedora 30 gives an error "taking address of packed member may result in an unaligned pointer value" for -Waddress-of-packed-member. Report it as warning instead of error to fix the build. Snippet of build before fix ...lib/librte_eal/linux/eal/eal_memalloc.c: In function ‘alloc_seg_walk’: ...lib/librte_eal/linux/eal/eal_memalloc.c:768:12: error: taking address of packed member of ‘struct rte_mem_config’ may result in an unaligned pointer value [-Werror=address-of-packed-member] 768 | cur_msl = &mcfg->memsegs[msl_idx]; | ^~~~~~~~~~~~~~~~~~~~~~~ Snippet of build after fix ..lib/librte_eal/linux/eal/eal_memory.c: In function ‘remap_segment’: ..lib/librte_eal/linux/eal/eal_memory.c:685:9: warning: taking address of packed member of ‘struct rte_mem_config’ may result in an unaligned pointer value [-Waddress-of-packed-member] 685 | msl = &mcfg->memsegs[msl_idx]; Signed-off-by: Reshma Pattan --- mk/toolchain/gcc/rte.vars.mk | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mk/toolchain/gcc/rte.vars.mk b/mk/toolchain/gcc/rte.vars.mk index d8b99faf6..61032bbbc 100644 --- a/mk/toolchain/gcc/rte.vars.mk +++ b/mk/toolchain/gcc/rte.vars.mk @@ -87,5 +87,9 @@ WERROR_FLAGS += -Wimplicit-fallthrough=2 WERROR_FLAGS += -Wno-format-truncation endif +#Report "taking address of packed member may result +#in an unaligned pointer value" issues as warnings. +WERROR_FLAGS += -Wno-error=address-of-packed-member + export CC AS AR LD OBJCOPY OBJDUMP STRIP READELF export TOOLCHAIN_CFLAGS TOOLCHAIN_LDFLAGS TOOLCHAIN_ASFLAGS -- 2.21.0