[v2,1/2] build: change flag variable type to boolean

Message ID 20230612171456.173378-1-bruce.richardson@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series [v2,1/2] build: change flag variable type to boolean |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Bruce Richardson June 12, 2023, 5:14 p.m. UTC
  The has_libnuma flag was using 0 and 1 integer values, instead of the
more appropriate boolean type. Change to use true/false instead.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 config/arm/meson.build    | 2 +-
 config/meson.build        | 4 ++--
 lib/eal/linux/meson.build | 2 +-
 lib/vhost/meson.build     | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)
  

Comments

David Marchand June 13, 2023, 1:43 p.m. UTC | #1
On Mon, Jun 12, 2023 at 7:15 PM Bruce Richardson
<bruce.richardson@intel.com> wrote:
>
> The has_libnuma flag was using 0 and 1 integer values, instead of the
> more appropriate boolean type. Change to use true/false instead.
>
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>

This patch lgtm (with or without the suggestion on config/arm below).
Reviewed-by: David Marchand <david.marchand@redhat.com>

[snip]

> diff --git a/config/arm/meson.build b/config/arm/meson.build
> index 43f6a551a2..faba5e38cf 100644
> --- a/config/arm/meson.build
> +++ b/config/arm/meson.build
> @@ -592,7 +592,7 @@ if update_flags
>          part_number = soc_config['part_number']
>          soc_flags = soc_config.get('flags', [])
>          if not soc_config.get('numa', true)
> -            has_libnuma = 0
> +            has_libnuma = false
>          endif

Maybe has_libnuma = soc_config.get('numa', true) ?


>
>          disable_drivers += ',' + soc_config.get('disable_drivers', '')



The same cleanup could be done to has_libfdt.
Additionnally, I wonder if we could remove those "== true" or "==
false" checks here and there in meson.build files.
  
Bruce Richardson June 13, 2023, 1:55 p.m. UTC | #2
On Tue, Jun 13, 2023 at 03:43:34PM +0200, David Marchand wrote:
> On Mon, Jun 12, 2023 at 7:15 PM Bruce Richardson
> <bruce.richardson@intel.com> wrote:
> >
> > The has_libnuma flag was using 0 and 1 integer values, instead of the
> > more appropriate boolean type. Change to use true/false instead.
> >
> > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> 
> This patch lgtm (with or without the suggestion on config/arm below).
> Reviewed-by: David Marchand <david.marchand@redhat.com>
> 
> [snip]
> 
> > diff --git a/config/arm/meson.build b/config/arm/meson.build
> > index 43f6a551a2..faba5e38cf 100644
> > --- a/config/arm/meson.build
> > +++ b/config/arm/meson.build
> > @@ -592,7 +592,7 @@ if update_flags
> >          part_number = soc_config['part_number']
> >          soc_flags = soc_config.get('flags', [])
> >          if not soc_config.get('numa', true)
> > -            has_libnuma = 0
> > +            has_libnuma = false
> >          endif
> 
> Maybe has_libnuma = soc_config.get('numa', true) ?
> 
> 
> >
> >          disable_drivers += ',' + soc_config.get('disable_drivers', '')
> 
> 
> 
> The same cleanup could be done to has_libfdt.
> Additionnally, I wonder if we could remove those "== true" or "==
> false" checks here and there in meson.build files.
> 
I will take a look, and I think I'll also split this patch off from the
patch 2, to add an error for libnuma, since the two aren't really linked,
and this patch should probably be the simpler merge. I'll see about doing a
set for just int to boolean cleanups if I get the chance.

/Bruce
  

Patch

diff --git a/config/arm/meson.build b/config/arm/meson.build
index 43f6a551a2..faba5e38cf 100644
--- a/config/arm/meson.build
+++ b/config/arm/meson.build
@@ -592,7 +592,7 @@  if update_flags
         part_number = soc_config['part_number']
         soc_flags = soc_config.get('flags', [])
         if not soc_config.get('numa', true)
-            has_libnuma = 0
+            has_libnuma = false
         endif
 
         disable_drivers += ',' + soc_config.get('disable_drivers', '')
diff --git a/config/meson.build b/config/meson.build
index 65087ce090..8aebccbbdc 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -174,7 +174,7 @@  if link_lib != ''
 endif
 
 # check for libraries used in multiple places in DPDK
-has_libnuma = 0
+has_libnuma = false
 find_libnuma = true
 if meson.is_cross_build() and not meson.get_cross_property('numa', true)
     # don't look for libnuma if explicitly disabled in cross build
@@ -184,7 +184,7 @@  if find_libnuma
     numa_dep = cc.find_library('numa', required: false)
     if numa_dep.found() and cc.has_header('numaif.h')
         dpdk_conf.set10('RTE_HAS_LIBNUMA', true)
-        has_libnuma = 1
+        has_libnuma = true
         add_project_link_arguments('-lnuma', language: 'c')
         dpdk_extra_ldflags += '-lnuma'
     endif
diff --git a/lib/eal/linux/meson.build b/lib/eal/linux/meson.build
index 1b913acc06..e99ebed256 100644
--- a/lib/eal/linux/meson.build
+++ b/lib/eal/linux/meson.build
@@ -20,6 +20,6 @@  sources += files(
 )
 
 deps += ['kvargs', 'telemetry']
-if has_libnuma == 1
+if has_libnuma
     dpdk_conf.set10('RTE_EAL_NUMA_AWARE_HUGEPAGES', true)
 endif
diff --git a/lib/vhost/meson.build b/lib/vhost/meson.build
index 0d1abf6283..9e39d221a1 100644
--- a/lib/vhost/meson.build
+++ b/lib/vhost/meson.build
@@ -5,7 +5,7 @@  if not is_linux
     build = false
     reason = 'only supported on Linux'
 endif
-if has_libnuma == 1
+if has_libnuma
     dpdk_conf.set10('RTE_LIBRTE_VHOST_NUMA', true)
 endif
 if (toolchain == 'gcc' and cc.version().version_compare('>=8.3.0'))