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