qemu-devel
[Top][All Lists]
Advanced

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

[PATCH v2 3/7] tests/style: check for mixups of bool constants with int


From: Daniel P . Berrangé
Subject: [PATCH v2 3/7] tests/style: check for mixups of bool constants with int variables
Date: Mon, 4 Jul 2022 16:22:59 +0100

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.mak | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tests/style.mak b/tests/style.mak
index 32c7e706ba..ae658395c9 100644
--- a/tests/style.mak
+++ b/tests/style.mak
@@ -22,3 +22,9 @@
 
 include tests/style-infra.mak
 include tests/style-excludes.mak
+
+# Use 'bool', not 'int', when assigning true or false
+sc_int_assign_bool:
+       @prohibit='\<int\>.*= *(true|false)\b' \
+       halt='use bool type for boolean values' \
+       $(_sc_search_regexp)
-- 
2.36.1




reply via email to

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