On Sun, 26 May 2024, Markus Elfring wrote: > Hello, > > I constructed another small script variant for the semantic patch language. > > > @replacement disable decl_init@ > expression action, e, value; > expression list el; > identifier rc; > @@ > -int rc; > ... when != rc = value > when any > -mutex_lock > +guard(mutex) > (&e); > -rc = action(el); > -mutex_unlock(&e); > return > - rc > + action(el) > ; > > > I tried this SmPL script example out on source code from the software > “Linux next-20240523”. > 425 source files were found where some function implementations could be adjusted > also according to the application of mutual exclusion. > > > Will it become helpful to offer further SmPL script variants which can be used > together with the tool “coccicheck”? I'm not the one to decide whether we should use cleanup for mutex locks. Intuitively, my opinion would be that we should not. Something that can have so much impact on the execution of the system should be visible. But that's just my opinion. julia