Remove the "when strict" constraint from the newly introduced rule to find unused code. As seen in the change this will help us find cases where a "return" was causing spatch in the middle of our match was causing spatch to abort its analysis. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx> --- builtin/merge.c | 2 -- contrib/coccinelle/unused.cocci | 2 -- 2 files changed, 4 deletions(-) diff --git a/builtin/merge.c b/builtin/merge.c index bbd70b17bc6..23170f2d2a6 100644 --- a/builtin/merge.c +++ b/builtin/merge.c @@ -375,7 +375,6 @@ static void reset_hard(const struct object_id *oid, int verbose) static void restore_state(const struct object_id *head, const struct object_id *stash) { - struct strbuf sb = STRBUF_INIT; const char *args[] = { "stash", "apply", NULL, NULL }; if (is_null_oid(stash)) @@ -391,7 +390,6 @@ static void restore_state(const struct object_id *head, */ run_command_v_opt(args, RUN_GIT_CMD); - strbuf_release(&sb); refresh_cache(REFRESH_QUIET); } diff --git a/contrib/coccinelle/unused.cocci b/contrib/coccinelle/unused.cocci index 43942f3cd4f..9f0101c1350 100644 --- a/contrib/coccinelle/unused.cocci +++ b/contrib/coccinelle/unused.cocci @@ -47,7 +47,6 @@ identifier REL1 =~ "^strbuf_release$"; // ... Optionally followed by lines that make no use of "buf", "&buf" // etc., but which ... <... when != \( I \| &I \) - when strict ( // .. (only) make use of "buf" or "&buf" to call something like // "strbuf_init(&buf, ...)" ... @@ -67,7 +66,6 @@ identifier REL1 =~ "^strbuf_release$"; // init/strbuf_release() patterns, where "&buf" could be used // afterwards. ... when != \( I \| &I \) - when strict // This rule also isn't capable of finding cases where &buf is used, // but only to e.g. pass that variable to a static function which // doesn't use it. The analysis is only function-local. -- 2.37.0.900.g4d0de1cceb2