Subject: Re: [PATCH] cocci: remove 'unused.cocci'

From: Ævar Arnfjörð Bjarmason <[email-masked]>
Date: Mon, 01 May 2023 19:28:50 +0200

On Mon, May 01 2023, Junio C Hamano wrote:

> Ævar Arnfjörð Bjarmason <[email-masked]> writes:
>
>> It wasn't something I intended at the time, but arguably the main use of
>> this rule since it was added was that it served as a canary for the tree
>> becoming completely broken with coccinelle, due to adding C syntax it
>> didn't understand:
>> https://lore.kernel.org/git/[email-masked]/
>
> If it weren't Coccinelle, we could have used the much nicer looking
> UNUSED(var) notation, and the compilers were all fine.
>
> Only because Coccinelle did not understand the "cute" syntax trick,
> we couldn't.  Yes, it caught us when we used a syntax it couldn't
> understand, but is that a good thing in the first place?

I think it's unambiguously a good thing that we spotted an otherwise
unknown side-effect of the proposed UNUSED(var) syntax on coccinelle.

We might also say that some bit of syntax that coccinelle doesn't
understand is so valuable that we'd like to make coccinelle itself
significantly less useful (as it wouldn't reach into those functions),
or stop using it altogether.

But that's a seperate question. I'm just pointing out that we'd be
losing a very valuable check on future syntax incompatibilities,
particularly when it comes to clever use of macros.

A better way to spot that would be to start parsing the coccinelle logs,
and detect when we have unknown parsing issues, and error on those. But
until then...