synchronise meson warnings with make
Subsystems (3)
cover synchronise meson warnings with make
The warnings used when building DPDK with make were stricter than those used with meson, so this patchset aligns the two as far as is possible, while also adding in -Wextra as a general compile flag.
The one difference is that with "make" we allow different flags for GCC and clang, while with meson we are (for now) keeping them common. Therefore we drop the -Wcast-align flag as is generates too many false positive warnings on clang, and we globally use the Wno-missing-field-initializers flag for the same reason.
Bruce Richardson (4):
build: allow compile with stricter fallthrough warnings raw/ifpga: remove unneeded compiler flags
build: enable extra warnings for meson build
drivers: remove duplicated compiler flags
config/meson.build | 24 ++++++++++++++++++++--- drivers/bus/dpaa/meson.build | 3 +++ drivers/event/dsw/meson.build | 3 +++ drivers/net/bonding/rte_eth_bond_pmd.c | 3 ++- drivers/net/dpaa/meson.build | 4 ++++ drivers/net/fm10k/base/meson.build | 3 ++- drivers/net/i40e/base/meson.build | 3 ++- drivers/net/mlx4/meson.build | 1 - drivers/net/mlx5/meson.build | 1 - drivers/net/sfc/meson.build | 2 -- drivers/net/vdev_netvsc/meson.build | 2 -- drivers/raw/ifpga_rawdev/base/meson.build | 11 ----------- lib/librte_cmdline/cmdline_parse_num.c | 2 +- 13 files changed, 38 insertions(+), 24 deletions(-)
Signature · 1 line
2.21.0
PATCH 1/4 build: allow compile with stricter fallthrough warnings
DPDK currently compiles with implicit-fallthrough=2 warning level. With gcc -Wextra flag, the default level is 3, so some minor changes are needed to support this in DPDK.
--- drivers/net/bonding/rte_eth_bond_pmd.c | 3 ++- drivers/net/fm10k/base/meson.build | 3 ++- lib/librte_cmdline/cmdline_parse_num.c | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-)
drivers/net/bonding/rte_eth_bond_pmd.c +2 -1
@@ -2521,7 +2521,8 @@ bond_ethdev_link_update(struct rte_eth_dev *ethdev, int wait_to_complete) bond_ctx->mode4.slave_link.link_autoneg; ethdev->data->dev_link.link_duplex = bond_ctx->mode4.slave_link.link_duplex; -/* fall through to update link speed */ +/* fall through */ +/* to update link speed */ case BONDING_MODE_ROUND_ROBIN :case BONDING_MODE_BALANCE :case BONDING_MODE_TLB :
drivers/net/fm10k/base/meson.build +2 -1
@@ -12,7 +12,8 @@ sources = [ error_cflags = ['-Wno-unused-parameter', '-Wno-unused-value', '-Wno-strict-aliasing', '-Wno-format-extra-args', - '-Wno-unused-variable', '-Wno-missing-field-initializers' + '-Wno-unused-variable', '-Wno-missing-field-initializers', + '-Wno-implicit-fallthrough' ] c_args = cflags if allow_experimental_apis
lib/librte_cmdline/cmdline_parse_num.c +1 -1
@@ -196,7 +196,7 @@ cmdline_parse_num(cmdline_parse_token_hdr_t *tk, const char *srcbuf, void *res,case HEX : st =HEX_OK ; -/* fall-through no break */ +/* fall-through */ case HEX_OK :if (c >='0' && c <='9' ) {if (add_to_res (c -'0' , &res1,16 ) <0 )
Signature · 1 line
2.21.0
PATCH 2/4 raw/ifpga: remove unneeded compiler flags
In reply to Bruce RichardsonThe warning disable flags for the base driver code were copy-pasted from another source, and are actually unnecessary for this driver. Therefore remove them.
--- drivers/raw/ifpga_rawdev/base/meson.build | 11 ----------- 1 file changed, 11 deletions(-)
drivers/raw/ifpga_rawdev/base/meson.build +0 -11
@@ -23,17 +23,6 @@ sources = [ 'opae_eth_group.c', ] -error_cflags = ['-Wno-sign-compare', '-Wno-unused-value', - '-Wno-format', '-Wno-error=format-security', - '-Wno-strict-aliasing', '-Wno-unused-but-set-variable' -] -c_args = cflags -foreach flag: error_cflags - if cc.has_argument(flag) - c_args += flag - endif -endforeach - base_lib = static_library('ifpga_rawdev_base', sources, dependencies: static_rte_eal, c_args: c_args)
Signature · 1 line
2.21.0
PATCH 3/4 build: enable extra warnings for meson build
In reply to Bruce RichardsonWhile meson always adds -Wall flag to C compiles, the make build adds extra warning flags that are not present in the meson build. This addresses that shortcoming by adding additional warning flags to our builds. The one omission is the -Wcast-align flag, which though present in make gcc builds, gives a lot of warnings/errors when used with clang.
The removed warning "-Wunused-parameter" is covered by the "-Wextra" parameter so is unnecessary.
--- config/meson.build | 24 +++++++++++++++++++++--- drivers/bus/dpaa/meson.build | 3 +++ drivers/event/dsw/meson.build | 3 +++ drivers/net/dpaa/meson.build | 4 ++++ drivers/net/i40e/base/meson.build | 3 ++- 5 files changed, 33 insertions(+), 4 deletions(-)
config/meson.build +21 -3
@@ -143,10 +143,28 @@ add_project_arguments('-include', 'rte_config.h', language: 'c') # enable extra warnings and disable any unwanted warnings warning_flags = [ - '-Wunused-parameter', - '-Wsign-compare', + # -Wall is added by meson by default, so add -Wextra only + '-Wextra', + + # additional warnings in alphabetical order '-Wcast-qual', - '-Wno-address-of-packed-member' + '-Wdeprecated', + '-Wformat-nonliteral', + '-Wformat-security', + '-Wmissing-declarations', + '-Wmissing-prototypes', + '-Wnested-externs', + '-Wold-style-definition', + '-Wpointer-arith', + '-Wsign-compare', + '-Wstrict-prototypes', + '-Wundef', + '-Wwrite-strings', + + # globally disabled warnings + '-Wno-address-of-packed-member', + '-Wno-packed-not-aligned', + '-Wno-missing-field-initializers' ] 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!!
drivers/bus/dpaa/meson.build +3 -0
@@ -27,5 +27,8 @@ allow_experimental_apis = true if cc.has_argument('-Wno-cast-qual') cflags += '-Wno-cast-qual' endif +if cc.has_argument('-Wno-pointer-arith') + cflags += '-Wno-pointer-arith' +endif includes += include_directories('include', 'base/qbman')
drivers/event/dsw/meson.build +3 -0
@@ -2,4 +2,7 @@ # Copyright(c) 2018 Ericsson AB deps += ['bus_vdev'] +if cc.has_argument('-Wno-format-nonliteral') + cflags += '-Wno-format-nonliteral' +endif sources = files('dsw_evdev.c', 'dsw_event.c', 'dsw_xstats.c')
drivers/net/dpaa/meson.build +4 -0
@@ -10,6 +10,10 @@ deps += ['mempool_dpaa'] sources = files('dpaa_ethdev.c', 'dpaa_rxtx.c') +if cc.has_argument('-Wno-pointer-arith') + cflags += '-Wno-pointer-arith' +endif + allow_experimental_apis = true install_headers('rte_pmd_dpaa.h')
drivers/net/i40e/base/meson.build +2 -1
@@ -12,7 +12,8 @@ sources = [ ] error_cflags = ['-Wno-sign-compare', '-Wno-unused-value', - '-Wno-format', '-Wno-error=format-security', + '-Wno-format', '-Wno-format-security', + '-Wno-format-nonliteral', '-Wno-strict-aliasing', '-Wno-unused-but-set-variable', '-Wno-unused-parameter', ]
Signature · 1 line
2.21.0
PATCH 4/4 drivers: remove duplicated compiler flags
In reply to Bruce RichardsonNow that -Wextra, and other warning flags are standard in the build, remove any duplication in driver build specifications.
--- drivers/net/fm10k/base/meson.build | 2 +- drivers/net/mlx4/meson.build | 1 - drivers/net/mlx5/meson.build | 1 - drivers/net/sfc/meson.build | 2 -- drivers/net/vdev_netvsc/meson.build | 2 -- 5 files changed, 1 insertion(+), 7 deletions(-)
drivers/net/fm10k/base/meson.build +1 -1
@@ -12,7 +12,7 @@ sources = [ error_cflags = ['-Wno-unused-parameter', '-Wno-unused-value', '-Wno-strict-aliasing', '-Wno-format-extra-args', - '-Wno-unused-variable', '-Wno-missing-field-initializers', + '-Wno-unused-variable', '-Wno-implicit-fallthrough' ] c_args = cflags
drivers/net/mlx4/meson.build +0 -1
@@ -55,7 +55,6 @@ if build sources += files('mlx4_glue.c') endif cflags_options = [ - '-Wextra', '-std=c11', '-Wno-strict-prototypes', '-D_BSD_SOURCE',
drivers/net/mlx5/meson.build +0 -1
@@ -66,7 +66,6 @@ if build sources += files('mlx5_glue.c') endif cflags_options = [ - '-Wextra', '-std=c11', '-Wno-strict-prototypes', '-D_BSD_SOURCE',
drivers/net/sfc/meson.build +0 -2
@@ -20,14 +20,12 @@ extra_flags += '-Wno-strict-aliasing' # Enable more warnings extra_flags += [ - '-Wextra', '-Wdisabled-optimization' ] # Compiler and version dependent flags extra_flags += [ '-Waggregate-return', - '-Wnested-externs', '-Wbad-function-cast' ]
drivers/net/vdev_netvsc/meson.build +0 -2
@@ -10,8 +10,6 @@ sources = files('vdev_netvsc.c') allow_experimental_apis = true cflags_options = [ - '-Wall', - '-Wextra', '-D_BSD_SOURCE', '-D_DEFAULT_SOURCE', '-D_XOPEN_SOURCE=600'
Signature · 1 line
2.21.0
Quoted 19 lines · Bruce Richardson
The warnings used when building DPDK with make were stricter than those
used with meson, so this patchset aligns the two as far as is possible,
while also adding in -Wextra as a general compile flag.The one difference is that with "make" we allow different flags for GCC
and clang, while with meson we are (for now) keeping them common. Therefore we drop the -Wcast-align flag as is generates too many false positive warnings on clang, and we globally use the Wno-missing-field-initializers flag for the same reason.Bruce Richardson (4):
build: allow compile with stricter fallthrough warnings raw/ifpga: remove unneeded compiler flags
build: enable extra warnings for meson build
drivers: remove duplicated compiler flags
Quoted 15 lines
config/meson.build | 24 ++++++++++++++++++++- -- drivers/bus/dpaa/meson.build | 3 +++ drivers/event/dsw/meson.build | 3 +++ drivers/net/bonding/rte_eth_bond_pmd.c | 3 ++- drivers/net/dpaa/meson.build | 4 ++++ drivers/net/fm10k/base/meson.build | 3 ++- drivers/net/i40e/base/meson.build | 3 ++- drivers/net/mlx4/meson.build | 1 - drivers/net/mlx5/meson.build | 1 - drivers/net/sfc/meson.build | 2 -- drivers/net/vdev_netvsc/meson.build | 2 -- drivers/raw/ifpga_rawdev/base/meson.build | 11 ----------- lib/librte_cmdline/cmdline_parse_num.c | 2 +- 13 files changed, 38 insertions(+), 24 deletions(-)
Signature · 2 lines
Kind regards, Luca Boccassi
v2 cover synchronise meson warnings with make
In reply to Bruce RichardsonThe warnings used when building DPDK with make were stricter than those used with meson, so this patchset aligns the two as far as is possible, while also adding in -Wextra as a general compile flag.
The one difference is that with "make" we allow different flags for GCC and clang, while with meson we are (for now) keeping them common. Therefore we drop the -Wcast-align flag as is generates too many false positive warnings on clang, and we globally use the Wno-missing-field-initializers flag for the same reason.
v2: fix path to ifpga driver in patch 2, since it has moved in the repo
Bruce Richardson (4):
build: allow compile with stricter fallthrough warnings raw/ifpga: remove unneeded compiler flags
build: enable extra warnings for meson build
drivers: remove duplicated compiler flags
config/meson.build | 24 +++++++++++++++++++++--- drivers/bus/dpaa/meson.build | 3 +++ drivers/event/dsw/meson.build | 3 +++ drivers/net/bonding/rte_eth_bond_pmd.c | 3 ++- drivers/net/dpaa/meson.build | 4 ++++ drivers/net/fm10k/base/meson.build | 3 ++- drivers/net/i40e/base/meson.build | 3 ++- drivers/net/mlx4/meson.build | 1 - drivers/net/mlx5/meson.build | 1 - drivers/net/sfc/meson.build | 2 -- drivers/net/vdev_netvsc/meson.build | 2 -- drivers/raw/ifpga/base/meson.build | 11 ----------- lib/librte_cmdline/cmdline_parse_num.c | 2 +- 13 files changed, 38 insertions(+), 24 deletions(-)
Signature · 1 line
2.21.0
PATCH v2 1/4 build: allow compile with stricter fallthrough warnings
DPDK currently compiles with implicit-fallthrough=2 warning level. With gcc -Wextra flag, the default level is 3, so some minor changes are needed to support this in DPDK.
--- drivers/net/bonding/rte_eth_bond_pmd.c | 3 ++- drivers/net/fm10k/base/meson.build | 3 ++- lib/librte_cmdline/cmdline_parse_num.c | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-)
drivers/net/bonding/rte_eth_bond_pmd.c +2 -1
@@ -2385,7 +2385,8 @@ bond_ethdev_link_update(struct rte_eth_dev *ethdev, int wait_to_complete) bond_ctx->mode4.slave_link.link_autoneg; ethdev->data->dev_link.link_duplex = bond_ctx->mode4.slave_link.link_duplex; -/* fall through to update link speed */ +/* fall through */ +/* to update link speed */ case BONDING_MODE_ROUND_ROBIN :case BONDING_MODE_BALANCE :case BONDING_MODE_TLB :
drivers/net/fm10k/base/meson.build +2 -1
@@ -12,7 +12,8 @@ sources = [ error_cflags = ['-Wno-unused-parameter', '-Wno-unused-value', '-Wno-strict-aliasing', '-Wno-format-extra-args', - '-Wno-unused-variable', '-Wno-missing-field-initializers' + '-Wno-unused-variable', '-Wno-missing-field-initializers', + '-Wno-implicit-fallthrough' ] c_args = cflags if allow_experimental_apis
lib/librte_cmdline/cmdline_parse_num.c +1 -1
@@ -196,7 +196,7 @@ cmdline_parse_num(cmdline_parse_token_hdr_t *tk, const char *srcbuf, void *res,case HEX : st =HEX_OK ; -/* fall-through no break */ +/* fall-through */ case HEX_OK :if (c >='0' && c <='9' ) {if (add_to_res (c -'0' , &res1,16 ) <0 )
Signature · 1 line
2.21.0
PATCH v2 2/4 raw/ifpga: remove unneeded compiler flags
In reply to Bruce RichardsonThe warning disable flags for the base driver code were copy-pasted from another source, and are actually unnecessary for this driver. Therefore remove them.
--- drivers/raw/ifpga/base/meson.build | 11 ----------- 1 file changed, 11 deletions(-)
drivers/raw/ifpga/base/meson.build +0 -11
@@ -23,17 +23,6 @@ sources = [ 'opae_eth_group.c', ] -error_cflags = ['-Wno-sign-compare', '-Wno-unused-value', - '-Wno-format', '-Wno-error=format-security', - '-Wno-strict-aliasing', '-Wno-unused-but-set-variable' -] -c_args = cflags -foreach flag: error_cflags - if cc.has_argument(flag) - c_args += flag - endif -endforeach - base_lib = static_library('ifpga_rawdev_base', sources, dependencies: static_rte_eal, c_args: c_args)
Signature · 1 line
2.21.0
PATCH v2 3/4 build: enable extra warnings for meson build
In reply to Bruce RichardsonWhile meson always adds -Wall flag to C compiles, the make build adds extra warning flags that are not present in the meson build. This addresses that shortcoming by adding additional warning flags to our builds. The one omission is the -Wcast-align flag, which though present in make gcc builds, gives a lot of warnings/errors when used with clang.
The removed warning "-Wunused-parameter" is covered by the "-Wextra" parameter so is unnecessary.
--- config/meson.build | 24 +++++++++++++++++++++--- drivers/bus/dpaa/meson.build | 3 +++ drivers/event/dsw/meson.build | 3 +++ drivers/net/dpaa/meson.build | 4 ++++ drivers/net/i40e/base/meson.build | 3 ++- 5 files changed, 33 insertions(+), 4 deletions(-)
config/meson.build +21 -3
@@ -143,10 +143,28 @@ add_project_arguments('-include', 'rte_config.h', language: 'c') # enable extra warnings and disable any unwanted warnings warning_flags = [ - '-Wunused-parameter', - '-Wsign-compare', + # -Wall is added by meson by default, so add -Wextra only + '-Wextra', + + # additional warnings in alphabetical order '-Wcast-qual', - '-Wno-address-of-packed-member' + '-Wdeprecated', + '-Wformat-nonliteral', + '-Wformat-security', + '-Wmissing-declarations', + '-Wmissing-prototypes', + '-Wnested-externs', + '-Wold-style-definition', + '-Wpointer-arith', + '-Wsign-compare', + '-Wstrict-prototypes', + '-Wundef', + '-Wwrite-strings', + + # globally disabled warnings + '-Wno-address-of-packed-member', + '-Wno-packed-not-aligned', + '-Wno-missing-field-initializers' ] 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!!
drivers/bus/dpaa/meson.build +3 -0
@@ -27,5 +27,8 @@ allow_experimental_apis = true if cc.has_argument('-Wno-cast-qual') cflags += '-Wno-cast-qual' endif +if cc.has_argument('-Wno-pointer-arith') + cflags += '-Wno-pointer-arith' +endif includes += include_directories('include', 'base/qbman')
drivers/event/dsw/meson.build +3 -0
@@ -2,4 +2,7 @@ # Copyright(c) 2018 Ericsson AB deps += ['bus_vdev'] +if cc.has_argument('-Wno-format-nonliteral') + cflags += '-Wno-format-nonliteral' +endif sources = files('dsw_evdev.c', 'dsw_event.c', 'dsw_xstats.c')
drivers/net/dpaa/meson.build +4 -0
@@ -10,6 +10,10 @@ deps += ['mempool_dpaa'] sources = files('dpaa_ethdev.c', 'dpaa_rxtx.c') +if cc.has_argument('-Wno-pointer-arith') + cflags += '-Wno-pointer-arith' +endif + allow_experimental_apis = true install_headers('rte_pmd_dpaa.h')
drivers/net/i40e/base/meson.build +2 -1
@@ -12,7 +12,8 @@ sources = [ ] error_cflags = ['-Wno-sign-compare', '-Wno-unused-value', - '-Wno-format', '-Wno-error=format-security', + '-Wno-format', '-Wno-format-security', + '-Wno-format-nonliteral', '-Wno-strict-aliasing', '-Wno-unused-but-set-variable', '-Wno-unused-parameter', ]
Signature · 1 line
2.21.0
PATCH v2 4/4 drivers: remove duplicated compiler flags
In reply to Bruce RichardsonNow that -Wextra, and other warning flags are standard in the build, remove any duplication in driver build specifications.
--- drivers/net/fm10k/base/meson.build | 2 +- drivers/net/mlx4/meson.build | 1 - drivers/net/mlx5/meson.build | 1 - drivers/net/sfc/meson.build | 2 -- drivers/net/vdev_netvsc/meson.build | 2 -- 5 files changed, 1 insertion(+), 7 deletions(-)
drivers/net/fm10k/base/meson.build +1 -1
@@ -12,7 +12,7 @@ sources = [ error_cflags = ['-Wno-unused-parameter', '-Wno-unused-value', '-Wno-strict-aliasing', '-Wno-format-extra-args', - '-Wno-unused-variable', '-Wno-missing-field-initializers', + '-Wno-unused-variable', '-Wno-implicit-fallthrough' ] c_args = cflags
drivers/net/mlx4/meson.build +0 -1
@@ -55,7 +55,6 @@ if build sources += files('mlx4_glue.c') endif cflags_options = [ - '-Wextra', '-std=c11', '-Wno-strict-prototypes', '-D_BSD_SOURCE',
drivers/net/mlx5/meson.build +0 -1
@@ -66,7 +66,6 @@ if build sources += files('mlx5_glue.c') endif cflags_options = [ - '-Wextra', '-std=c11', '-Wno-strict-prototypes', '-D_BSD_SOURCE',
drivers/net/sfc/meson.build +0 -2
@@ -20,14 +20,12 @@ extra_flags += '-Wno-strict-aliasing' # Enable more warnings extra_flags += [ - '-Wextra', '-Wdisabled-optimization' ] # Compiler and version dependent flags extra_flags += [ '-Waggregate-return', - '-Wnested-externs', '-Wbad-function-cast' ]
drivers/net/vdev_netvsc/meson.build +0 -2
@@ -10,8 +10,6 @@ sources = files('vdev_netvsc.c') allow_experimental_apis = true cflags_options = [ - '-Wall', - '-Wextra', '-D_BSD_SOURCE', '-D_DEFAULT_SOURCE', '-D_XOPEN_SOURCE=600'
Signature · 1 line
2.21.0
Thomas Monjalon
Applied07/10/2019 16:30, Bruce Richardson:
Quoted 10 lines
The warnings used when building DPDK with make were stricter than those used with meson, so this patchset aligns the two as far as is possible, while also adding in -Wextra as a general compile flag.
The one difference is that with "make" we allow different flags for GCC and clang, while with meson we are (for now) keeping them common. Therefore we drop the -Wcast-align flag as is generates too many false positive warnings on clang, and we globally use the Wno-missing-field-initializers flag for the same reason.
Quoted 7 lines
v2: fix path to ifpga driver in patch 2, since it has moved in the repo
Bruce Richardson (4):
build: allow compile with stricter fallthrough warnings raw/ifpga: remove unneeded compiler flags
build: enable extra warnings for meson build
drivers: remove duplicated compiler flags
Applied, thanks