From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) by dpdk.org (Postfix) with ESMTP id 711EF108D; Tue, 24 Jan 2017 22:04:32 +0100 (CET) Received: by mail-wm0-f66.google.com with SMTP id d140so37726726wmd.2; Tue, 24 Jan 2017 13:04:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=k4V7Za1K5pIVV5Rh3W0AFT1Kx8H+TypAHv2Y+SRPV80=; b=dPbS/fc2vhxFbA+I7j0bLPvy1wqwFYQQOpN7vL4KKtdi3ARZOFeeoVBTz8ZrPvGwo/ 6nlz7N6HkBDmtENlu3D+TKREnw4L1kgbasG38+UI4z6tJnC6zaFLhPk9lwu53+i+w5xW oz0zIEuWKXXKgNOH99N9qJmP4T6CXaXFWAblFpo/kdcaIOQU6C68+R1y90WQDQrcVc7w 3Iukvd9jeXIh4fL3DqRaE6B76CzxLG8RcnFWQi1GjsxTxmyNT05aW1Wlov2uTT+Ty7bY qefKM9TRlOzYL6t7DJFMvJYMSrIRqv2ZNYqIhK7iRXscRfQYNwTgvm+p1D6+VpxdmUrD +6OQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=k4V7Za1K5pIVV5Rh3W0AFT1Kx8H+TypAHv2Y+SRPV80=; b=QwYvCP/SCfVe90XULopulCsPYJnoOdnXkZsXu2NVikEG74ThbPuoqFUFWlAULdU/JC aLZqpOPWTr4rqL8Hln2/E46BqDyF6bLHXlSpj3kpKVebdAE8sfi/MSzz05p4+oHTMbEU WRqYdqP/YM6i6ivZbasoc+WdRoLwetFM2f/JEprpARF29okXWgVJ5oHqTLGy80kfkr3N RxAk0ab+YyzAu75f9TM7Gen5KvV6I40WH5shkHLdL/xm8LRY5zBNY2W/Zp5UzkFoyV4I eIu5qMfsJ6yjQMM8NqCZR918fMj7gwK3lmAWSOo1GoZkSUjSs6pMfSuRBTB6nDGAwjh5 O1qQ== X-Gm-Message-State: AIkVDXKPTOL+pQ/wfkFx8ALP25Ycnd4WBMzYSTlRqIO52ws6Gp2PyQOnwJy4MsIgbVh2Rw== X-Received: by 10.223.165.138 with SMTP id g10mr30130159wrc.105.1485291872183; Tue, 24 Jan 2017 13:04:32 -0800 (PST) Received: from emmanuel-Aspire-E5-571.primacom.net ([185.44.151.141]) by smtp.gmail.com with ESMTPSA id u41sm21653397wrc.1.2017.01.24.13.04.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 24 Jan 2017 13:04:31 -0800 (PST) From: Emmanuel Roullit To: thomas.monjalon@6wind.com Cc: dev@dpdk.org, stable@dpdk.org Date: Tue, 24 Jan 2017 22:04:19 +0100 Message-Id: <20170124210419.14084-1-emmanuel.roullit@gmail.com> X-Mailer: git-send-email 2.11.0 Subject: [dpdk-dev] [PATCH v2] mk: suppress error for reference of packed members 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: , X-List-Received-Date: Tue, 24 Jan 2017 21:04:32 -0000 Found with clang build: error: taking address of packed member 'mlock' of class or structure 'rte_mem_config' may result in an unaligned pointer value [-Werror,-Waddress-of-packed-member] Fixes: 29361d4c91ed ("mk: fix build with clang < 3.5") Fixes: b2bb3a5daaac ("mk: stop on warning only in developer build") Signed-off-by: Emmanuel Roullit --- v2: * Only apply compiler flag on clang >= 4.0 mk/toolchain/clang/rte.toolchain-compat.mk | 4 ++++ mk/toolchain/clang/rte.vars.mk | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/mk/toolchain/clang/rte.toolchain-compat.mk b/mk/toolchain/clang/rte.toolchain-compat.mk index b734413b6..153d2f005 100644 --- a/mk/toolchain/clang/rte.toolchain-compat.mk +++ b/mk/toolchain/clang/rte.toolchain-compat.mk @@ -47,3 +47,7 @@ CLANG_MINOR_VERSION := $(shell echo $(CLANG_VERSION) | cut -f2 -d.) ifeq ($(shell test $(CLANG_MAJOR_VERSION)$(CLANG_MINOR_VERSION) -lt 35 && echo 1), 1) CC_SUPPORTS_Z := false endif + +ifeq ($(shell test $(CLANG_MAJOR_VERSION)$(CLANG_MINOR_VERSION) -ge 40 && echo 1), 1) + CC_PACKED_MEMBER_WERROR := true +endif diff --git a/mk/toolchain/clang/rte.vars.mk b/mk/toolchain/clang/rte.vars.mk index 7749b991b..a797b7aab 100644 --- a/mk/toolchain/clang/rte.vars.mk +++ b/mk/toolchain/clang/rte.vars.mk @@ -76,6 +76,10 @@ endif # process cpu flags include $(RTE_SDK)/mk/toolchain/$(RTE_TOOLCHAIN)/rte.toolchain-compat.mk +ifeq ($(CC_PACKED_MEMBER_WERROR),true) +WERROR_FLAGS += -Wno-address-of-packed-member +endif + # workaround clang bug with warning "missing field initializer" for "= {0}" WERROR_FLAGS += -Wno-missing-field-initializers -- 2.11.0