Coccinelle release 0.2.5-rc7.
[bpt/coccinelle.git] / docs / manual / spatch_options.tex
index 0edcb8b..09fe72e 100644 (file)
@@ -80,6 +80,9 @@ isomorphisms to the specified integer.
 \rare{-no\_iso\_limit} Put no limit on the number of times that
 isomorphisms can be applied. This is the default.
 
+\rare{-disable\_iso}{Disable a specific isomorphism from the command line.
+  This option can be specified multiple times.}
+
 \developer{-track\_iso}{ Gather information about isomorphism usage.}
 
 \developer{-profile\_iso}{ Gather information about the time required for
@@ -129,6 +132,13 @@ $\langle$file$\rangle$:$\langle$function$\rangle$}{ Print a control-flow
 graph for all of the functions in a file or for a specific function in a
 file.  This requires {\tt dot} (http://www.graphviz.org/) and {\tt gv}.}
 
+\rare{-control\_flow\_to\_file $\langle$file$\rangle$,
+  -control\_flow\_to\_file
+  $\langle$file$\rangle$:$\langle$function$\rangle$}{ Like -control\_flow
+  but just puts the dot output in a file in the {\em current} directory.
+  For PATH/file.c, this produces file:xxx.dot for each (selected) function
+  xxx in PATH/file.c.}
+
 \rare{-type\_c $\langle$file$\rangle$}{ Parse a C file and pretty-print a
 version including type information.}
 
@@ -171,15 +181,23 @@ specified.  The index may be created using the script {\tt
 http://webglimpse.net/.  In conjunction with the option {\bf -patch\_cocci}
 this option prints the regular expression that will be passed to glimpse.}
 
-\rare{-dir}{ Specify a directory containing C files to process.  By
-  default, the include path will be set to the ``include'' subdirectory of
-  this directory.  A different include path can be specified using the
-  option {\bf -I}.  {\bf -dir} only considers the rightmost directory in
-  the argument list.  This behavior is convenient for creating a script
-  that always works on a single directory, but allows the user of the
-  script to override the provided directory with another one.  Spatch
-  collects the files in the directory using {\tt find} and does not follow
-  symbolic links.}
+\normal{-use\_idutils}{ Use an id-utils index created using lid to select
+  the files to which a semantic patch may be relevant.  This option
+  requires that a directory is specified.  The index may be created using
+  the script {\tt coccinelle/scripts/ idindex\_cocci.sh}.  In conjunction
+  with the option {\bf -patch\_cocci} this option prints the regular
+  expression that will be passed to glimpse.}
+
+\rare{-dir}{ Specify a directory containing C files to process.  A trailing
+  {\tt /} is permitted on the directory name and has no impact on the
+  result.  By default, the include path will be set to the ``include''
+  subdirectory of this directory.  A different include path can be
+  specified using the option {\bf -I}.  {\bf -dir} only considers the
+  rightmost directory in the argument list.  This behavior is convenient
+  for creating a script that always works on a single directory, but allows
+  the user of the script to override the provided directory with another
+  one.  Spatch collects the files in the directory using {\tt find} and
+  does not follow symbolic links.}
 
 \developer{-kbuild\_info $\langle$file$\rangle$}{ The specified file
   contains information about which sets of files should be considered in
@@ -214,6 +232,10 @@ which score file to compare with in the testall run}
 
 \rare{-parse\_error\_msg}{Show parsing errors in the C file.}
 
+\rare{-verbose\_parsing}{Show parsing errors in the C file, as well as
+  information about attempts to accomodate such errors.  This implicitly
+  sets -parse\_error\_msg.}
+
 \rare{-type\_error\_msg}{Show information about where the C type checker
   was not able to determine the type of an expression.}
 
@@ -258,11 +280,13 @@ stored in a cache.
 
 \normal{-macro\_file $\langle$file$\rangle$}{
   Extra macro definitions to be taken into account when parsing the C
-  files.}
+  files.  This uses the provided macro definitions in addition to those in
+  the default macro file.}
 
 \normal{-macro\_file\_builtins $\langle$file$\rangle$}{
   Builtin macro definitions to be taken into account when parsing the C
-  files.}
+  files.  This causes the macro definitions provided in the default macro
+  file to be ignored and the ones in the specified file to be used instead.}
 
 \rare{-ifdef\_to\_if,-no\_ifdef\_to\_if}{
 The option {\bf -ifdef\_to\_if}
@@ -281,24 +305,34 @@ other \#ifdef.}
 
 \subsubsection*{Include files}
 
-\normal{-all\_includes, -local\_includes, -no\_includes}{
-These options control which include files mentioned in a C file are taken into
-account.  {\bf -all\_includes} indicates that all included files will be
-processed.  {\bf -local\_includes} indicates that only included files in
-the current directory will be processed.  {\bf -no\_includes} indicates
-that no included files will be processed.  If the semantic patch contains
-type specifications on expression metavariables, then the default is {\bf
--local\_includes}.  Otherwise the default is {\bf -no\_includes}.  At most
-one of these options can be specified.}
-
-\normal{-I $\langle$path$\rangle$}{ This option specifies the directory in
-  which to find non-local include files.  This option should be used only
-  once, as each use will overwrite the preceding one.}
+\normal{-recursive\_includes, -all\_includes, -local\_includes,
+  -no\_includes}{ These options control which include files mentioned in a
+  C file are taken into account.  {\bf -really\_all\_includes} indicates
+  that all included files mentioned in the .c file(s) or any included files
+  will be processed.  {\bf -all\_includes} indicates that all included
+  files mentioned in the .c file(s) will be processed.  {\bf
+    -local\_includes} indicates that only included files in the current
+  directory will be processed.  {\bf -no\_includes} indicates that no
+  included files will be processed.  If the semantic patch contains type
+  specifications on expression metavariables, then the default is {\bf
+    -local\_includes}.  Otherwise the default is {\bf -no\_includes}.  At
+  most one of these options can be specified.}
+
+\normal{-I $\langle$path$\rangle$}{ This option specifies a directory
+  in which to find non-local include files.  This option can be used
+  several times.}
 
 \rare{-relax\_include\_path}{This option when combined with -all\_includes
   causes the search for local
-  include files to consider the directory specified using {\bf -I} if the
-  included file is not found in the current directory.}
+  include files to consider the current directory, even if the include
+  patch specifies a subdirectory.  This is really only useful for testing,
+  eg with the option {\bf -testall}}
+
+\rare{-c++}{Make an extremely minimal effort to parse C++ code.  Currently,
+  this is limited to allowing identifiers to contain ``::'', tilde, and
+  template invocations.  Consider testing your code first with spatch
+  -type\_c to see if there are any type annotations in the code you are
+  interested in processing.  If not, then it was probably not parsed.}
 
 \section{Application of the semantic patch to the C code}
 
