build: add meson support for icc

Message ID 1551190689-139613-1-git-send-email-andrius.sirvys@intel.com (mailing list archive)
State Rejected, archived
Delegated to: Thomas Monjalon
Headers
Series build: add meson support for icc |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/intel-Performance-Testing success Performance Testing PASS
ci/mellanox-Performance-Testing success Performance Testing PASS

Commit Message

Andrius Sirvys Feb. 26, 2019, 2:18 p.m. UTC
  When building with mason, checks if the compiler is icc. If they match,
the warning_flags are changed to ensure icc compilation is successful.

Disabled error 3656: "variable may be used before its value is set"
in librte_telemetry, bnx2x, ixgbe and sfc as they were false positives.

Signed-off-by: Andrius Sirvys <andrius.sirvys@intel.com>
Tested-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
 config/meson.build               | 22 +++++++++++++++++-----
 drivers/net/bnx2x/meson.build    |  1 +
 drivers/net/ixgbe/meson.build    |  3 +++
 drivers/net/sfc/meson.build      |  3 +++
 lib/librte_telemetry/meson.build |  1 +
 5 files changed, 25 insertions(+), 5 deletions(-)
  

Comments

Bruce Richardson Feb. 26, 2019, 2:26 p.m. UTC | #1
On Tue, Feb 26, 2019 at 02:18:09PM +0000, Andrius Sirvys wrote:
> When building with mason, checks if the compiler is icc. If they match,
> the warning_flags are changed to ensure icc compilation is successful.
> 
> Disabled error 3656: "variable may be used before its value is set"
> in librte_telemetry, bnx2x, ixgbe and sfc as they were false positives.
> 
> Signed-off-by: Andrius Sirvys <andrius.sirvys@intel.com>
> Tested-by: Ferruh Yigit <ferruh.yigit@intel.com>
> ---

Looks ok to me.

Acked-by: Bruce Richardson <bruce.richardson@intel.com>

If you are up for it, could you also do an additional patch to add an icc
build to "test-meson-builds.sh" if icc is found on the system?
  
Thomas Monjalon Feb. 26, 2019, 5:44 p.m. UTC | #2
26/02/2019 15:18, Andrius Sirvys:
> When building with mason, checks if the compiler is icc. If they match,
> the warning_flags are changed to ensure icc compilation is successful.
> 
> Disabled error 3656: "variable may be used before its value is set"
> in librte_telemetry, bnx2x, ixgbe and sfc as they were false positives.
> 
> Signed-off-by: Andrius Sirvys <andrius.sirvys@intel.com>
> Tested-by: Ferruh Yigit <ferruh.yigit@intel.com>

I'm really not sure about supporting icc.
It may be hard to get a license for icc.
And it is not available as a simple package.
It means we are adding code that the community cannot test.
I think we should rely on free compilers only.

PS: I'm not even talking about the suspicious verification done
by the installers of the suites including icc.
  

Patch

diff --git a/config/meson.build b/config/meson.build
index db32499..34be1ee 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -85,11 +85,23 @@  endif
 add_project_arguments('-include', 'rte_config.h', language: 'c')
 
 # enable extra warnings and disable any unwanted warnings
-warning_flags = [
-	'-Wsign-compare',
-	'-Wcast-qual',
-	'-Wno-address-of-packed-member'
-]
+icc_warn_uninit = []
+if cc.get_id()=='intel'
+# variable may be used before its value is set
+	icc_warn_uninit = ['-diag-disable 3656']
+	warning_flags = [
+		'-diag-disable 188', # enumerated type mixed with another type
+		'-diag-disable 1338', # arithmetic on pointer to void or function type
+		'-diag-disable 279', # controlling expression is constant
+	]
+else
+	warning_flags = [
+		'-Wsign-compare',
+		'-Wcast-qual',
+		'-Wno-address-of-packed-member'
+	]
+endif
+
 if cc.sizeof('void *') == 4
 # for 32-bit, don't warn about casting a 32-bit pointer to 64-bit int - it's fine!!
 	warning_flags += '-Wno-pointer-to-int-cast'
diff --git a/drivers/net/bnx2x/meson.build b/drivers/net/bnx2x/meson.build
index e3c6888..d0e8b6f 100644
--- a/drivers/net/bnx2x/meson.build
+++ b/drivers/net/bnx2x/meson.build
@@ -5,6 +5,7 @@  dep = cc.find_library('z', required: false)
 build = dep.found()
 ext_deps += dep
 cflags += '-DZLIB_CONST'
+cflags += icc_warn_uninit
 sources = files('bnx2x.c',
 	'bnx2x_ethdev.c',
 	'bnx2x_rxtx.c',
diff --git a/drivers/net/ixgbe/meson.build b/drivers/net/ixgbe/meson.build
index 544a141..33e5d58 100644
--- a/drivers/net/ixgbe/meson.build
+++ b/drivers/net/ixgbe/meson.build
@@ -5,6 +5,9 @@  version = 2
 
 cflags += ['-DRTE_LIBRTE_IXGBE_BYPASS']
 
+# Flags for icc compiler
+cflags += icc_warn_uninit
+
 allow_experimental_apis = true
 
 subdir('base')
diff --git a/drivers/net/sfc/meson.build b/drivers/net/sfc/meson.build
index 2d34e86..b3424d4 100644
--- a/drivers/net/sfc/meson.build
+++ b/drivers/net/sfc/meson.build
@@ -30,6 +30,9 @@  extra_flags += [
 	'-Wbad-function-cast'
 ]
 
+# Flags for icc compiler
+extra_flags += icc_warn_uninit
+
 foreach flag: extra_flags
 	if cc.has_argument(flag)
 		cflags += flag
diff --git a/lib/librte_telemetry/meson.build b/lib/librte_telemetry/meson.build
index 9492f54..19726e3 100644
--- a/lib/librte_telemetry/meson.build
+++ b/lib/librte_telemetry/meson.build
@@ -5,6 +5,7 @@  sources = files('rte_telemetry.c', 'rte_telemetry_parser.c', 'rte_telemetry_pars
 headers = files('rte_telemetry.h', 'rte_telemetry_internal.h', 'rte_telemetry_parser.h', 'rte_telemetry_parser_test.h')
 deps += ['metrics', 'ethdev']
 cflags += '-DALLOW_EXPERIMENTAL_API'
+cflags += icc_warn_uninit
 
 jansson = cc.find_library('jansson', required: false)
 if jansson.found()