document #error and #warning including cpperraswarn/nocpperraswarn
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8297 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
916a23d3c4
commit
a3d21b7b8e
1 changed files with 30 additions and 0 deletions
|
|
@ -19,6 +19,7 @@
|
|||
<li><a href="#Preprocessor_nn8">Preprocessing and %{ ... %} blocks</a>
|
||||
<li><a href="#Preprocessor_nn9">Preprocessing and { ... }</a>
|
||||
<li><a href="#Preprocessor_nn10">Viewing preprocessor output</a>
|
||||
<li><a href="#Preprocessor_warning_error">The #error and #warning directives</a>
|
||||
</ul>
|
||||
</div>
|
||||
<!-- INDEX -->
|
||||
|
|
@ -381,5 +382,34 @@ Instead the results after the preprocessor has run are displayed.
|
|||
This might be useful as an aid to debugging and viewing the results of macro expansions.
|
||||
</p>
|
||||
|
||||
<H2><a name="Preprocessor_warning_error"></a>7.10 The #error and #warning directives</H2>
|
||||
<p>
|
||||
SWIG supports the commonly used <tt>#warning</tt> and <tt>#error</tt> preprocessor directives.
|
||||
The <tt>#warning</tt> directive will cause SWIG to issue a warning then continue processing.
|
||||
The <tt>#error</tt> directive will cause SWIG to exit with a fatal error.
|
||||
Example usage:
|
||||
</p>
|
||||
|
||||
<div class="code">
|
||||
<pre>
|
||||
#error "This is a fatal error message"
|
||||
#warning "This is a warning message"
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
The <tt>#error</tt> behaviour can be made to work like <tt>#warning</tt> if the <tt>-cpperraswarn</tt>
|
||||
commandline option is used. Alternatively, the <tt>#pragma</tt> directive can be used to the same effect, for example:
|
||||
</p>
|
||||
|
||||
<div class="code">
|
||||
<pre>
|
||||
/* Modified behaviour: #error does not cause SWIG to exit with error */
|
||||
#pragma SWIG cpperraswarn=1
|
||||
/* Normal behaviour: #error does cause SWIG to exit with error */
|
||||
#pragma SWIG cpperraswarn=0
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue