diff options
author | William S Fulton <wsf@fultondesigns.co.uk> | 2006-01-08 10:12:35 +0000 |
---|---|---|
committer | William S Fulton <wsf@fultondesigns.co.uk> | 2006-01-08 10:12:35 +0000 |
commit | a3d21b7b8e0784860df8d7ea7dc65664fb6dc9c7 (patch) | |
tree | d1264b03b5928b8d3e6e7224a12630355403d22c /Doc/Manual/Preprocessor.html | |
parent | 916a23d3c49740bad814b4a35f0bf9ab4ff61262 (diff) | |
download | swig-a3d21b7b8e0784860df8d7ea7dc65664fb6dc9c7.tar.gz |
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
Diffstat (limited to 'Doc/Manual/Preprocessor.html')
-rw-r--r-- | Doc/Manual/Preprocessor.html | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/Doc/Manual/Preprocessor.html b/Doc/Manual/Preprocessor.html index d7ae07e96..db1ea6f37 100644 --- a/Doc/Manual/Preprocessor.html +++ b/Doc/Manual/Preprocessor.html @@ -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> |