* [PATCH] build: fix meson warning about using compiler warning flags
@ 2022-01-21 15:53 Bruce Richardson
2022-01-21 16:12 ` [PATCH v2] " Bruce Richardson
2022-01-21 16:41 ` [PATCH] " Luca Boccassi
0 siblings, 2 replies; 4+ messages in thread
From: Bruce Richardson @ 2022-01-21 15:53 UTC (permalink / raw)
To: dev; +Cc: bluca, Bruce Richardson
Each build, meson would issue a warning reporting that the
"warning_level" setting should be used in place of adding -Wextra
directly to our build commands. Testing with meson 0.61 shows that the
only difference for gcc and clang builds between warning levels 1 and
2 is the addition of -Wextra, so we can remove the warning by deleting
our explicit set of Wextra and changing the build defaults to
warning_level 2.
Fixes: 524a0d5d66b9 ("build: enable extra warnings with meson")
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
NOTE1: Not putting CC stable for this patch, I don't believe it's worth
the risk of backporting.
NOTE2: For reference, when building a test "hello world" project with
different warning levels, the following flags are used by meson:
warning_level=0: <none>
warning_level=1: -Wall -Winvalid-pch
warning_level=2: -Wall -Winvalid-pch -Wextra
warning_level=3: -Wall -Winvalid-pch -Wextra -Wpedantic
---
config/meson.build | 5 ++---
meson.build | 2 +-
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/config/meson.build b/config/meson.build
index ee12318d4f..7134e80e8d 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -247,10 +247,9 @@ endif
add_project_arguments('-include', 'rte_config.h', language: 'c')
# enable extra warnings and disable any unwanted warnings
+# -Wall is added by default at warning level 1, and -Wextra
+# at warning level 2 (DPDK default)
warning_flags = [
- # -Wall is added by meson by default, so add -Wextra only
- '-Wextra',
-
# additional warnings in alphabetical order
'-Wcast-qual',
'-Wdeprecated',
diff --git a/meson.build b/meson.build
index 1223b79d74..070243a33d 100644
--- a/meson.build
+++ b/meson.build
@@ -7,7 +7,7 @@ project('DPDK', 'C',
version: run_command(find_program('cat', 'more'),
files('VERSION'), check: true).stdout().strip(),
license: 'BSD',
- default_options: ['buildtype=release', 'default_library=static'],
+ default_options: ['buildtype=release', 'default_library=static', 'warning_level=2'],
meson_version: '>= 0.49.2'
)
--
2.32.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2] build: fix meson warning about using compiler warning flags
2022-01-21 15:53 [PATCH] build: fix meson warning about using compiler warning flags Bruce Richardson
@ 2022-01-21 16:12 ` Bruce Richardson
2022-01-21 16:41 ` [PATCH] " Luca Boccassi
1 sibling, 0 replies; 4+ messages in thread
From: Bruce Richardson @ 2022-01-21 16:12 UTC (permalink / raw)
To: dev; +Cc: Bruce Richardson
Each build, meson would issue a warning reporting that the
"warning_level" setting should be used in place of adding -Wextra
directly to our build commands. Testing with meson 0.61 shows that the
only difference for gcc and clang builds between warning levels 1 and
2 is the addition of -Wextra, so we can remove the warning by deleting
our explicit set of Wextra and changing the build defaults to
warning_level 2.
Fixes: 524a0d5d66b9 ("build: enable extra warnings with meson")
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
V2: fixed CI apply issues due to V1 being based on top of patch
'build: fix warnings when running external commands'
NOTE1: Not putting CC stable for this patch, I don't believe it's worth
the risk of backporting.
NOTE2: For reference, when building a test "hello world" project with
different warning levels, the following flags are used by meson:
warning_level=0: <none>
warning_level=1: -Wall -Winvalid-pch
warning_level=2: -Wall -Winvalid-pch -Wextra
warning_level=3: -Wall -Winvalid-pch -Wextra -Wpedantic
---
config/meson.build | 5 ++---
meson.build | 2 +-
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/config/meson.build b/config/meson.build
index 805d5d51d0..cb236d9187 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -246,10 +246,9 @@ endif
add_project_arguments('-include', 'rte_config.h', language: 'c')
# enable extra warnings and disable any unwanted warnings
+# -Wall is added by default at warning level 1, and -Wextra
+# at warning level 2 (DPDK default)
warning_flags = [
- # -Wall is added by meson by default, so add -Wextra only
- '-Wextra',
-
# additional warnings in alphabetical order
'-Wcast-qual',
'-Wdeprecated',
diff --git a/meson.build b/meson.build
index 12cb6e0e83..0a844bce9e 100644
--- a/meson.build
+++ b/meson.build
@@ -7,7 +7,7 @@ project('DPDK', 'C',
version: run_command(find_program('cat', 'more'),
files('VERSION')).stdout().strip(),
license: 'BSD',
- default_options: ['buildtype=release', 'default_library=static'],
+ default_options: ['buildtype=release', 'default_library=static', 'warning_level=2'],
meson_version: '>= 0.49.2'
)
--
2.32.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] build: fix meson warning about using compiler warning flags
2022-01-21 15:53 [PATCH] build: fix meson warning about using compiler warning flags Bruce Richardson
2022-01-21 16:12 ` [PATCH v2] " Bruce Richardson
@ 2022-01-21 16:41 ` Luca Boccassi
2022-02-02 15:34 ` Thomas Monjalon
1 sibling, 1 reply; 4+ messages in thread
From: Luca Boccassi @ 2022-01-21 16:41 UTC (permalink / raw)
To: Bruce Richardson, dev
On Fri, 2022-01-21 at 15:53 +0000, Bruce Richardson wrote:
> Each build, meson would issue a warning reporting that the
> "warning_level" setting should be used in place of adding -Wextra
> directly to our build commands. Testing with meson 0.61 shows that the
> only difference for gcc and clang builds between warning levels 1 and
> 2 is the addition of -Wextra, so we can remove the warning by deleting
> our explicit set of Wextra and changing the build defaults to
> warning_level 2.
>
> Fixes: 524a0d5d66b9 ("build: enable extra warnings with meson")
>
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
>
> NOTE1: Not putting CC stable for this patch, I don't believe it's worth
> the risk of backporting.
>
> NOTE2: For reference, when building a test "hello world" project with
> different warning levels, the following flags are used by meson:
>
> warning_level=0: <none>
> warning_level=1: -Wall -Winvalid-pch
> warning_level=2: -Wall -Winvalid-pch -Wextra
> warning_level=3: -Wall -Winvalid-pch -Wextra -Wpedantic
> ---
> config/meson.build | 5 ++---
> meson.build | 2 +-
> 2 files changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/config/meson.build b/config/meson.build
> index ee12318d4f..7134e80e8d 100644
> --- a/config/meson.build
> +++ b/config/meson.build
> @@ -247,10 +247,9 @@ endif
> add_project_arguments('-include', 'rte_config.h', language: 'c')
>
>
> # enable extra warnings and disable any unwanted warnings
> +# -Wall is added by default at warning level 1, and -Wextra
> +# at warning level 2 (DPDK default)
> warning_flags = [
> - # -Wall is added by meson by default, so add -Wextra only
> - '-Wextra',
> -
> # additional warnings in alphabetical order
> '-Wcast-qual',
> '-Wdeprecated',
> diff --git a/meson.build b/meson.build
> index 1223b79d74..070243a33d 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -7,7 +7,7 @@ project('DPDK', 'C',
> version: run_command(find_program('cat', 'more'),
> files('VERSION'), check: true).stdout().strip(),
> license: 'BSD',
> - default_options: ['buildtype=release', 'default_library=static'],
> + default_options: ['buildtype=release', 'default_library=static', 'warning_level=2'],
> meson_version: '>= 0.49.2'
> )
>
>
Acked-by: Luca Boccassi <bluca@debian.org>
--
Kind regards,
Luca Boccassi
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] build: fix meson warning about using compiler warning flags
2022-01-21 16:41 ` [PATCH] " Luca Boccassi
@ 2022-02-02 15:34 ` Thomas Monjalon
0 siblings, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2022-02-02 15:34 UTC (permalink / raw)
To: Bruce Richardson; +Cc: dev, Luca Boccassi
21/01/2022 17:41, Luca Boccassi:
> On Fri, 2022-01-21 at 15:53 +0000, Bruce Richardson wrote:
> > Each build, meson would issue a warning reporting that the
> > "warning_level" setting should be used in place of adding -Wextra
> > directly to our build commands. Testing with meson 0.61 shows that the
> > only difference for gcc and clang builds between warning levels 1 and
> > 2 is the addition of -Wextra, so we can remove the warning by deleting
> > our explicit set of Wextra and changing the build defaults to
> > warning_level 2.
> >
> > Fixes: 524a0d5d66b9 ("build: enable extra warnings with meson")
> >
> > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> > ---
> >
> > NOTE1: Not putting CC stable for this patch, I don't believe it's worth
> > the risk of backporting.
> >
> > NOTE2: For reference, when building a test "hello world" project with
> > different warning levels, the following flags are used by meson:
> >
> > warning_level=0: <none>
> > warning_level=1: -Wall -Winvalid-pch
> > warning_level=2: -Wall -Winvalid-pch -Wextra
> > warning_level=3: -Wall -Winvalid-pch -Wextra -Wpedantic
> > ---
>
> Acked-by: Luca Boccassi <bluca@debian.org>
Applied, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-02-02 15:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-21 15:53 [PATCH] build: fix meson warning about using compiler warning flags Bruce Richardson
2022-01-21 16:12 ` [PATCH v2] " Bruce Richardson
2022-01-21 16:41 ` [PATCH] " Luca Boccassi
2022-02-02 15:34 ` Thomas Monjalon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).