Don't report "Warning 202: Error: ..."

An invalid preprocessor expression is reported as a pair of
warnings with the second giving a more detailed message from the
expression evaluator.  Previously SWIG prefixed the second message
with "Error:" - that was confusing as it's actually only a warning
by default so we've now dropped this prefix.

Before:

x.i:1: Warning 202: Could not evaluate expression '1.2'
x.i:1: Warning 202: Error: 'Floating point constant in preprocessor expression'

Now:

x.i:1: Warning 202: Could not evaluate expression '1.2'
x.i:1: Warning 202: Floating point constant in preprocessor expression

See #1465
This commit is contained in:
Olly Betts 2022-02-24 08:40:27 +13:00
commit 74d12d8c4c
5 changed files with 31 additions and 14 deletions

View file

@ -1686,7 +1686,7 @@ String *Preprocessor_parse(String *s) {
Seek(value, 0, SEEK_SET);
Swig_warning(WARN_PP_EVALUATION, Getfile(value), Getline(value), "Could not evaluate expression '%s'\n", value);
if (msg)
Swig_warning(WARN_PP_EVALUATION, Getfile(value), Getline(value), "Error: '%s'\n", msg);
Swig_warning(WARN_PP_EVALUATION, Getfile(value), Getline(value), "%s\n", msg);
allow = 0;
} else {
if (val == 0)
@ -1720,7 +1720,7 @@ String *Preprocessor_parse(String *s) {
Seek(value, 0, SEEK_SET);
Swig_warning(WARN_PP_EVALUATION, Getfile(value), Getline(value), "Could not evaluate expression '%s'\n", value);
if (msg)
Swig_warning(WARN_PP_EVALUATION, Getfile(value), Getline(value), "Error: '%s'\n", msg);
Swig_warning(WARN_PP_EVALUATION, Getfile(value), Getline(value), "%s\n", msg);
allow = 0;
} else {
if (val)