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:
parent
0deb8a855d
commit
74d12d8c4c
5 changed files with 31 additions and 14 deletions
|
|
@ -7,6 +7,23 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
|
|||
Version 4.1.0 (in progress)
|
||||
===========================
|
||||
|
||||
2022-02-24: olly
|
||||
#1465 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
|
||||
|
||||
2022-02-23: olly
|
||||
#1384 Fix a preprocessor expression evaluation bug. A
|
||||
subexpression in parentheses lost its string/int type flag and
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
pp_badeval.i:4: Warning 202: Could not evaluate expression 'FOO==4+'
|
||||
pp_badeval.i:4: Warning 202: Error: 'Expected an expression'
|
||||
pp_badeval.i:4: Warning 202: Expected an expression
|
||||
|
|
|
|||
|
|
@ -1,23 +1,23 @@
|
|||
pp_expressions_bad.i:7: Warning 202: Could not evaluate expression '1%ZERO'
|
||||
pp_expressions_bad.i:7: Warning 202: Error: 'Modulo by zero in expression'
|
||||
pp_expressions_bad.i:7: Warning 202: Modulo by zero in expression
|
||||
pp_expressions_bad.i:9: Warning 202: Could not evaluate expression '2/ZERO'
|
||||
pp_expressions_bad.i:9: Warning 202: Error: 'Division by zero in expression'
|
||||
pp_expressions_bad.i:9: Warning 202: Division by zero in expression
|
||||
pp_expressions_bad.i:12: Warning 202: Could not evaluate expression '1%(5-5)'
|
||||
pp_expressions_bad.i:12: Warning 202: Error: 'Modulo by zero in expression'
|
||||
pp_expressions_bad.i:12: Warning 202: Modulo by zero in expression
|
||||
pp_expressions_bad.i:14: Warning 202: Could not evaluate expression '2/(55-55)'
|
||||
pp_expressions_bad.i:14: Warning 202: Error: 'Division by zero in expression'
|
||||
pp_expressions_bad.i:14: Warning 202: Division by zero in expression
|
||||
pp_expressions_bad.i:18: Warning 202: Could not evaluate expression '1.2'
|
||||
pp_expressions_bad.i:18: Warning 202: Error: 'Floating point constant in preprocessor expression'
|
||||
pp_expressions_bad.i:18: Warning 202: Floating point constant in preprocessor expression
|
||||
pp_expressions_bad.i:21: Warning 202: Could not evaluate expression '2e3'
|
||||
pp_expressions_bad.i:21: Warning 202: Error: 'Floating point constant in preprocessor expression'
|
||||
pp_expressions_bad.i:21: Warning 202: Floating point constant in preprocessor expression
|
||||
pp_expressions_bad.i:25: Warning 202: Could not evaluate expression '8.8'
|
||||
pp_expressions_bad.i:25: Warning 202: Error: 'Floating point constant in preprocessor expression'
|
||||
pp_expressions_bad.i:25: Warning 202: Floating point constant in preprocessor expression
|
||||
pp_expressions_bad.i:29: Error: Unknown SWIG preprocessor directive: if123 (if this is a block of target language code, delimit it with %{ and %})
|
||||
pp_expressions_bad.i:30: Error: Extraneous #endif.
|
||||
pp_expressions_bad.i:32: Error: Unknown SWIG preprocessor directive: if456e (if this is a block of target language code, delimit it with %{ and %})
|
||||
pp_expressions_bad.i:33: Error: Extraneous #endif.
|
||||
pp_expressions_bad.i:42: Warning 204: CPP #warning, "Warning okay: #if(1)".
|
||||
pp_expressions_bad.i:48: Warning 202: Could not evaluate expression '"TWO" == 1'
|
||||
pp_expressions_bad.i:48: Warning 202: Error: 'Can't mix strings and integers in expression'
|
||||
pp_expressions_bad.i:48: Warning 202: Can't mix strings and integers in expression
|
||||
pp_expressions_bad.i:52: Warning 202: Could not evaluate expression '1 == ("TWO")'
|
||||
pp_expressions_bad.i:52: Warning 202: Error: 'Can't mix strings and integers in expression'
|
||||
pp_expressions_bad.i:52: Warning 202: Can't mix strings and integers in expression
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
:EOF: Error: Exponent does not have any digits
|
||||
pp_invalid_exponents.i:3: Warning 202: Could not evaluate expression '123e'
|
||||
pp_invalid_exponents.i:3: Warning 202: Error: 'Syntax error'
|
||||
pp_invalid_exponents.i:3: Warning 202: Syntax error
|
||||
:EOF: Error: Exponent does not have any digits
|
||||
pp_invalid_exponents.i:6: Warning 202: Could not evaluate expression '456.e'
|
||||
pp_invalid_exponents.i:6: Warning 202: Error: 'Syntax error'
|
||||
pp_invalid_exponents.i:6: Warning 202: Syntax error
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue