diff options
author | Olly Betts <olly@survex.com> | 2022-10-05 13:23:49 +1300 |
---|---|---|
committer | Olly Betts <olly@survex.com> | 2022-10-05 17:07:06 +1300 |
commit | 06296a71281f049cfc438b4a7fb05127a0474144 (patch) | |
tree | f2785bb2d23b79e4ae652a25a472e80a3060c68f /Doc | |
parent | befcd1bf586dfd2bb2d54ddb177f1e30a78e4e11 (diff) | |
download | swig-06296a71281f049cfc438b4a7fb05127a0474144.tar.gz |
Report errors in preprocessor expressions by default
Until now SWIG quietly ignored such errors unless -Wextra (or -Wall
which implies -Wextra) was passed, but this is unhelpful as it hides
problems. To illustrate this point, enabling this warning by
default revealled a typo in the preproc_defined.i testcase in
SWIG's own testsuite.
If you really don't want to see this warning, you can suppress it
with command line option -w202 or by using this in your interface
file:
%warnfilter(SWIGWARN_PP_EVALUATION);
Both will work with older versions of SWIG too.
Fixes #1465
Fixes #2389
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/Manual/SWIG.html | 2 | ||||
-rw-r--r-- | Doc/Manual/Warnings.html | 9 |
2 files changed, 10 insertions, 1 deletions
diff --git a/Doc/Manual/SWIG.html b/Doc/Manual/SWIG.html index b7021c468..e3e11841d 100644 --- a/Doc/Manual/SWIG.html +++ b/Doc/Manual/SWIG.html @@ -219,7 +219,7 @@ General Options -Wall - Remove all warning suppression, also implies -Wextra -Wallkw - Enable keyword warnings for all the supported languages -Werror - Treat warnings as errors - -Wextra - Adds the following additional warnings: 202,309,403,405,512,321,322 + -Wextra - Adds the following additional warnings: 309,403,405,512,321,322 -w<list> - Suppress/add warning messages, eg -w401,+321 - see Warnings.html -xmlout <file> - Write XML version of the parse tree to <file> after normal processing </pre></div> diff --git a/Doc/Manual/Warnings.html b/Doc/Manual/Warnings.html index 6140dd21a..b20b69cef 100644 --- a/Doc/Manual/Warnings.html +++ b/Doc/Manual/Warnings.html @@ -165,6 +165,15 @@ to provide additional diagnostics. These warnings can be turned on using the </div> <p> +Preprocessor warning 202 ("Could not evaluate expression <em>expr</em>.") was +formally off by default and enabled by <tt>-Wextra</tt>, but since SWIG 4.1.0 +this warning is on by default because suppressing it tends to hide genuine +problems. If you really don't want to see it, you can suppress it with +<tt>-w202</tt> or using <tt>%warnfilter</tt> as described below. Both will work +with older versions of SWIG too. +</p> + +<p> To selectively turn on extra warning messages, you can use the directives and options in the previous section--simply add a "+" to all warning numbers. For example: </p> |