wave_driver.html 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <html>
  3. <head>
  4. <title>The Wave Driver</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  6. <link href="theme/style.css" rel="stylesheet" type="text/css">
  7. </head>
  8. <body>
  9. <table width="100%" border="0" cellspacing="2" background="theme/bkd2.gif">
  10. <tr>
  11. <td width="21"> <h1></h1></td>
  12. <td width="885"> <font face="Verdana, Arial, Helvetica, sans-serif"><b><font size="6">The
  13. Wave Driver</font></b></font></td>
  14. <td width="96"><a href="http://www.boost.org"><img src="theme/wave.gif" width="93" height="68" align="right" border="0"></a></td>
  15. </tr>
  16. </table>
  17. <br>
  18. <table border="0">
  19. <tr>
  20. <td width="10"></td>
  21. <td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td>
  22. <td width="30"><a href="samples.html"><img src="theme/l_arr.gif" border="0"></a></td>
  23. <td width="30"><a href="tracing_facility.html"><img src="theme/r_arr.gif" border="0"></a></td>
  24. </tr>
  25. </table>
  26. <p>There is implemented a driver program for the <tt>Wave</tt> library, which
  27. utilizes nearly all capabilities of the library. It is usable as a preprocessor executable
  28. on top of any other C++ compiler. It outputs the textual representation of the
  29. preprocessed tokens generated from a given input file. This driver program has
  30. the following command line syntax:</p>
  31. <pre>Usage: wave [options] [@config-file(s)] file:
  32. Options allowed on the command line only:
  33. -h [--help]: print out program usage (this message)
  34. -v [--version]: print the version number
  35. -c [--copyright]: print out the copyright statement
  36. --config-file filepath: specify a config file (alternatively: @filepath)
  37. Options allowed additionally in a config file:
  38. -o [--output] path: specify a file [path] to use for output instead of
  39. stdout or disable output [-]
  40. -E [ --autooutput ]: output goes into a file named &lt;input_basename&gt;.i
  41. -I [--include] path: specify an additional include directory
  42. -S [--sysinclude] syspath: specify an additional system include directory
  43. -F [--forceinclude] file: force inclusion of the given file
  44. -D [--define] macro[=[value]]: specify a macro to define
  45. -P [--predefine] macro[=[value]]: specify a macro to predefine
  46. -U [--undefine] macro: specify a macro to undefine
  47. -u [--undefineall]: undefine all macrodefinitions
  48. -n [--nesting] depth: specify a new maximal include nesting depth
  49. Extended options (allowed everywhere)
  50. -t [--traceto] arg: output trace info to a file [arg] or to stderr [-]
  51. --timer: output overall elapsed computing time
  52. --long_long: enable long long support if C++ mode
  53. --variadics: enable variadics and placemarkers in C++ mode
  54. --c99: enable C99 mode (implies variadics and placemarkers)
  55. --c++11 enable C++11 mode (implies --variadics and --long_long)
  56. -l [ --listincludes ] arg: list included file to a file [arg] or to stdout [-]
  57. -m [ --macronames ] arg: list names of all defined macros to a file [arg] or
  58. to stdout [-]
  59. -c [ --macrocounts ] arg list macro invocation counts to a file [arg] or to
  60. stdout [-]
  61. -p [ --preserve ] arg (=0): preserve whitespace
  62. 0: no whitespace is preserved (default),
  63. 1: begin of line whitespace is preserved,
  64. 2: comments and begin of line whitespace is preserved,
  65. 3: all whitespace is preserved
  66. -L [ --line ] arg (=1): control the generation of #line directives
  67. 0: no #line directives are generated
  68. 1: #line directives will be emitted (default)
  69. -x [ --extended ]: enable the #pragma wave system() directive
  70. -G [ --noguard ]: disable include guard detection
  71. -g [ --listguards ]: list names of files flagged as 'include once' to a
  72. file [arg] or to stdout [-]
  73. -s [ --state ] arg: load and save state information from/to the given
  74. file [arg] or 'wave.state' [-] (interactive mode
  75. only)
  76. </pre>
  77. <P dir="ltr">The possible options are straightforward and self explanatory. The
  78. following describes some of these options in more detail. Please note, that
  79. the extended options (--c99 and --variadics) are available only, if the driver
  80. was compiled with the constant <tt>WAVE_SUPPORT_VARIADICS_PLACEMARKERS</tt>
  81. defined. </P>
  82. <P dir="ltr">-o [--output] path</P>
  83. <blockquote>
  84. <p dir="ltr">Specify a filename to be used for the generated preprocessed output
  85. stream. If this option is not given, then the standard output is used (stdout). If the filename given equals to <tt>'-'</tt> (without the quotes), no output is generated initially. This is especially useful for syntax checks only or in conjunction with the <span class="preprocessor">#pragma&nbsp;wave&nbsp;option(output:&nbsp;...) </span>directive restricting the generated out to specific parts only (for a description see the section <a href="supported_pragmas.html">Supported Pragma Directives</a>). </p>
  86. </blockquote>
  87. <P dir="ltr">-E [--autooutput]</P>
  88. <blockquote>
  89. <p dir="ltr">The generated output will end up in a file named after the input file basename with the file extension <span class="literal">'.i'</span>, i.e. for an input file <span class="literal">'inputfile.cpp'</span> the output will be written to <span class="literal">'inputfile.i'</span>. This option will not have any effect if there is specified an output file name with a --output option.</p>
  90. </blockquote>
  91. <P dir="ltr">-I [--include] option</P>
  92. <blockquote>
  93. <p dir="ltr">Add the directory dir to the head of the list of directories to be searched for header files. This can be used to override a system
  94. header file, substituting your own version, since these directories are
  95. searched before the system header file directories. However, you should
  96. not use this option to add directories that contain vendor-supplied
  97. system header files (use '-S' for that). If you use more than
  98. one '-I' option, the directories are scanned in left-to-right order,
  99. the standard system directories come after. </p>
  100. <p>If a standard system include directory, or a directory specified with
  101. '-S', is also specified with '-I', the '-I' option will be
  102. ignored. The directory will still be searched but as a system
  103. directory at its normal position in the system include chain. </p>
  104. </blockquote>
  105. <p dir="ltr">-I- [--include-] option</p>
  106. <blockquote>
  107. <p dir="ltr">The <tt>Wave</tt> library maintains two separate search paths
  108. for include files. A search path for user include files and a search path
  109. for system include files, where the user include paths are searched before the system include paths. </p>
  110. <p dir="ltr">Any directories specified with '-I' options before
  111. an eventually given '-I-' option are searched only for the case of '#include&nbsp;&quot;file&quot;'
  112. (user include files), they are not searched for '#include&nbsp;&lt;file&gt;'
  113. directives (system include files). If additional directories are specified
  114. with '-I' options after a '-I-' option was given, these directories are searched
  115. for all '#include' directives (ordinarily all '-I' directories are used this way.). </p>
  116. <p dir="ltr">In addition, the '-I-' option inhibits the
  117. use of the current directory (where the current input file came from) as the first search directory for '#include &quot;file&quot;'
  118. directives . With '-I.' you can specify searching the directory which was current when the compiler was invoked. That is not exactly the same as what the
  119. preprocessor does by default, but it is often satisfactory. </p>
  120. </blockquote>
  121. <p dir="ltr">-S [--sysinclude] option</p>
  122. <blockquote>
  123. <p dir="ltr">Add the given directory to the head of the list of directories
  124. to be searched for system header files. If you use more than one '-S' option,
  125. the directories are scanned in left-to-right order. This option is most useful
  126. in the wave.cfg configuration file to specify, where the system include files
  127. are to be searched.</p>
  128. </blockquote>
  129. <p dir="ltr">-F [--forceinclude] option</p>
  130. <blockquote>
  131. <p dir="ltr">Process the given file as normal input and include all the resulting
  132. output before the processing the regular input file starts. If more than one
  133. such option is given, the files are pre-included in the sequence of its occurance
  134. on the command line.</p>
  135. </blockquote>
  136. <p dir="ltr">-D [--define] macro[=definition]<br>-P [--predefine] macro[=definition]</p>
  137. <blockquote>
  138. <p dir="ltr">This option allows to define ('-D') or predefine ('-P') a macro
  139. from the command line. The string given in conjunction with the '-D' or '-P'
  140. option should conform to the usual syntax MACRO(x)=definition as is described
  141. in more detail <a href="class_reference_context.html#add_macro_definition">here</a>.</p>
  142. <p dir="ltr"> The only difference between the '-D' and the '-P' options is,
  143. that the latter predefines a macro such, that it is <b>not</b> undefinable
  144. through an <tt>#undef</tt> directive from inside the preprocessed program.</p>
  145. </blockquote>
  146. <p dir="ltr">-U [--undefine] macro </p>
  147. <blockquote>
  148. <p dir="ltr">This allows to undefine some of the automatically predefined macros
  149. of the <tt>Wave</tt> library (see <a href="predefined_macros.html">Predefined macros</a>). The only exception are
  150. the <code class="keyword">__LINE__</code>, <code class="keyword">__FILE__</code>,
  151. <code class="keyword">__DATE__</code>, <code class="keyword">__TIME__</code>,
  152. <code class="keyword">__STDC__</code> and <code class="keyword">__cplusplus</code>
  153. predefined macros, which are not undefinable. If -U and -D are both specified
  154. for one name, the name is not predefined.</p>
  155. </blockquote>
  156. <p dir="ltr">-n [--nesting] depth</p>
  157. <blockquote>
  158. <p dir="ltr">Specify a new maximal include nesting depth. If the preprocessing
  159. reaches this include file nesting depth, it aborts the preprocessing after
  160. emitting an error message. The default include file nesting depth is 1024.</p>
  161. </blockquote>
  162. <p dir="ltr">-t [--traceto] path</p>
  163. <blockquote>
  164. <p dir="ltr">Enable the tracing facility build into the <tt>Wave</tt> library.
  165. The path specifies the filename to use for the output of the generated trace
  166. log. If the filename given equals to <tt>'-'</tt> (without the quotes), the
  167. trace log is put into the standard error stream (stderr).</p>
  168. </blockquote>
  169. <p dir="ltr">--timer</p>
  170. <blockquote>
  171. <p dir="ltr">Enable to track the overall elapsed computing time required for
  172. the given input file. The elapsed time is printed to stdout after the compilation
  173. is completed.</p>
  174. </blockquote>
  175. <p dir="ltr">--variadics</p>
  176. <blockquote>
  177. <p dir="ltr">Enables support for variadics (macros with variable parameter lists),
  178. placemarkers (empty macro arguments) and <tt>operator&nbsp;_Pragma</tt> in
  179. normal C++ mode. This option predefines a special predefined macro <tt>__WAVE_HAS_VARIADICS__</tt>.</p>
  180. </blockquote>
  181. <p dir="ltr">--c99</p>
  182. <blockquote>
  183. <p dir="ltr">Enable the C99 mode. This mode enables certain C99 specific features, such
  184. as variadics (macros with variable parameter lists), placemarkers (empty macro
  185. arguments) and <tt>operator&nbsp;_Pragma</tt> support and disables some C++
  186. specific token types as for instance <tt>'::'</tt>, <tt>'-&gt;*'</tt> and <tt>'-&gt;.'</tt>.
  187. Several predefined macros are different for this mode, for more information
  188. about predefined macros you may look <a href="predefined_macros.html">here</a>.
  189. </p>
  190. </blockquote>
  191. <p dir="ltr">--c++11</p>
  192. <blockquote>
  193. <p dir="ltr">Enable the C++11 mode. This mode enables C++11 specific keywords and features, such
  194. as variadics (macros with variable parameter lists), placemarkers (empty macro
  195. arguments) and <tt>operator&nbsp;_Pragma</tt> support.
  196. Several predefined macros are different for this mode, for more information
  197. about predefined macros you may look <a href="predefined_macros.html">here</a>. </p>
  198. </blockquote>
  199. <p dir="ltr">-l [--listincludes] path</p>
  200. <blockquote>
  201. <p dir="ltr">Enable the output of the names of all opened include files. The path specifies the filename to use for the output of the generated include log. If the filename given equals to <tt>'-'</tt> (without the quotes), the include log is put into the standard output stream (stdout).</p>
  202. </blockquote>
  203. <p dir="ltr">-m [--macronames] path</p>
  204. <blockquote>
  205. <p dir="ltr">Enable the output of all defined macros. This includes the macro names, its parameter names (if the macro is a function like macro) and its definition. The path specifies the filename to use for the output of the generated macro list. If the filename given equals to <tt>'-'</tt> (without the quotes), the macro list is put into the standard output stream (stdout).</p>
  206. </blockquote>
  207. <p dir="ltr">-c [--macrocounts] path</p>
  208. <blockquote>
  209. <p dir="ltr">Enable the output of all macro invocation counts. The path specifies the filename to use for the output of the generated list. If the filename given equals to <tt>'-'</tt> (without the quotes), the macro list is put into the standard output stream (stdout).</p>
  210. </blockquote>
  211. <p dir="ltr">-p [--preserve] arg </p>
  212. <blockquote>
  213. <p dir="ltr">Preserve the whitespace from the input stream not located inside of macro definitions. The argument defines the amount of whitespace to be preserved. A value of '0' (zero) skips all whitespace, a value of '1' preserves begin of line whitespace only, a value of '2' preserves all the comments andd all begin of line whitespace, and a value of '3' will preserve all whitespace in the output.</p>
  214. <p dir="ltr">The comments located inside macro definitions are skipped even if this option is specified with an argument not '0' (zero) . If this option is not specified on the command line only essential whitespace is preserved (equivalent to '0' as the argument value). </p>
  215. </blockquote>
  216. <p dir="ltr">-L [--line]</p>
  217. <blockquote>
  218. <p dir="ltr">Controls whether the <tt>Wave</tt> tool generates <span class="preprocessor">#line</span> directives or not. If the argument is '1' these will be emitted, if the argument value is '0' no <span class="preprocessor">#line</span> directives will be generated. If this option is not specified, <tt>Wave</tt> always will generate <span class="preprocessor">#line</span> directives. </p>
  219. </blockquote>
  220. <p dir="ltr">-x [--extended]</p>
  221. <blockquote>
  222. <p dir="ltr">Enable the <span class="preprocessor">#pragma&nbsp;wave&nbsp;system()</span> directive. This directive
  223. is now disabled by default because it may cause a potential security threat. The <tt>Wave</tt> driver will issue a remark if this command line argument is not specified and a <span class="preprocessor">#pragma&nbsp;wave&nbsp;system()</span> directive is encountered.</p>
  224. </blockquote>
  225. <p dir="ltr">-G [--noguard] </p>
  226. <blockquote>
  227. <p dir="ltr">This option disables the automatic include guard detection normally performed by the Wave library during the processing of included files. For more information about automatic include guard detection please refer to <a href="class_reference_context.html">The Context Object</a> class reference. </p>
  228. </blockquote>
  229. <p dir="ltr">-g [--listguards] arg </p>
  230. <blockquote>
  231. <p dir="ltr">This option lists all found include files which either contain a
  232. <span class="preprocessor">#pragma once</span> or contain an include guard
  233. into the given file. If the filename given equals to <tt>'-'</tt> (without the quotes), the
  234. guards log is put into the standard output stream (stdout). For more information about automatic include guard detection please refer to <a href="class_reference_context.html">The Context Object</a> class reference. </p>
  235. </blockquote>
  236. <p dir="ltr">-s [--state]</p>
  237. <blockquote>
  238. <p dir="ltr">This option tries instructs the <tt>Wave</tt> tool to load the serialized information from the file given as the argument and to save back the internal state information at the end of the session to the same file. When using this option <tt>Wave</tt> loads and saves all defined macros (even the predefined ones) and the information about processed header files tagged with <span class="preprocessor">#pragma once</span> and/or identified to have include guards. </p>
  239. <p dir="ltr">Note: This option has effect in interactive mode only. </p>
  240. </blockquote>
  241. <p dir="ltr">@ [--config-file] option</p>
  242. <blockquote>
  243. <p dir="ltr">Some of the possible command line options may be specified inside
  244. of special configuration files. This is very useful, as a shorthand for different
  245. global configurations. A config file may contain additional options (i.e. -I, -S,
  246. -F, -U, -D and -P options), one option per line. Empty lines and lines beginning
  247. with a '#' character are ignored (are treated as a comment lines). Note that
  248. the '#' character is treated as the beginning of a comment only, if it is
  249. the first non-whitespace character on a line. Here is a small sample illustrating the supported configuration file syntax:</p>
  250. <pre><span class="comment"> #
  251. # enable variadics et.al. in C++ mode
  252. #</span>
  253. --variadics
  254. <span class="comment"> #
  255. # enable timer support
  256. #
  257. </span> --timer
  258. <span class="comment"> #
  259. # emulate gcc V3.3.2
  260. #
  261. </span> -D__GNUC__=3
  262. -D__GNUC_MINOR__=3
  263. -D__GNUC_PATCHLEVEL__=2
  264. -D__GNUG__
  265. <span class="comment"> #
  266. # add Boost to the system include search paths
  267. #</span>
  268. -S/usr/local/boost</pre>
  269. <p dir="ltr"> There is a shorthand for specifying a configuration file on the
  270. command line: simply use the '@' character immediatly before the corresponding
  271. file name.</p>
  272. <p dir="ltr"> The options found in a configuration file are interpreted as
  273. if they were place instead of the configuration file option on the command
  274. line.</p>
  275. </blockquote>
  276. <p dir="ltr">The <tt>Wave</tt> driver program at startup looks for a configuration
  277. file named 'wave.cfg' in every directory up the file system hierarchy starting
  278. from the directory where the input file is located. The first file found stops
  279. the search. If a file exists it is treated as a normal
  280. configuration file and the specified herein options are interpreted as if they
  281. were given as the first options on the command line. This feature is very useful
  282. for defining a global environment for the <tt>Wave</tt> preprocessor driver.</p>
  283. <table border="0">
  284. <tr>
  285. <td width="10"></td>
  286. <td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td>
  287. <td width="30"><a href="samples.html"><img src="theme/l_arr.gif" border="0"></a></td>
  288. <td width="30"><a href="tracing_facility.html"><img src="theme/r_arr.gif" border="0"></a></td>
  289. </tr>
  290. </table>
  291. <hr size="1">
  292. <p class="copyright">Copyright &copy; 2003-2011 Hartmut Kaiser<br>
  293. <br>
  294. <font size="2">Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) </font> </p>
  295. <span class="updated"></span>
  296. <p class="copyright"><span class="updated">Last updated:
  297. <!-- #BeginDate format:fcAm1m -->Sunday, January 9, 2011 16:12<!-- #EndDate -->
  298. </span></p>
  299. </body>
  300. </html>