Fix a preprocessor expression evaluation bug
A subexpression in parentheses lost its string/int type flag and instead used whatever type was left in the stack entry from previous use. In practice we mostly got away with this because most preprocessor expressions are integer, but it could have resulted in a preprocessor expression incorrectly evaluating as zero. If -Wextra was in use you got a warning: Warning 202: Error: 'Can't mix strings and integers in expression' Fixes #1384
This commit is contained in:
parent
471b9f734e
commit
204a5f7bf3
3 changed files with 28 additions and 0 deletions
|
|
@ -11,6 +11,22 @@
|
|||
#pragma SWIG nowarn=890 /* lots of Go name conflicts */
|
||||
#pragma SWIG nowarn=206 /* Unexpected tokens after #endif directive. */
|
||||
|
||||
/* Regression test: in SWIG < 4.1.0 this triggered the two #error cases.
|
||||
* Github issue #1384
|
||||
*/
|
||||
#if "" != ""
|
||||
#endif
|
||||
#if 1 && (!0)
|
||||
// Should go here
|
||||
#else
|
||||
# error BUG
|
||||
#endif
|
||||
#if ((("" == ""))) || (1 && (!1))
|
||||
// Should go here
|
||||
#else
|
||||
# error BUG
|
||||
#endif
|
||||
|
||||
%{
|
||||
#if defined(__clang__)
|
||||
/*Suppress: warning: use of logical '&&' with constant operand [-Wconstant-logical-operand]*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue