From fcd2db31c03e717d9f3b66f52af06ce60de46add Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Mon, 25 Dec 2023 11:43:27 +0100 Subject: [PATCH] coccinelle: properly drop braces around single-statement if()s --- coccinelle/zz-drop-braces.cocci | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/coccinelle/zz-drop-braces.cocci b/coccinelle/zz-drop-braces.cocci index 8c3be01c1f7..7a3382c9a7b 100644 --- a/coccinelle/zz-drop-braces.cocci +++ b/coccinelle/zz-drop-braces.cocci @@ -1,28 +1,13 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ @@ position p : script:python() { p[0].file != "src/journal/lookup3.c" }; -identifier id; -expression e; +expression e,e1; @@ -if (...) -- { +- if (e) { ++ if (e) ( - id@p(...); + e1@p; | - e@p; -) -- } - -@@ -position p : script:python() { p[0].file != "src/journal/lookup3.c" }; -identifier id; -expression e; -@@ -if (...) -- { -( - return id@p(...); -| - return e@p; + return e1@p; ) - }