Fix generated code for constant expressions containing wchar_t L literals.
Such as: # define __WCHAR_MAX (0x7fffffff + L'\0') Reported on swig-user mailing list.
This commit is contained in:
parent
323d606d3c
commit
90ba174fce
13 changed files with 29 additions and 2 deletions
|
|
@ -61,7 +61,8 @@ public class runme {
|
|||
assert( typeof(int) == preproc_constants_c.EXPR_LAND.GetType() );
|
||||
assert( typeof(int) == preproc_constants_c.EXPR_LOR.GetType() );
|
||||
assert( typeof(double) == preproc_constants_c.EXPR_CONDITIONAL.GetType() );
|
||||
|
||||
assert( typeof(int) == preproc_constants_c.EXPR_WCHAR_MAX.GetType() );
|
||||
assert( typeof(int) == preproc_constants_c.EXPR_WCHAR_MIN.GetType() );
|
||||
}
|
||||
static void assert(bool assertion) {
|
||||
if (!assertion)
|
||||
|
|
|
|||
|
|
@ -60,6 +60,8 @@ public class runme {
|
|||
assert( typeof(bool) == preproc_constants.EXPR_LAND.GetType() );
|
||||
assert( typeof(bool) == preproc_constants.EXPR_LOR.GetType() );
|
||||
assert( typeof(double) == preproc_constants.EXPR_CONDITIONAL.GetType() );
|
||||
assert( typeof(int) == preproc_constants.EXPR_WCHAR_MAX.GetType() );
|
||||
assert( typeof(int) == preproc_constants.EXPR_WCHAR_MIN.GetType() );
|
||||
|
||||
}
|
||||
static void assert(bool assertion) {
|
||||
|
|
|
|||
|
|
@ -61,4 +61,6 @@ void main() {
|
|||
static assert(is(int == typeof(EXPR_LAND())));
|
||||
static assert(is(int == typeof(EXPR_LOR())));
|
||||
static assert(is(double == typeof(EXPR_CONDITIONAL())));
|
||||
static assert(is(int == typeof(EXPR_WCHAR_MAX())));
|
||||
static assert(is(int == typeof(EXPR_WCHAR_MIN())));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,4 +61,6 @@ void main() {
|
|||
static assert(is(int == typeof(EXPR_LAND())));
|
||||
static assert(is(int == typeof(EXPR_LOR())));
|
||||
static assert(is(double == typeof(EXPR_CONDITIONAL())));
|
||||
static assert(is(int == typeof(EXPR_WCHAR_MAX())));
|
||||
static assert(is(int == typeof(EXPR_WCHAR_MIN())));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,4 +60,6 @@ void main() {
|
|||
static assert(is(bool == typeof(EXPR_LAND())));
|
||||
static assert(is(bool == typeof(EXPR_LOR())));
|
||||
static assert(is(double == typeof(EXPR_CONDITIONAL())));
|
||||
static assert(is(int == typeof(EXPR_WCHAR_MAX())));
|
||||
static assert(is(int == typeof(EXPR_WCHAR_MIN())));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,4 +60,6 @@ void main() {
|
|||
static assert(is(bool == typeof(EXPR_LAND())));
|
||||
static assert(is(bool == typeof(EXPR_LOR())));
|
||||
static assert(is(double == typeof(EXPR_CONDITIONAL())));
|
||||
static assert(is(int == typeof(EXPR_WCHAR_MAX())));
|
||||
static assert(is(int == typeof(EXPR_WCHAR_MIN())));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,5 +62,7 @@ check::equal(gettype(preproc_constants_c::EXPR_OR), "integer", "preproc_constant
|
|||
check::equal(gettype(preproc_constants_c::EXPR_LAND), "integer", "preproc_constants.EXPR_LAND has unexpected type");
|
||||
check::equal(gettype(preproc_constants_c::EXPR_LOR), "integer", "preproc_constants.EXPR_LOR has unexpected type");
|
||||
check::equal(gettype(preproc_constants_c::EXPR_CONDITIONAL), "double", "preproc_constants.EXPR_CONDITIONAL has unexpected type");
|
||||
check::equal(gettype(preproc_constants_c::EXPR_WCHAR_MAX), "integer", "preproc_constants.EXPR_WCHAR_MAX has unexpected type");
|
||||
check::equal(gettype(preproc_constants_c::EXPR_WCHAR_MIN), "integer", "preproc_constants.EXPR_WCHAR_MIN has unexpected type");
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -61,5 +61,7 @@ check::equal(gettype(preproc_constants::EXPR_OR), "integer", "preproc_constants.
|
|||
check::equal(gettype(preproc_constants::EXPR_LAND), "boolean", "preproc_constants.EXPR_LAND has unexpected type");
|
||||
check::equal(gettype(preproc_constants::EXPR_LOR), "boolean", "preproc_constants.EXPR_LOR has unexpected type");
|
||||
check::equal(gettype(preproc_constants::EXPR_CONDITIONAL), "double", "preproc_constants.EXPR_CONDITIONAL has unexpected type");
|
||||
check::equal(gettype(preproc_constants::EXPR_WCHAR_MAX), "integer", "preproc_constants.EXPR_WCHAR_MAX has unexpected type");
|
||||
check::equal(gettype(preproc_constants::EXPR_WCHAR_MIN), "integer", "preproc_constants.EXPR_WCHAR_MIN has unexpected type");
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -62,5 +62,7 @@ check::equal(gettype(preproc_constants_c::EXPR_OR), "integer", "preproc_constant
|
|||
check::equal(gettype(preproc_constants_c::EXPR_LAND), "integer", "preproc_constants.EXPR_LAND has unexpected type");
|
||||
check::equal(gettype(preproc_constants_c::EXPR_LOR), "integer", "preproc_constants.EXPR_LOR has unexpected type");
|
||||
check::equal(gettype(preproc_constants_c::EXPR_CONDITIONAL), "double", "preproc_constants.EXPR_CONDITIONAL has unexpected type");
|
||||
check::equal(gettype(preproc_constants_c::EXPR_WCHAR_MAX), "integer", "preproc_constants.EXPR_WCHAR_MAX has unexpected type");
|
||||
check::equal(gettype(preproc_constants_c::EXPR_WCHAR_MIN), "integer", "preproc_constants.EXPR_WCHAR_MIN has unexpected type");
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -70,5 +70,7 @@ check::equal(gettype(preproc_constants::EXPR_LAND), "integer", "preproc_constant
|
|||
check::equal(gettype(preproc_constants::EXPR_LOR), "integer", "preproc_constants.EXPR_LOR has unexpected type");
|
||||
|
||||
check::equal(gettype(preproc_constants::EXPR_CONDITIONAL), "double", "preproc_constants.EXPR_CONDITIONAL has unexpected type");
|
||||
check::equal(gettype(preproc_constants::EXPR_WCHAR_MAX), "integer", "preproc_constants.EXPR_WCHAR_MAX has unexpected type");
|
||||
check::equal(gettype(preproc_constants::EXPR_WCHAR_MIN), "integer", "preproc_constants.EXPR_WCHAR_MIN has unexpected type");
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -87,6 +87,9 @@
|
|||
#define EXPR_LOR 0xFF || 1
|
||||
#define EXPR_CONDITIONAL true ? 2 : 2.2
|
||||
|
||||
#define EXPR_WCHAR_MAX (0x7fffffff + L'\0')
|
||||
#define EXPR_WCHAR_MIN (-EXPR_WCHAR_MAX - 1)
|
||||
|
||||
#define EXPR_CHAR_COMPOUND_ADD 'A' + 12
|
||||
#define EXPR_CHAR_COMPOUND_LSHIFT 'B' << 6
|
||||
#define H_SUPPRESS_SCALING_MAGIC (('s'<<24) | ('u'<<16) | ('p'<<8) | 'p')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue