2010/11/4 Michael Stefaniuc <[email protected]>: > Julia Lawall wrote: >> On Thu, 4 Nov 2010, Michael Stefaniuc wrote: >> >>> Hello, >>> >>> the SmPL code >>> @@ @@ >>> + lock(); >>> bar( ... ); >>> + unlock(); >>> >>> applied to >>> void foo(void) >>> { >>> bar(a, >>> b); >>> } >>> >>> will produce following diff >>> + lock(); >>> bar(a, >>> b); >>> + unlock(); >>> >>> The indentation level of the code inserted after the multi-line function >>> call matches that of the last argument and not that of the function >>> identifier. I have tested this with versions 0.2.3 and 0.2.4rc5. >> >> Thanks for the report. I'm not surprised that it does this, but I'm not >> sure that I can easily fix it either. It just has a stream of tokens when >> it is doing the unparsing, not a parse tree. It is also thrown off when >> you add a statement after a conditional where the branch is indented. >> That case is indeed probably harder, because there is a complete statement >> on the line before. >> >> Anyway, I will look into the function call case. > Thanks but don't worry too much about this as it isn't a real problem. > In most cases the diff needs to be edited anyway to fix the "every > argument on a separate line" style. >
Couldn't your patched file be postprocessed with indent or astyle in order to enforce certain coding style? Or may be coccinelle itself may call such tool only on patched file? ...or even only the portion of code which was patched, but I don't how indent/astyle would behave on "code snippet" (never tried). -- Erk Membre de l'April - « promouvoir et défendre le logiciel libre » - http://www.april.org _______________________________________________ Cocci mailing list [email protected] http://lists.diku.dk/mailman/listinfo/cocci (Web access from inside DIKUs LAN only)