@@ -367,6 +401,18 @@ version of {\bf -partial\_match}.}
 
 \subsection{Actions during the application of the semantic patch}
 
+\normal{-D rulename}{Run the patch considering that the virtual rule
+  ``rulename'' is satisfied.  Virtual rules should be declared at the
+  beginning of the semantic patch in a comma separated list following the
+  keyword virtual.  Other rules can depend on the satisfaction or non
+  satifaction of these rules using the keyword {\tt depends on} in the
+  usual way.}
+
+\normal{-D variable=value}{Run the patch considering that the virtual
+  identifier metavariable ``variable'' is bound to ``value''.  Any
+  identifier metavariable can be designated as being virtual by giving it
+  the rule name {\tt virtual}.  An example is in demos/vm.coci}
+
 \rare{-allow\_inconsistent\_paths}{Normally, a term that is transformed
   should only be accessible from other terms that are matched by the
   semantic patch.  This option removes this constraint.  Doing so, is
@@ -425,9 +471,15 @@ Normally, the only output is a diff printed to standard output.
 
 \rare{-o $\langle$file$\rangle$}{ The output file.}
 
-\rare{-inplace}{ Modify the input file.}
+\rare{-in\_place}{ Modify the input file.  By default, the input file is
+  overwritten, with no backup.}
+
+\rare{-backup\_suffix}{The suffix of the file to use in making a backup of
+  the original file(s).  This suffix should include the leading ``.'', if
+  one is desired.  This option only has an effect when the option
+  {\tt -in\_place} is also used.}
 
-\rare{-outplace}{ Store modifications in a .cocci\_res file.}
+\rare{-out\_place}{ Store modifications in a .cocci\_res file.}
 
 \rare{-no\_show\_diff}{ Normally, a diff between the original and transformed
 code is printed on the standard output.  This option causes this not to be
@@ -435,6 +487,15 @@ done.}
 
 \rare{-U}{ Set number of diff context lines.}
 
+\rare{-patch $\langle$path$\rangle$}{The prefix of the pathname of the
+  directory or file name that should dropped from the diff line in the
+  generated patch.  This is useful if you want to apply a patch only to a
+  subdirectory of a source code tree but want to create a patch that can be
+  applied at the root of the source code tree.  An example could be {\tt
+  spatch -sp\_file foo.cocci -dir /var/linuxes/linux-next/drivers -patch
+  /var/linuxes/linux-next}.  A trailing {\tt /} is permitted on the
+  directory name and has no impact on the result.}
+
 \rare{-save\_tmp\_files}{Coccinelle creates some temporary
   files in {\tt /tmp} that it deletes after use.  This option causes these
   files to be saved.}
@@ -443,8 +504,6 @@ done.}
   generation of the transformed code.  This has the side-effect of
   deleting the transformed code.}
 
-\developer{-patch}{ Deprecated option.}
-
 
 \section{Other options}
 
@@ -496,3 +555,11 @@ condition occurs, rather than only once.}
 
 \developer{-pad, -hrule $\langle$dir$\rangle$, -xxx, -l1}{}
 
+
+%%% Local Variables:
+%%% mode: LaTeX
+%%% TeX-master: "main_options"
+%%% coding: utf-8
+%%% TeX-PDF-mode: t
+%%% ispell-local-dictionary: "american"
+%%% End: