[dpdk-dev,2/2] fix building with clang-3.8.0 compiler

Message ID 1466955137-91066-2-git-send-email-keith.wiles@intel.com (mailing list archive)
State Superseded, archived
Headers

Commit Message

Wiles, Keith June 26, 2016, 3:32 p.m. UTC
  Latest clang compiler 3.8.0 on latest update of Ubuntu
creates a few more warnings on -Warray-bounds and extra
() around 'if' expressions.

Signed-off-by: Keith Wiles <keith.wiles@intel.com>
---
 app/test-pmd/Makefile                | 3 +++
 app/test/Makefile                    | 3 +++
 drivers/net/bonding/Makefile         | 4 ++++
 drivers/net/fm10k/Makefile           | 2 ++
 drivers/net/i40e/Makefile            | 2 ++
 lib/librte_cmdline/Makefile          | 6 ++++++
 lib/librte_eal/linuxapp/eal/Makefile | 7 +++++++
 7 files changed, 27 insertions(+)
  

Comments

Wiles, Keith June 26, 2016, 3:50 p.m. UTC | #1
On 6/26/16, 10:32 AM, "dev on behalf of Keith Wiles" <dev-bounces@dpdk.org on behalf of keith.wiles@intel.com> wrote:

>Latest clang compiler 3.8.0 on latest update of Ubuntu

>creates a few more warnings on -Warray-bounds and extra

>() around 'if' expressions.

>

>Signed-off-by: Keith Wiles <keith.wiles@intel.com>

>---

> app/test-pmd/Makefile                | 3 +++

> app/test/Makefile                    | 3 +++

> drivers/net/bonding/Makefile         | 4 ++++

> drivers/net/fm10k/Makefile           | 2 ++

> drivers/net/i40e/Makefile            | 2 ++

> lib/librte_cmdline/Makefile          | 6 ++++++

> lib/librte_eal/linuxapp/eal/Makefile | 7 +++++++

> 7 files changed, 27 insertions(+)

>


self-nak: found another problem
  

Patch

diff --git a/app/test-pmd/Makefile b/app/test-pmd/Makefile
index 2a0b5a5..14ab77c 100644
--- a/app/test-pmd/Makefile
+++ b/app/test-pmd/Makefile
@@ -59,6 +59,9 @@  SRCS-y += icmpecho.c
 SRCS-$(CONFIG_RTE_LIBRTE_IEEE1588) += ieee1588fwd.c
 
 CFLAGS_cmdline.o := -D_GNU_SOURCE
+ifeq ($(CONFIG_RTE_TOOLCHAIN_CLANG),y)
+CFLAGS_cmdline.o += -Wno-array-bounds
+endif
 
 # this application needs libraries first
 DEPDIRS-y += lib drivers
diff --git a/app/test/Makefile b/app/test/Makefile
index 2de8c7a..5593426 100644
--- a/app/test/Makefile
+++ b/app/test/Makefile
@@ -211,6 +211,9 @@  ifeq ($(shell test $(GCC_VERSION) -ge 44 && echo 1), 1)
 CFLAGS_test_memcpy.o += -fno-var-tracking-assignments
 CFLAGS_test_memcpy_perf.o += -fno-var-tracking-assignments
 endif
+else ifeq ($(CONFIG_RTE_TOOLCHAIN_CLANG),y)
+CFLAGS_test_errno.o += -Wno-array-bounds
+CFLAGS_test_devargs.o += -Wno-array-bounds
 endif
 
 # this application needs libraries first
diff --git a/drivers/net/bonding/Makefile b/drivers/net/bonding/Makefile
index 504f2e8..ee5f44a 100644
--- a/drivers/net/bonding/Makefile
+++ b/drivers/net/bonding/Makefile
@@ -43,6 +43,10 @@  EXPORT_MAP := rte_eth_bond_version.map
 
 LIBABIVER := 1
 
+ifeq ($(CONFIG_RTE_TOOLCHAIN_CLANG),y)
+CFLAGS_rte_eth_bond_args.o := -Wno-array-bounds
+endif
+
 #
 # all source are stored in SRCS-y
 #
diff --git a/drivers/net/fm10k/Makefile b/drivers/net/fm10k/Makefile
index afcbd1d..d6c692d 100644
--- a/drivers/net/fm10k/Makefile
+++ b/drivers/net/fm10k/Makefile
@@ -59,6 +59,8 @@  CFLAGS_BASE_DRIVER += -Wno-strict-aliasing -Wno-format-extra-args
 CFLAGS_BASE_DRIVER += -Wno-unused-variable
 CFLAGS_BASE_DRIVER += -Wno-missing-field-initializers
 
+CFLAGS_fm10k_ethdev.o := -Wno-array-bounds
+
 else
 #
 # CFLAGS for gcc
diff --git a/drivers/net/i40e/Makefile b/drivers/net/i40e/Makefile
index 9ffef3f..3a9e5a1 100644
--- a/drivers/net/i40e/Makefile
+++ b/drivers/net/i40e/Makefile
@@ -60,6 +60,8 @@  CFLAGS_BASE_DRIVER += -Wno-missing-field-initializers
 CFLAGS_BASE_DRIVER += -Wno-pointer-to-int-cast
 CFLAGS_BASE_DRIVER += -Wno-format-nonliteral
 CFLAGS_BASE_DRIVER += -Wno-unused-variable
+
+CFLAGS_i40e_hmc.o += -Wno-tautological-compare
 else
 CFLAGS_BASE_DRIVER  = -Wno-sign-compare
 CFLAGS_BASE_DRIVER += -Wno-unused-value
diff --git a/lib/librte_cmdline/Makefile b/lib/librte_cmdline/Makefile
index 7d2d148..0af1d0a 100644
--- a/lib/librte_cmdline/Makefile
+++ b/lib/librte_cmdline/Makefile
@@ -40,6 +40,12 @@  EXPORT_MAP := rte_cmdline_version.map
 
 LIBABIVER := 2
 
+ifeq ($(CONFIG_RTE_TOOLCHAIN_CLANG),y)
+CFLAGS_cmdline_cirbuf.o:= -Wno-parentheses-equality
+CFLAGS_cmdline_rdline.o:= -Wno-parentheses-equality
+CFLAGS_cmdline_parse_string.o:= -Wno-array-bounds
+endif
+
 # all source are stored in SRCS-y
 SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) := cmdline.c
 SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += cmdline_cirbuf.c
diff --git a/lib/librte_eal/linuxapp/eal/Makefile b/lib/librte_eal/linuxapp/eal/Makefile
index 30b30f3..2ff8d62 100644
--- a/lib/librte_eal/linuxapp/eal/Makefile
+++ b/lib/librte_eal/linuxapp/eal/Makefile
@@ -125,6 +125,13 @@  CFLAGS_eal_common_options.o := -D_GNU_SOURCE
 CFLAGS_eal_common_thread.o := -D_GNU_SOURCE
 CFLAGS_eal_common_lcore.o := -D_GNU_SOURCE
 
+ifeq ($(CONFIG_RTE_TOOLCHAIN_CLANG),y)
+CFLAGS_eal_alarm.o += -Wno-parentheses-equality
+CFLAGS_eal_common_options.o += -Wno-array-bounds
+CFLAGS_eal_pci.o += -Wno-parentheses-equality
+CFLAGS_eal_pci.o += -Wno-array-bounds
+endif
+
 # workaround for a gcc bug with noreturn attribute
 # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603
 ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y)