]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
coccinelle: add a transformation for GNU conditionals
authorFrantisek Sumsal <frantisek@sumsal.cz>
Sat, 18 Mar 2023 12:56:38 +0000 (13:56 +0100)
committerFrantisek Sumsal <frantisek@sumsal.cz>
Sat, 18 Mar 2023 13:23:11 +0000 (14:23 +0100)
i.e. x ? x : y => x ?: y

coccinelle/cond-omit-middle.cocci [new file with mode: 0644]

diff --git a/coccinelle/cond-omit-middle.cocci b/coccinelle/cond-omit-middle.cocci
new file mode 100644 (file)
index 0000000..f1587b8
--- /dev/null
@@ -0,0 +1,7 @@
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+/* See: https://gcc.gnu.org/onlinedocs/gcc/Conditionals.html#Conditionals */
+@@
+expression e, x;
+@@
+- e ? e : x
++ e ?: x