Merge pull request #30689 from mrc0mmand/even-more-cocci-tweaks

coccinelle: drop a couple of FIXMEs
This commit is contained in:
Yu Watanabe
2024-01-03 03:25:30 +09:00
committed by GitHub
3 changed files with 17 additions and 7 deletions

View File

@@ -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) {})

View File

@@ -74,6 +74,7 @@ for script in "${SCRIPTS[@]}"; do
--recursive-includes \
--include-headers-for-types \
--undefined SD_BOOT \
--undefined ENABLE_DEBUG_HASHMAP \
--macro-file-builtins "coccinelle/parsing_hacks.h" \
--smpl-spacing \
--sp-file "$script" \

View File

@@ -4,3 +4,10 @@ expression p, s;
@@
- siphash24_compress(&p, sizeof(p), s);
+ siphash24_compress_typesafe(p, s);
@@
union in_addr_union p;
expression f, s;
@@
- siphash24_compress(&p, FAMILY_ADDRESS_SIZE(f), s);
+ in_addr_hash_func(&p, f, s);