qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3 3/9] tests/style: check for mixups of bool constants with


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH v3 3/9] tests/style: check for mixups of bool constants with int variables
Date: Mon, 11 Jul 2022 18:24:22 +0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.11.0

On 7/7/22 18:37, Daniel P. Berrangé wrote:
The 'true' and 'false' constants should only ever be used with the
'bool' type, never 'int'.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
  tests/style.yml | 5 +++++
  1 file changed, 5 insertions(+)

diff --git a/tests/style.yml b/tests/style.yml
index b4e7c6111f..704227d8e9 100644
--- a/tests/style.yml
+++ b/tests/style.yml
@@ -86,3 +86,8 @@
  #        A match added to the front of the regex. Useful when
  #        'terms' is a list of strings and a common prefix is
  #        desired
+
+int_assign_bool:
+  files: \.c$

Why not check .c.inc and .h (for static inlined func)?

Regardless:
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

+  prohibit: \<int\>.*= *(true|false)\b
+  message: use bool type for boolean values



reply via email to

[Prev in Thread] Current Thread [Next in Thread]