]> git.puffer.fish Git - matthieu/frr.git/commitdiff
tools: Add coccinelle script to convert int to bool if returning value is bool
authorDonatas Abraitis <donatas.abraitis@gmail.com>
Wed, 4 Mar 2020 13:29:22 +0000 (15:29 +0200)
committerDonatas Abraitis <donatas.abraitis@gmail.com>
Wed, 4 Mar 2020 15:04:52 +0000 (17:04 +0200)
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
scripts/coccinelle/bool_function_type.cocci [new file with mode: 0644]

diff --git a/scripts/coccinelle/bool_function_type.cocci b/scripts/coccinelle/bool_function_type.cocci
new file mode 100644 (file)
index 0000000..71bf4f5
--- /dev/null
@@ -0,0 +1,19 @@
+@@
+identifier fn;
+typedef bool;
+symbol false;
+symbol true;
+@@
+
+- int
++ bool
+fn (...)
+{
+?...
+return
+(
+  true
+|
+  false
+);
+}