~npalix/coccinelle/upstream

Viewing all changes in revision 4653.

  • Committer: Julia Lawall
  • Date: 2018-08-12 17:39:03 UTC
  • Revision ID: git-v1:97695d059cd5e3a7a5597e056f748e5fdb97ddac
Keep whitespace before comments in statements and declarations.

This consists in adding an "original" field to the MetaVals of
statements and declarations.  This field is just passed around during
the matching process, but is used if the statement or declaration
metavariable ever appears in + code.  If this is not done, the
whitespace in the comments all disappears, and the commented out things
run together in the result.  This is illustrated by the following
command line:

spatch -test copys --macro-file-builtins soa.h

The changes required are to use this original field in
parsing_c/unparse_c.ml, to update ctlcocci_integration.ml to ignore it,
to update lib_parsing_c.ml to add a real_strip function that keeps
comments, to update cocci_vs_c.ml to add the original field, and to
update various other files to ignore it.

This could be done for other metavariable types if it seems to be useful.

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: