Files
systemd/coccinelle/sd_build_pair.cocci
Frantisek Sumsal 6dcabd5f5e coccinelle: simplify file exclusions
Use Coccinelle's "depends on" directive to exclude files from certain
transformations. This should make them a bit simpler and possibly
faster, since we don't have to shell out to Python.

Unfortunately, this works only for file/directory exclusions. For
function and other more complex exclusions we still need to use Python,
at least for now.

Also, completely drop the file exclusion for man/ in the xsprintf
transformation, since we filter out everything under man/ before we even
run Coccinelle (in run-coccinelle.sh).
2026-03-14 23:56:53 +00:00

22 lines
648 B
Plaintext

/* SPDX-License-Identifier: LGPL-2.1-or-later */
/* Disable this transformation on test-json.c */
@ depends on !(file in "src/test/test-json.c") @
expression key, val;
@@
(
- SD_JSON_BUILD_PAIR(key, SD_JSON_BUILD_BOOLEAN(val))
+ SD_JSON_BUILD_PAIR_BOOLEAN(key, val)
|
- SD_JSON_BUILD_PAIR(key, SD_JSON_BUILD_INTEGER(val))
+ SD_JSON_BUILD_PAIR_INTEGER(key, val)
|
- SD_JSON_BUILD_PAIR(key, SD_JSON_BUILD_STRING(val))
+ SD_JSON_BUILD_PAIR_STRING(key, val)
|
- SD_JSON_BUILD_PAIR(key, SD_JSON_BUILD_UNSIGNED(val))
+ SD_JSON_BUILD_PAIR_UNSIGNED(key, val)
|
- SD_JSON_BUILD_PAIR(key, SD_JSON_BUILD_VARIANT(val))
+ SD_JSON_BUILD_PAIR_VARIANT(key, val)
)