[PATCH v2 1/2] treewide: remove unused address argument from pte_alloc functions

SF Markus Elfring elfring at users.sourceforge.net
Sat Oct 13 02:22:49 PDT 2018

>>> The changes were obtained by applying the following Coccinelle script.

How do you think about to adjust the order of provided information
in the commit description?
1. Update goals
2. Transformation implementation at the end

>> "^(?:pte_alloc(?:_one(?:_kernel)?)?|__pte_alloc(?:_kernel)?)$";
> Sure it looks more clever, but why?

1. Usage of non-capturing parentheses
2. Clearer specification which parts can be treated as optional
   in the search pattern.

> Ugh that's harder to read and confusing.

* Do you care for coding style and execution speed of regular expressions?

* If you would prefer to list function names without placeholders,
  you can eventually specify them also within SmPL disjunctions directly.

* It can look simpler to use an identifier list as a constraint variant.

> Again this is confusing.

The view points can be different for such SmPL code.

 T3 fn(T1 E1
-           , T2 E2
|           , T2 E2
-           , T4 E4
)     );

> It makes one think that maybe the second argument can also be removed

You expressed this as the first transformation possibility, didn't you?

You would like to delete an argument from the end of a function
or macro parameter (or expression) list.
I suggest then again to avoid the SmPL specification of source code additions
(plus lines in the file difference format).

> and requires careful observation that the ");" follows.

Yes, of course.

Would you care more in the distinction which code parts should be kept unchanged?

> Right, I don't need it in this case.

Thanks for your understanding that the metavariable “position p”
can be deleted in the SmPL rule “pte_alloc_macro”.

> But the script works either way.

I imagine that you can become interested in a bit nicer run time characteristics.

> I like to take more of a problem solving approach that makes sense,

This is usual.

> than aiming for perfection,

If you will work more with scripts for the semantic patch language,
you might become used to additional coding variants.

> after all this is a useful script that we do not need to check
> in once we finish with it.

I am curious if there will evolve a need to add similar transformation approaches
to a known script collection.

Would you eventually like to run such scripts once more?


More information about the linux-riscv mailing list