diff options
author | Frantisek Sumsal <frantisek@sumsal.cz> | 2023-12-28 17:12:24 +0100 |
---|---|---|
committer | Frantisek Sumsal <frantisek@sumsal.cz> | 2024-01-02 19:12:05 +0100 |
commit | cd4b16c0827f1f96aad19fb6e8952e03e419389d (patch) | |
tree | e0442506e38eabb9a1dcdf877d3ee156344878f9 /coccinelle/parsing_hacks.h | |
parent | Merge pull request #30684 from systemd/update-labeler-configuration (diff) | |
download | systemd-cd4b16c0827f1f96aad19fb6e8952e03e419389d.tar.xz systemd-cd4b16c0827f1f96aad19fb6e8952e03e419389d.zip |
coccinelle: drop a couple of FIXMEs
Turns out Coccinelle can handle compound literals just fine, the parsing
errors were caused by incorrectly parsed macros in code before the
literals, so let's just provide simplified versions for such macros.
The parsing error in `Type *foo[ELEMENTSOF(bar)] = {};` is actually
harmless; it occurs only when creating an array of pointers for a type
that's in an external header and it occurs only on the first parser's
pass, subsequent passes resolve the type correctly.
Also, unset ENABLE_DEBUG_HASHMAP, so Coccinelle doesn't expand the
hashmap debug macros.
As for the remaining FIXMEs, I opened a couple of issues in the
Coccinelle upstream to see if they can be fixed there (or at least
properly analyzed).
Diffstat (limited to 'coccinelle/parsing_hacks.h')
-rw-r--r-- | coccinelle/parsing_hacks.h | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/coccinelle/parsing_hacks.h b/coccinelle/parsing_hacks.h index 0b2f690f54..9e77e514dd 100644 --- a/coccinelle/parsing_hacks.h +++ b/coccinelle/parsing_hacks.h @@ -2,12 +2,11 @@ /* FIXME * - issues with parsing stuff like - * * int foo[ELEMENTSOF(bar)] = {}; - * * validchars = UPPERCASE_LETTERS DIGITS; - * * multiline compound literals (some instances) - * * compound literals in function calls (some instances) - * * keywords in macro invocations like FOREACH_DIRENT_ALL(de, d, return -errno) - * (also, see FIXME in the TEST stuff below) + * - validchars = UPPERCASE_LETTERS DIGITS; + * - see: https://github.com/coccinelle/coccinelle/issues/341 + * - keywords in macro invocations like FOREACH_DIRENT_ALL(de, d, return -errno) + * - see: https://github.com/coccinelle/coccinelle/issues/340 + * - also see the FIXME in the TEST() stuff below */ /* This file contains parsing hacks for Coccinelle (spatch), to make it happy with some of our more complex @@ -62,8 +61,9 @@ /* Coccinelle doesn't know this keyword, so just drop it, since it's not important for any of our rules. */ #define thread_local -/* Coccinelle fails to get this one from the included headers, so let's just drop it. */ +/* Coccinelle fails to parse these from the included headers, so let's just drop them. */ #define PAM_EXTERN +#define STACK_OF(x) /* Mark a couple of iterator explicitly as iterators, otherwise Coccinelle gets a bit confused. Coccinelle * can usually infer this information automagically, but in these specific cases it needs a bit of help. */ @@ -74,7 +74,9 @@ #define LIST_FOREACH(name, i, head) YACFE_ITERATOR #define ORDERED_HASHMAP_FOREACH(e, h) YACFE_ITERATOR #define SET_FOREACH(e, s) YACFE_ITERATOR +#define STRV_FOREACH_BACKWARDS YACFE_ITERATOR /* Coccinelle really doesn't like multiline macros that are not in the "usual" do { ... } while(0) format, so * let's help it a little here by providing simplified one-line versions. */ #define CMSG_BUFFER_TYPE(x) union { uint8_t align_check[(size) >= CMSG_SPACE(0) && (size) == CMSG_ALIGN(size) ? 1 : -1]; } +#define SD_ID128_MAKE(...) ((const sd_id128) {}) |