From d8b01b013b6db7cfdeaaff2cd1baf42f8ce33fc5 Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Wed, 4 Mar 2020 15:29:22 +0200 Subject: [PATCH] tools: Add coccinelle script to convert int to bool if returning value is bool Signed-off-by: Donatas Abraitis --- scripts/coccinelle/bool_function_type.cocci | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 scripts/coccinelle/bool_function_type.cocci diff --git a/scripts/coccinelle/bool_function_type.cocci b/scripts/coccinelle/bool_function_type.cocci new file mode 100644 index 0000000000..71bf4f53b8 --- /dev/null +++ b/scripts/coccinelle/bool_function_type.cocci @@ -0,0 +1,19 @@ +@@ +identifier fn; +typedef bool; +symbol false; +symbol true; +@@ + +- int ++ bool +fn (...) +{ +?... +return +( + true +| + false +); +} -- 2.39.5