Fix constants involved parenthesised char literals

Fixes https://sourceforge.net/p/swig/bugs/1168/
This commit is contained in:
Olly Betts 2017-10-07 14:30:42 +13:00 committed by Olly Betts
commit 0863eca5e7
2 changed files with 10 additions and 2 deletions

View file

@ -95,6 +95,11 @@
#define EXPR_CHAR_COMPOUND_LSHIFT 'B' << 6
#define H_SUPPRESS_SCALING_MAGIC (('s'<<24) | ('u'<<16) | ('p'<<8) | 'p')
// https://sourceforge.net/p/swig/bugs/1168/
#define CHR(ch1,ch2,ch3,ch4) (((ch1)<<24)|((ch2)<<16)|((ch3)<<8)|(ch4))
#define DEFAULT_LANG CHR('d','f','l','t')
%constant DEFAULT_LANG_SIMPLIFIED = ('d')<<24;
/// constant assignment in enum
#if defined(SWIGCSHARP)
%csconstvalue("1<<2") kValue;

View file

@ -6316,9 +6316,12 @@ valexpr : exprnum { $$ = $1; }
/* grouping */
| LPAREN expr RPAREN %prec CAST {
$$.val = NewStringf("(%s)",$2.val);
$$.val = NewStringf("(%s)",$2.val);
if ($2.rawval) {
$$.rawval = NewStringf("(%s)",$2.rawval);
}
$$.type = $2.type;
}
}
/* A few common casting operations */