Subject: Re: How do we review changes made with coccinelle?

From: Taylor Blau <[email-masked]>
Date: Fri, 31 Mar 2023 19:53:33 -0400

On Thu, Mar 30, 2023 at 11:23:40AM -0700, Glen Choo wrote:
> - When do we introduce .pending.cocci vs .cocci?

The documentation in contrib/coccinelle/README is authoritative. I'll
refer you there for the full details, but the rough idea is that:

- *.cocci patches are used to guard against bad patterns in the code
  (e.g., that we should never write "if (thing != NULL)" and instead "if
  (thing)"). When applying these transformations leads to changes, they
  are designed to break the build to avoid letting these bad patterns
  enter our tree.

- *.pending.cocci patches are used to guide large scale refactorings,
  like Ævar demonstrated in his last series. They don't cause us to fail
  the build in the meantime while the refactoring is in progress.

The latter is useful when the refactoring is either (a) too large to fit
in a single patch, or (b) would cause too many conflicts with in-flight
series.

(FWIW, I think that I'm mixing up my terminology, in that *.cocci files
are typically referred to as "transformations" and the result of running
Coccinelle on them is used to produce a patch. Shows you how much I know
about Coccinelle ;-).)

Thanks,
Taylor