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:
William S Fulton 2006-01-08 10:12:35 +00:00
commit a3d21b7b8e

View file

@ -19,6 +19,7 @@
<li><a href="#Preprocessor_nn8">Preprocessing and %{ ... %} blocks</a> <li><a href="#Preprocessor_nn8">Preprocessing and %{ ... %} blocks</a>
<li><a href="#Preprocessor_nn9">Preprocessing and { ... }</a> <li><a href="#Preprocessor_nn9">Preprocessing and { ... }</a>
<li><a href="#Preprocessor_nn10">Viewing preprocessor output</a> <li><a href="#Preprocessor_nn10">Viewing preprocessor output</a>
<li><a href="#Preprocessor_warning_error">The #error and #warning directives</a>
</ul> </ul>
</div> </div>
<!-- INDEX --> <!-- 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. This might be useful as an aid to debugging and viewing the results of macro expansions.
</p> </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> </body>
</html> </html>