remove compiler warnings with icc using meson
Subsystems (2)
cover remove compiler warnings with icc using meson
While icc can compile DPDK successfully using a meson/ninja build, there are a lot of warnings issued in the process, which means that any use of werror flag will break the build, and the output just looks messy and possibly worrying to the user.
To improve this situation, we can fix the warnings about unsupported compiler flags, and just maintain a list of icc warnings to ignore.
Bruce Richardson (2):
net/octeontx2: check compiler flag before use
build: remove warnings for builds with icc
config/meson.build | 6 ++++++ drivers/net/octeontx2/meson.build | 4 +--- 2 files changed, 7 insertions(+), 3 deletions(-)
Signature · 1 line
2.20.1
PATCH 1/2 net/octeontx2: check compiler flag before use
Rather than assuming all compilers support the -flax-vector-extensions flag, we should test this before using it, thereby potentially avoiding warnings.
--- drivers/net/octeontx2/meson.build | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/octeontx2/meson.build +1 -3
@@ -26,9 +26,7 @@ sources = files('otx2_rx.c', deps += ['bus_pci', 'common_octeontx2', 'mempool_octeontx2'] -cflags += ['-flax-vector-conversions'] - -extra_flags = [] +extra_flags = ['-flax-vector-conversions'] # This integrated controller runs only on a arm64 machine, remove 32bit warnings if not dpdk_conf.get('RTE_ARCH_64') extra_flags += ['-Wno-int-to-pointer-cast', '-Wno-pointer-to-int-cast']
Signature · 1 line
2.20.1
Re: [dpdk-dev] [PATCH 1/2] net/octeontx2: check compiler flag before use
Quoted 8 lines · Bruce Richardson
Rather than assuming all compilers support the -flax-vector-extensions flag, we should test this before using it, thereby potentially avoiding warnings.
Signed-off-by Bruce Richardson <[email protected]>
Quoted 22 lines
--- drivers/net/octeontx2/meson.build | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/net/octeontx2/meson.build +1
-4@@ -26,9 +26,7 @@ sources = files('otx2_rx.c', deps += ['bus_pci', 'common_octeontx2', 'mempool_octeontx2'] -cflags += ['-flax-vector-conversions'] - -extra_flags = [] +extra_flags = ['-flax-vector-conversions'] # This integrated controller runs only on a arm64 machine, remove 32bit warnings if not dpdk_conf.get('RTE_ARCH_64') extra_flags += ['-Wno-int-to-pointer-cast', '-Wno-pointer-to-int-cast'] --2.20.1
PATCH 2/2 build: remove warnings for builds with icc
In reply to Bruce RichardsonWhile icc builds without the "werror" setting build successfully, there are a lot of warnings. To make the output cleaner, and to allow building with warnings enabled, we can add a list of warning ids to ignore.
--- config/meson.build | 6 ++++++ 1 file changed, 6 insertions(+)
config/meson.build +6 -0
@@ -197,6 +197,12 @@ if not dpdk_conf.get('RTE_ARCH_64') # 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' endif +if cc.get_id() == 'intel' + warning_ids = [188, 2203, 2279, 2557, 3179, 3656] + foreach i:warning_ids + warning_flags += '-diag-disable=@0@'.format(i) + endforeach +endif foreach arg: warning_flags if cc.has_argument(arg) add_project_arguments(arg, language: 'c')
Signature · 1 line
2.20.1
Re: [dpdk-dev] [PATCH 2/2] build: remove warnings for builds with icc
Quoted 14 lines · Bruce Richardson
While icc builds without the "werror" setting build successfully, there are a lot of warnings. To make the output cleaner, and to allow building with warnings enabled, we can add a list of warning ids to ignore.
Signed-off-by Bruce Richardson <[email protected]>--- config/meson.build | 6 ++++++ 1 file changed, 6 insertions(+)config/meson.build +0
-0
config/meson.build if not dpdk_conf.get('RTE_ARCH_64') · line 201
Quoted 5 lines
config/meson.build +2
-0@@ -197,6 +197,12 @@ if not dpdk_conf.get('RTE_ARCH_64') # 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' endif +if cc.get_id() == 'intel' + warning_ids = [188, 2203, 2279, 2557, 3179, 3656]
Maybe worth it to add short warning descriptions in comments? e.g.
# 188: unused blah
# 2203: wrong foo
Quoted 8 lines
config/meson.build +4
-0+ foreach i:warning_ids + warning_flags += '-diag-disable=@0@'.format(i) + endforeach +endif foreach arg: warning_flags if cc.has_argument(arg) add_project_arguments(arg, language: 'c')
Signature · 2 lines
Thanks, Anatoly
Re: [dpdk-dev] [PATCH 2/2] build: remove warnings for builds with icc
Quoted 23 lines · Anatoly
Quoted 14 lines · Bruce Richardson
While icc builds without the "werror" setting build successfully, there are a lot of warnings. To make the output cleaner, and to allow building with warnings enabled, we can add a list of warning ids to ignore.
Signed-off-by Bruce Richardson <[email protected]>--- config/meson.build | 6 ++++++ 1 file changed, 6 insertions(+)config/meson.build +0
-0config/meson.build if not dpdk_conf.get('RTE_ARCH_64') · line 201
Quoted 5 lines
config/meson.build +2
-0@@ -197,6 +197,12 @@ if not dpdk_conf.get('RTE_ARCH_64') # 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' endif +if cc.get_id() == 'intel' + warning_ids = [188, 2203, 2279, 2557, 3179, 3656]Maybe worth it to add short warning descriptions in comments? e.g.
Quoted 3 lines
# 188: unused blah
# 2203: wrong foo
Yeah, I started doing it that way, but then I decided that it was making the block rather long and that the extra benefit it would give is quite small. But if people think it's worthwhile, I can rework to do so.
/Bruce
Thomas Monjalon
Applied24/01/2020 16:37, Bruce Richardson:
Quoted 11 lines
While icc can compile DPDK successfully using a meson/ninja build, there are a lot of warnings issued in the process, which means that any use of werror flag will break the build, and the output just looks messy and possibly worrying to the user.
To improve this situation, we can fix the warnings about unsupported compiler flags, and just maintain a list of icc warnings to ignore.
Bruce Richardson (2):
net/octeontx2: check compiler flag before use
build: remove warnings for builds with icc
Applied, thanks