permit multiline comments and strings in macros
[bpt/coccinelle.git] / docs / manual / spatch_options.tex
1 \section{Introduction}
2
3 This document describes the options provided by Coccinelle. The options
4 have an impact on various phases of the semantic patch application
5 process. These are:
6
7 \begin{enumerate}
8 \item Selecting and parsing the semantic patch.
9 \item Selecting and parsing the C code.
10 \item Application of the semantic patch to the C code.
11 \item Transformation.
12 \item Generation of the result.
13 \end{enumerate}
14
15 \noindent
16 One can either initiate the complete process from step 1, or
17 to perform step 1 or step 2 individually.
18
19 Coccinelle has quite a lot of options. The most common usages are as
20 follows, for a semantic match {\tt foo.cocci}, a C file {\tt foo.c}, and a
21 directory {\tt foodir}:
22
23 \begin{itemize}
24 \item {\tt spatch --parse-cocci foo.cocci}: Check that the semantic patch
25 is syntactically correct.
26 \item {\tt spatch --parse-c foo.c}: Check that the C file
27 is syntactically correct. The Coccinelle C parser tries to recover
28 during the parsing process, so if one function does not parse, it will
29 start up again with the next one. Thus, a parse error is often not a
30 cause for concern, unless it occurs in a function that is relevant to the
31 semantic patch.
32 \item {\tt spatch --sp-file foo.cocci foo.c}: Apply the semantic patch {\tt
33 foo.cocci} to the file {\tt foo.c} and print out any transformations as
34 the changes between the original and transformed code, using the program
35 {\tt diff}. {\tt --sp-file} is optional in this and the following cases.
36 \item {\tt spatch --sp-file foo.cocci foo.c --debug}: The same as the
37 previous case, but print out some information about the matching process.
38 \item {\tt spatch --sp-file foo.cocci --dir foodir}: Apply the semantic
39 patch {\tt foo.cocci} to all of the C files in the directory {\tt foodir}.
40 \item {\tt spatch --sp-file foo.cocci --dir foodir --include-headers}: Apply
41 the semantic patch {\tt foo.cocci} to all of the C files and header files
42 in the directory {\tt foodir}.
43 \end{itemize}
44
45 In the rest of this document, the options are annotated as follows:
46 \begin{itemize}
47 \item \FilledBigDiamondshape: a basic option, that is most likely of
48 interest to all users.
49 \item \BigLowerDiamond: an option that is frequently used, often for better
50 understanding the effect of a semantic patch.
51 \item \BigDiamondshape: an option that is likely to be rarely used, but
52 whose effect is still comprehensible to a user.
53 \item An option with no annotation is likely of interest only to
54 developers.
55 \end{itemize}
56
57 \section{Selecting and parsing the semantic patch}
58
59 \subsection{Standalone options}
60
61 \normal{--parse-cocci $\langle$file$\rangle$}{ Parse a semantic
62 patch file and print out some information about it.}
63
64 \subsection{The semantic patch}
65
66 \minimum{--sp-file $\langle$file$\rangle$, -c $\langle$file$\rangle$,
67 -cocci-file $\langle$file$\rangle$}{ Specify the name of the file
68 containing the semantic patch. The file name should end in {\tt .cocci}.
69 All three options do the same thing. These options are optional. If they
70 are not used, the single file whose name ends in \texttt{.cocci} is
71 assoumed to be the name of the file containing the semantic patch.}
72
73 \rare{--sp ``semantic patch string''}{Specify a semantic match as a
74 command-line argument. See the section ``Command-line semantic match''
75 in the manual.}
76
77 \subsection{Isomorphisms}
78
79 \rare{--iso, --iso-file}{ Specify a file containing isomorphisms to be used in
80 place of the standard one. Normally one should use the {\tt using}
81 construct within a semantic patch to specify isomorphisms to be used {\em
82 in addition to} the standard ones.}
83
84 \rare{--iso-limit $\langle$int$\rangle$} Limit the depth of application of
85 isomorphisms to the specified integer.
86
87 \rare{--no-iso-limit} Put no limit on the number of times that
88 isomorphisms can be applied. This is the default.
89
90 \rare{--disable-iso}{Disable a specific isomorphism from the command line.
91 This option can be specified multiple times.}
92
93 \developer{--track-iso}{ Gather information about isomorphism usage.}
94
95 \developer{--profile-iso}{ Gather information about the time required for
96 isomorphism expansion.}
97
98 \subsection{Display options}
99
100 \rare{--show-cocci}{Show the semantic patch that is being processed before
101 expanding isomorphisms.}
102
103 \rare{--show-SP}{Show the semantic patch that is being processed after
104 expanding isomorphisms.}
105
106 \rare{--show-ctl-text}{ Show the representation
107 of the semantic patch in CTL.}
108
109 \rare{--ctl-inline-let}{ Sometimes {\tt let} is used to name
110 intermediate terms CTL representation. This option causes the let-bound
111 terms to be inlined at the point of their reference.
112 This option implicitly sets {\bf --show-ctl-text}.}
113
114 \rare{--ctl-show-mcodekind}{ Show
115 transformation information within the CTL representation
116 of the semantic patch. This option implicitly sets {\bf --show-ctl-text}.}
117
118 \rare{--show-ctl-tex}{ Create a LaTeX files showing the representation
119 of the semantic patch in CTL.}
120
121 \section{Selecting and parsing the C files}
122
123 \subsection{Standalone options}
124
125 \normal{--parse-c $\langle$file/dir$\rangle$}{ Parse a {\tt .c} file or all
126 of the {\tt .c} files in a directory. This generates information about
127 any parse errors encountered.}
128
129 \normal{--parse-h $\langle$file/dir$\rangle$}{ Parse a {\tt .h} file or all
130 of the {\tt .h} files in a directory. This generates information about
131 any parse errors encountered.}
132
133 \normal{--parse-ch $\langle$file/dir$\rangle$}{ Parse a {\tt .c} or {\tt
134 .h} file or all of the {\tt .c} or {\tt .h} files in a directory. This
135 generates information about any parse errors encountered.}
136
137 \normal{--control-flow $\langle$file$\rangle$, --control-flow
138 $\langle$file$\rangle$:$\langle$function$\rangle$}{ Print a control-flow
139 graph for all of the functions in a file or for a specific function in a
140 file. This requires {\tt dot} (http://www.graphviz.org/) and {\tt gv}.}
141
142 \rare{--control-flow-to-file $\langle$file$\rangle$,
143 --control-flow-to-file
144 $\langle$file$\rangle$:$\langle$function$\rangle$}{ Like --control-flow
145 but just puts the dot output in a file in the {\em current} directory.
146 For PATH/file.c, this produces file:xxx.dot for each (selected) function
147 xxx in PATH/file.c.}
148
149 \rare{--type-c $\langle$file$\rangle$}{ Parse a C file and pretty-print a
150 version including type information.}
151
152 \developer{--tokens-c $\langle$file$\rangle$}{Prints the tokens in a C
153 file.}
154
155 \developer{--parse-unparse $\langle$file$\rangle$}{Parse and then reconstruct
156 a C file.}
157
158 \developer{--compare-c $\langle$file$\rangle$ $\langle$file$\rangle$,
159 --compare-c-hardcoded}{Compares one C file to another, or compare the
160 file tests/compare1.c to the file tests/compare2.c.}
161
162 \developer{--test-cfg-ifdef $\langle$file$\rangle$}{Do some special
163 processing of \#ifdef and display the resulting control-flow graph. This
164 requires {\tt dot} and {\tt gv}.}
165
166 \developer{--test-attributes $\langle$file$\rangle$,
167 --test-cpp $\langle$file$\rangle$}{
168 Test the parsing of cpp code and attributes, respectively.}
169
170 \subsection{Selecting C files}
171
172 An argument that ends in {\tt .c} is assumed to be a C file to process.
173 Normally, only one C file or one directory is specified. If multiple C
174 files are specified, they are treated in parallel, {\em i.e.}, the first
175 semantic patch rule is applied to all functions in all files, then the
176 second semantic patch rule is applied to all functions in all files, etc.
177 If a directory is specified then no files may be specified and only the
178 rightmost directory specified is used.
179
180 \normal{--include-headers}{ This option causes header files to be processed
181 independently. This option only makes sense if a directory is specified
182 using {\bf --dir}.}
183
184 \normal{--use-glimpse}{ Use a glimpse index to select the files to which
185 a semantic patch may be relevant. This option requires that a directory is
186 specified. The index may be created using the script {\tt
187 coccinelle/scripts/ glimpseindex-cocci.sh}. Glimpse is available at
188 http://webglimpse.net/. In conjunction with the option {\bf --patch-cocci}
189 this option prints the regular expression that will be passed to glimpse.}
190
191 \normal{--use-idutils}{ Use an id-utils index created using lid to select
192 the files to which a semantic patch may be relevant. This option
193 requires that a directory is specified. The index may be created using
194 the script {\tt coccinelle/scripts/ idindex-cocci.sh}. In conjunction
195 with the option {\bf --patch-cocci} this option prints the regular
196 expression that will be passed to glimpse.}
197
198 \rare{--dir}{ Specify a directory containing C files to process. A trailing
199 {\tt /} is permitted on the directory name and has no impact on the
200 result. By default, the include path will be set to the ``include''
201 subdirectory of this directory. A different include path can be
202 specified using the option {\bf -I}. {\bf --dir} only considers the
203 rightmost directory in the argument list. This behavior is convenient
204 for creating a script that always works on a single directory, but allows
205 the user of the script to override the provided directory with another
206 one. Spatch collects the files in the directory using {\tt find} and
207 does not follow symbolic links.}
208
209 \developer{--kbuild-info $\langle$file$\rangle$}{ The specified file
210 contains information about which sets of files should be considered in
211 parallel.}
212
213 \developer{--disable-worth-trying-opt}{Normally, a C file is only
214 processed if it contains some keywords that have been determined to be
215 essential for the semantic patch to match somewhere in the file. This
216 option disables this optimization and tries the semantic patch on all files.}
217
218 \developer{--test $\langle$file$\rangle$}{ A shortcut for running Coccinelle
219 on the semantic patch ``file{\tt{.cocci}}'' and the C file
220 ``file{\tt{.c}}''. The result is put in the file {\tt
221 /tmp/file{\tt{.res}}}. If writing a file in /tmp with a non-fresh name
222 is a concern, then do not use this option.
223 }
224
225 \developer{--testall}{A shortcut for running Coccinelle on all files in a
226 subdirectory {\tt tests} such that there are all of a {\tt .cocci} file, a {\tt
227 .c} file, and a {\tt .res} file, where the {\tt .res} contains the
228 expected result.}
229
230 \developer{--test-okfailed, --test-regression-okfailed} Other options for
231 keeping track of tests that have succeeded and failed.
232
233 \developer{--compare-with-expected}{Compare the result of applying
234 Coccinelle to file{\tt{.c}} to the file file{\tt{.res}} representing the
235 expected result.}
236
237 \developer{--expected-score-file $\langle$file$\rangle$}{
238 which score file to compare with in the testall run}
239
240 \subsection{Parsing C files}
241
242 \rare{--show-c}{Show the C code that is being processed.}
243
244 \rare{--parse-error-msg}{Show parsing errors in the C file.}
245
246 \rare{--verbose-parsing}{Show parsing errors in the C file, as well as
247 information about attempts to accomodate such errors. This implicitly
248 sets --parse-error-msg.}
249
250 \rare{--type-error-msg}{Show information about where the C type checker
251 was not able to determine the type of an expression.}
252
253 \rare{--int-bits $\langle$n$\rangle$, --long-bits
254 $\langle$n$\rangle$}{Provide integer size information. n is the number of
255 bits in an unsigned integer or unsigned long, respectively. If only the
256 option {\bf --int-bits} is used, unsigned longs will be assumed to have
257 twice as many bits as unsigned integers. If only the option {\bf
258 -long-bits} is used, unsigned ints will be assumed to have half as many
259 bits as unsigned integers. This information is only used in determining
260 the types of integer constants, according to the ANSI C standard (C89). If
261 neither is provided, the type of an integer constant is determined by the
262 sequence of ``u'' and ``l'' annotations following the constant. If there
263 is none, the constant is assumed to be a signed integer. If there is only
264 ``u'', the constant is assumed to be an unsigned integer, etc.}
265
266 \rare{--no-loops}{Drop back edges for loops. This may make a semantic
267 patch/match run faster, at the cost of not finding matches that wrap
268 around loops.}
269
270 \developer{--use-cache}{Use preparsed versions of the C files that are
271 stored in a cache.}
272
273 \developer{--cache-prefix}{Specify the directory in which to store
274 preparsed versions of the C files. This sets {--use-cache}}
275
276 \developer{--cache-limit}{Specify the maximum number of
277 preparsed C files to store. The cache is cleared of all files with names
278 ending in .ast-raw and .depend-raw on reaching this limit. Only
279 effective if --cache-prefix is used as well. This is most useful when
280 iteration is used to process a file multiple times within a single run of
281 Coccinelle.}
282
283 \developer{--debug-cpp, --debug-lexer, --debug-etdt,
284 --debug-typedef}{Various options for debugging the C parser.}
285
286 \developer{--filter-msg, --filter-define-error,
287 --filter-passed-level}{Various options for debugging the C parser.}
288
289 \developer{--only-return-is-error-exit}{In matching ``{\tt{\ldots}}'' in
290 a semantic patch or when forall is specified, a rule must match all
291 control-flow paths starting from a node matching the beginning of the
292 rule. This is relaxed, however, for error handling code. Normally, error
293 handling code is considered to be a conditional with only a then branch
294 that ends in goto, break, continue, or return. If this option is set,
295 then only a then branch ending in a return is considered to be error
296 handling code. Usually a better strategy is to use {\tt when strict} in
297 the semantic patch, and then match explicitly the case where there is a
298 conditional whose then branch ends in a return.}
299
300 \subsubsection*{Macros and other preprocessor code}
301
302 \normal{--macro-file $\langle$file$\rangle$}{
303 Extra macro definitions to be taken into account when parsing the C
304 files. This uses the provided macro definitions in addition to those in
305 the default macro file.}
306
307 \normal{--macro-file-builtins $\langle$file$\rangle$}{
308 Builtin macro definitions to be taken into account when parsing the C
309 files. This causes the macro definitions provided in the default macro
310 file to be ignored and the ones in the specified file to be used instead.}
311
312 \rare{--ifdef-to-if,-no-ifdef-to-if}{
313 The option {\bf --ifdef-to-if}
314 represents an {\tt \#ifdef} in the source code as a conditional in the
315 control-flow graph when doing so represents valid code. {\bf
316 -no-ifdef-to-if} disables this feature. {\bf --ifdef-to-if} is the
317 default.
318 }
319
320 \rare{--noif0-passing}{ Normally code under \#if 0 is ignored. If this
321 option is set then the code is considered, just like the code under any
322 other \#ifdef.}
323
324 \rare{--defined $s$}{The string $s$ is a comma-separated list of constants
325 that should be considered to be defined, with respect to uses of {\tt
326 \#ifdef} and {\tt \#ifndef} in C code. No spaces should appear in $s$.
327 Multiple {\bf --defined} arguments can be provided and the list of
328 strings accumulates. For the provided strings any {\tt \#else}s of {\tt
329 \#ifdef}s are ignored and any {\tt \#ifndef}s are ignored, unless the
330 argument {\bf --noif0-passing} is also given, in which case {\bf
331 --defined} has no effect. Note that occurrences of {\tt \#define} in
332 the C code have no effect on the list of defined constants.}
333
334 \rare{--undefined $s$}{Analogous to {\bf --defined} except that the strings
335 represent constants that should be considered to be undefined.}
336
337 \developer{--noadd-typedef-root}{This seems to reduce the scope of a
338 typedef declaration found in the C code.}
339
340 \subsubsection*{Include files}
341
342 \normal{--recursive-includes, --all-includes, --local-includes,
343 --no-includes}{ These options control which include files mentioned in a
344 C file are taken into account. {\bf --recursive-includes} indicates
345 that all included files mentioned in the .c file(s) or any included files
346 will be processed. {\bf --all-includes} indicates that all included
347 files mentioned in the .c file(s) will be processed. {\bf
348 --local-includes} indicates that only included files in the current
349 directory will be processed. {\bf --no-includes} indicates that no
350 included files will be processed. If the semantic patch contains type
351 specifications on expression metavariables, then the default is {\bf
352 --local-includes}. Otherwise the default is {\bf --no-includes}. At
353 most one of these options can be specified.}
354
355 \normal{-I $\langle$path$\rangle$}{ This option specifies a directory
356 in which to find non-local include files. This option can be used
357 several times to specify multipls include paths.}
358
359 \rare{--include $\langle$file$\rangle$}{ This option give the name of a
360 file to consider as being included in each processed file. The file is
361 added to the end of the file's list of included files. The complete path
362 name should be given; the {\bf -I} options are not taken into account to
363 find the file. This option can be used
364 several times to include multiple files.}
365
366 \rare{--relax-include-path}{This option when combined with --all-includes
367 causes the search for local
368 include files to consider the current directory, even if the include
369 patch specifies a subdirectory. This is really only useful for testing,
370 eg with the option {\bf --testall}}
371
372 \rare{--c++}{Make an extremely minimal effort to parse C++ code. Currently,
373 this is limited to allowing identifiers to contain ``::'', tilde, and
374 template invocations. Consider testing your code first with spatch
375 --type-c to see if there are any type annotations in the code you are
376 interested in processing. If not, then it was probably not parsed.}
377
378 \section{Application of the semantic patch to the C code}
379
380 \subsection{Feedback at the rule level during the application of the
381 semantic patch}
382
383 \normal{--show-bindings}{
384 Show the environments with respect to which each rule is applied and the
385 bindings that result from each such application.}
386
387 \normal{--show-dependencies}{ Show the status (matched or unmatched) of the
388 rules on which a given rule depends. {\bf --show-dependencies} implicitly
389 sets {\bf --show-bindings}, as the values of the dependencies are
390 environment-specific.}
391
392 \normal{--show-trying}{
393 Show the name of each program element to which each rule is applied.}
394
395 \normal{--show-transinfo}{
396 Show information about each transformation that is performed.
397 The node numbers that are referenced are the number of the nodes in the
398 control-flow graph, which can be seen using the option {\bf --control-flow}
399 (the initial control-flow graph only) or the option {\bf --show-flow} (the
400 control-flow graph before and after each rule application).}
401
402 \normal{--show-misc}{Show some miscellaneous information.}
403
404 \rare{--show-flow $\langle$file$\rangle$, --show-flow
405 $\langle$file$\rangle$:$\langle$function$\rangle$} Show the control-flow
406 graph before and after the application of each rule.
407
408 \developer{--show-before-fixed-flow}{This is similar to {\bf
409 --show-flow}, but shows a preliminary version of the control-flow graph.}
410
411 \subsection{Feedback at the CTL level during the application of the
412 semantic patch}
413
414 \normal{--verbose-engine}{Show a trace of the matching of atomic terms to C
415 code.}
416
417 \rare{--verbose-ctl-engine}{Show a trace of the CTL matching process.
418 This is unfortunately rather voluminous and not so helpful for someone
419 who is not familiar with CTL in general and the translation of SmPL into
420 CTL specifically. This option implicitly sets the option {\bf
421 --show-ctl-text}.}
422
423 \rare{--graphical-trace}{Create a pdf file containing the control flow
424 graph annotated with the various nodes matched during the CTL matching
425 process. Unfortunately, except for the most simple examples, the output
426 is voluminous, and so the option is not really practical for most
427 examples. This requires {\tt dot} (http://www.graphviz.org/) and {\tt
428 pdftk}.}
429
430 \rare{--gt-without-label}{The same as {\bf --graphical-trace}, but the PDF
431 file does not contain the CTL code.}
432
433 \rare{--partial-match}{
434 Report partial matches of the semantic patch on the C file. This can
435 be substantially slower than normal matching.}
436
437 \rare{--verbose-match}{
438 Report on when CTL matching is not applied to a function or other program
439 unit because it does not contain some required atomic pattern.
440 This can be viewed as a simpler, more efficient, but less informative
441 version of {\bf --partial-match}.}
442
443 \subsection{Actions during the application of the semantic patch}
444
445 \normal{-D rulename}{Run the patch considering that the virtual rule
446 ``rulename'' is satisfied. Virtual rules should be declared at the
447 beginning of the semantic patch in a comma separated list following the
448 keyword virtual. Other rules can depend on the satisfaction or non
449 satifaction of these rules using the keyword {\tt depends on} in the
450 usual way.}
451
452 \normal{-D variable=value}{Run the patch considering that the virtual
453 identifier metavariable ``variable'' is bound to ``value''. Any
454 identifier metavariable can be designated as being virtual by giving it
455 the rule name {\tt virtual}. An example is in demos/vm.coci}
456
457 \rare{--allow-inconsistent-paths}{Normally, a term that is transformed
458 should only be accessible from other terms that are matched by the
459 semantic patch. This option removes this constraint. Doing so, is
460 unsafe, however, because the properties that hold along the matched path
461 might not hold at all along the unmatched path.}
462
463 \rare{--disallow-nested-exps}{In an expression that contains repeated
464 nested subterms, {\em e.g.} of the form {\tt f(f(x))}, a pattern can
465 match a single expression in multiple ways, some nested inside others.
466 This option causes the matching process to stop immediately at the
467 outermost match. Thus, in the example {\tt f(f(x))}, the possibility
468 that the pattern {\tt f(E)}, with metavariable {\tt E}, matches with {\tt
469 E} as {\tt x} will not be considered.}
470
471 \rare{--no-safe-expressions}{normally, we check that an expression does
472 not match something earlier in the disjunction. But for large
473 disjunctions, this can result in a very big CTL formula. So this
474 option give the user the option to say he doesn't want this feature,
475 if that is the case.}
476
477 \rare{--pyoutput coccilib.output.Gtk, --pyoutput coccilib.output.Console}{
478 This controls whether Python output is sent to Gtk or to the console. {\bf
479 --pyoutput coccilib.output.Console} is the default. The Gtk option is
480 currently not well supported.}
481
482 \developer{--loop}{When there is ``{\tt{\ldots}}'' in the semantic patch,
483 the CTL operator {\sf AU} is used if the current function does not
484 contain a loop, and {\sf AW} may be used if it does. This option causes
485 {\sf AW} always to be used.}
486
487 \rare{--ocaml-regexps}{Use the regular expressions provided by the OCaml
488 \texttt{Str} library. This is the default if the PCRE library is not
489 available. Otherwise PCRE regular expressions are used by default.}
490
491 \developer{--steps $\langle$int$\rangle$}{
492 This limits the number of steps performed by the CTL engine to the
493 specified number. This option is unsafe as it might cause a rule to fail
494 due to running out of steps rather than due to not matching.}
495
496 \developer{--bench $\langle$int$\rangle$}{This collects various information
497 about the operations performed during the CTL matching process.}
498
499 % \developer{--popl, --popl-mark-all, --popl-keep-all-wits}{
500 % These options use a simplified version of the SmPL language. {\bf
501 % --popl-mark-all} and {\bf --popl-keep-all-wits} implicitly set {\bf
502 % --popl}.}
503
504 \rare{--reverse}{Inverts the semantic patch before applying it.
505 A potential use case is backporting changes to previous versions. If a
506 semantic patch represents an API change, then the reverse undoes the
507 API change. Note that inverting a semantic patch is not always possible.
508 In particular, the composition of a
509 semantic patch with its inverse is not guaranteed to be an empty patch.}
510
511 \section{Generation of the result}
512
513 Normally, the only output is the differences between the original code and
514 the transformed code obtained using the program {\tt diff} with the unified
515 format option. If
516 stars are used in column 0 rather than {\tt -} and {\tt +}, then the {\tt
517 -} lines in the output are the lines that matched the stars.
518
519 \normal{--keep-comments}{Don't remove comments adjacent to removed code.}
520
521 \normal{--linux-spacing, --smpl-spacing}{Control the spacing within the code
522 added by the semantic patch. The option {\bf --linux-spacing} causes
523 spatch to follow the conventions of Linux, regardless of the spacing in
524 the semantic patch. This is the default. The option {\bf
525 --smpl-spacing} causes spatch to follow the spacing given in the semantic
526 patch, within individual lines.}
527
528 \rare{-o $\langle$file$\rangle$}{ This causes the transformed code to be
529 placed in the file {\tt file}. The difference between the original code
530 and the transformed code is still printed to the standard output using
531 {\tt diff} with the unified format option. This option only makes sense
532 when {\tt -} and {\tt +} are used.}
533
534 \rare{--in-place}{ Modify the input file to contain the transformed code.
535 The difference between the original code and the transformed code is
536 still printed to the standard output using {\tt diff} with the unified
537 format option. By default, the input file is overwritten when using this
538 option, with no backup. This option only makes sense when {\tt -} and
539 {\tt +} are used.}
540
541 \rare{--backup-suffix $s$}{The suffix $s$ of the file to use in making a
542 backup of the original file(s). This suffix should include the leading
543 ``.'', if one is desired. This option only has an effect when the option
544 {\tt --in-place} is also used.}
545
546 \rare{--out-place}{ Store the result of modifying the code in a .cocci-res
547 file. The difference between the original code
548 and the transformed code is still printed to the standard output using
549 {\tt diff} with the unified format option. This option only
550 makes sense when {\tt -} and {\tt +} are used.}
551
552 \rare{--no-show-diff}{ Normally, the difference between the original and
553 transformed code is printed on the standard output. This option causes
554 this not to be done.}
555
556 \rare{-U}{ Set number of context lines to be provided by {\tt diff}.}
557
558 \rare{--patch $\langle$path$\rangle$}{The prefix of the pathname of the
559 directory or file name that should dropped from the {\tt diff} line in the
560 generated patch. This is useful if you want to apply a patch only to a
561 subdirectory of a source code tree but want to create a patch that can be
562 applied at the root of the source code tree. An example could be {\tt
563 spatch --sp-file foo.cocci --dir /var/linuxes/linux-next/drivers --patch
564 /var/linuxes/linux-next}. A trailing {\tt /} is permitted on the
565 directory name and has no impact on the result.}
566
567 \rare{--save-tmp-files}{Coccinelle creates some temporary
568 files in {\tt /tmp} that it deletes after use. This option causes these
569 files to be saved.}
570
571 \developer{--debug-unparsing}{Show some debugging information about the
572 generation of the transformed code. This has the side-effect of
573 deleting the transformed code.}
574
575
576 \section{Other options}
577
578 \subsection{Version information}
579
580 \normal{--version}{ The version of Coccinelle. No other options are
581 allowed.}
582
583 \normal{--date}{ The date of the current version of Coccinelle. No other
584 options are allowed.}
585
586 \subsection{Help}
587
588 \minimum{--h, --shorthelp}{ The most useful commands.}
589
590 \minimum{--help, --help, --longhelp}{ A complete listing of the available
591 commands.}
592
593 \subsection{Controlling the execution of Coccinelle}
594
595 \normal{--timeout $\langle$int$\rangle$}{ The maximum time in seconds for
596 processing a single file.}
597
598 \rare{--max $\langle$int$\rangle$}{This option informs Coccinelle of the
599 number of instances of Coccinelle that will be run concurrently. This
600 option requires {\bf --index}. It is usually used with {\bf --dir}.}
601
602 \rare{--index $\langle$int$\rangle$}{This option informs Coccinelle of
603 which of the concurrent instances is the current one. This option
604 requires {\bf --max}.}
605
606 \rare{--mod-distrib}{When multiple instances of Coccinelle are run in
607 parallel, normally the first instance processes the first $n$ files, the
608 second instance the second $n$ files, etc. With this option, the files
609 are distributed among the instances in a round-robin fashion.}
610
611 \developer{--debugger}{Option for running Coccinelle from within the OCaml
612 debugger.}
613
614 \developer{--profile}{ Gather timing information about the main Coccinelle
615 functions.}
616
617 \developer{--disable-once}{Print various warning messages every time some
618 condition occurs, rather than only once.}
619
620 \subsection{External analyses}
621
622 \developer{--external-analysis-file}{Loads in the contents of a database
623 produced by some external analysis tool. Each entry contains the analysis
624 result of a particular source location. Currently, such a database is a
625 .csv file providing integer bounds or an integer set for some subset of
626 the source locations that references an integer memory location.
627 This database can be inspected with coccilib functions, e.g. to
628 control the pattern match process.}
629
630 \subsection{Miscellaneous}
631
632 \rare{--quiet}{Suppress most output. This is the default.}
633
634 %\developer{--pad, -hrule $\langle$dir$\rangle$, -xxx, -l1}{}
635 \developer{--pad, --xxx, --l1}{}
636
637
638 %%% Local Variables:
639 %%% mode: LaTeX
640 %%% TeX-master: "main_options"
641 %%% coding: utf-8
642 %%% TeX-PDF-mode: t
643 %%% ispell-local-dictionary: "american"
644 %%% End: