build: add meson support for icc
Checks
Commit Message
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
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?
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.
@@ -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'
@@ -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',
@@ -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')
@@ -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
@@ -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()