|
|
Subscribe / Log in / New account

Are all patches created equal?

Are all patches created equal?

Posted Jul 21, 2011 15:20 UTC (Thu) by civodul (guest, #58311)
Parent article: Are all patches created equal?

Instead of unidiff line counts, some form of semantic patch would provide more insight on the actual amount of changes.

For instance, whitespace changes, function moves, renames, etc. would count as little since they don't change the AST.


to post comments

Are all patches created equal?

Posted Jul 24, 2011 19:41 UTC (Sun) by jnareb (subscriber, #46500) [Link] (1 responses)

Instead of unidiff line counts, some form of semantic patch would provide more insight on the actual amount of changes.
For instance, whitespace changes, function moves, renames, etc. would count as little since they don't change the AST.
Are there any tools, preferably open source, that can turn unidiff patch + preimage into some form of semantic patch (like e.g. Coccinelle)?
Without this I don't see how it would be any better than manual analysis...

Are all patches created equal?

Posted Jul 24, 2011 20:48 UTC (Sun) by civodul (guest, #58311) [Link]

Unfortunately I don't know of any tool that would create a semantic patch from a unidiff patch (the opposite of Coccinelle.)

Obviously a C parser is needed to turn source code into a canonical form (roughly, its AST). It may be possible to write a plug-in to abuse GCC to that end (see GCC-XML). Then some sort of tree diff on alpha-renamed ASTs would do it. However, I don't know what algorithms exist to compute the differences between two trees.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds