1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
3 /* Avoid running this transformation on the strempty function itself and
4 * on the "make_expression" macro in src/libsystemd/sd-bus/bus-convenience.c.
5 * As Coccinelle's Location object doesn't support macro "detection", use
6 * a pretty horrifying combo of specifying a file and a special "something_else"
7 * position element, which is, apparently, the default value of
8 * "current_element" before it's set (according to the source code), thus
9 * matching any "top level" position, including macros. Let's hope we never
10 * introduce a function called "something_else"...
12 position p : script:python() {
13 not (p[0].current_element == "strempty" or
14 (p[0].file == "src/libsystemd/sd-bus/bus-convenience.c" and
15 p[0].current_element == "something_else"))
28 position p : script:python() { p[0].current_element != "strempty" };
36 position p : script:python() { p[0].current_element != "strnull" };
48 position p : script:python() { p[0].current_element != "strnull" };
56 position p : script:python() { p[0].current_element != "strna" };
68 position p : script:python() { p[0].current_element != "strna" };