mirror of https://github.com/swig/swig
Fix constant expressions containing <= or >=
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11687 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
719cfe68bf
commit
2726424a7f
|
@ -1,6 +1,9 @@
|
||||||
Version 1.3.41 (in progress)
|
Version 1.3.41 (in progress)
|
||||||
============================
|
============================
|
||||||
|
|
||||||
|
2009-09-07: wsfulton
|
||||||
|
Fix constant expressions containing <= or >=.
|
||||||
|
|
||||||
2009-09-02: wsfulton
|
2009-09-02: wsfulton
|
||||||
The following operators in constant expressions now result in type bool for C++
|
The following operators in constant expressions now result in type bool for C++
|
||||||
wrappers and remain as type int for C wrappers, as per each standard:
|
wrappers and remain as type int for C wrappers, as per each standard:
|
||||||
|
|
|
@ -667,7 +667,7 @@ in order for this to work.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<b><tt>char *cdata(void *ptr, int nbytes)</tt></b>
|
<b><tt>const char *cdata(void *ptr, size_t nbytes)</tt></b>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="indent"><p>
|
<div class="indent"><p>
|
||||||
|
@ -676,7 +676,7 @@ pointer.
|
||||||
</p></div>
|
</p></div>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<b><tt>void memmove(void *ptr, char *s)</tt></b>
|
<b><tt>void memmove(void *ptr, const char *s)</tt></b>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="indent"><p>
|
<div class="indent"><p>
|
||||||
|
|
|
@ -51,6 +51,8 @@ public class runme {
|
||||||
assert( typeof(int) == preproc_constants_c.EXPR_MINUS.GetType() );
|
assert( typeof(int) == preproc_constants_c.EXPR_MINUS.GetType() );
|
||||||
assert( typeof(int) == preproc_constants_c.EXPR_LSHIFT.GetType() );
|
assert( typeof(int) == preproc_constants_c.EXPR_LSHIFT.GetType() );
|
||||||
assert( typeof(int) == preproc_constants_c.EXPR_RSHIFT.GetType() );
|
assert( typeof(int) == preproc_constants_c.EXPR_RSHIFT.GetType() );
|
||||||
|
assert( typeof(int) == preproc_constants_c.EXPR_LTE.GetType() );
|
||||||
|
assert( typeof(int) == preproc_constants_c.EXPR_GTE.GetType() );
|
||||||
assert( typeof(int) == preproc_constants_c.EXPR_INEQUALITY.GetType() );
|
assert( typeof(int) == preproc_constants_c.EXPR_INEQUALITY.GetType() );
|
||||||
assert( typeof(int) == preproc_constants_c.EXPR_EQUALITY.GetType() );
|
assert( typeof(int) == preproc_constants_c.EXPR_EQUALITY.GetType() );
|
||||||
assert( typeof(int) == preproc_constants_c.EXPR_AND.GetType() );
|
assert( typeof(int) == preproc_constants_c.EXPR_AND.GetType() );
|
||||||
|
|
|
@ -50,6 +50,8 @@ public class runme {
|
||||||
assert( typeof(int) == preproc_constants.EXPR_MINUS.GetType() );
|
assert( typeof(int) == preproc_constants.EXPR_MINUS.GetType() );
|
||||||
assert( typeof(int) == preproc_constants.EXPR_LSHIFT.GetType() );
|
assert( typeof(int) == preproc_constants.EXPR_LSHIFT.GetType() );
|
||||||
assert( typeof(int) == preproc_constants.EXPR_RSHIFT.GetType() );
|
assert( typeof(int) == preproc_constants.EXPR_RSHIFT.GetType() );
|
||||||
|
assert( typeof(bool) == preproc_constants.EXPR_LTE.GetType() );
|
||||||
|
assert( typeof(bool) == preproc_constants.EXPR_GTE.GetType() );
|
||||||
assert( typeof(bool) == preproc_constants.EXPR_INEQUALITY.GetType() );
|
assert( typeof(bool) == preproc_constants.EXPR_INEQUALITY.GetType() );
|
||||||
assert( typeof(bool) == preproc_constants.EXPR_EQUALITY.GetType() );
|
assert( typeof(bool) == preproc_constants.EXPR_EQUALITY.GetType() );
|
||||||
assert( typeof(int) == preproc_constants.EXPR_AND.GetType() );
|
assert( typeof(int) == preproc_constants.EXPR_AND.GetType() );
|
||||||
|
|
|
@ -68,9 +68,9 @@
|
||||||
/* FIXME
|
/* FIXME
|
||||||
#define EXPR_LT 0xFF < 255
|
#define EXPR_LT 0xFF < 255
|
||||||
#define EXPR_GT 0xFF > 255
|
#define EXPR_GT 0xFF > 255
|
||||||
#define EXPR_LTE 0xFF <= 255
|
|
||||||
#define EXPR_LGE 0xFF >= 255
|
|
||||||
*/
|
*/
|
||||||
|
#define EXPR_LTE 0xFF <= 255
|
||||||
|
#define EXPR_GTE 0xFF >= 255
|
||||||
#define EXPR_INEQUALITY 0xFF != 255
|
#define EXPR_INEQUALITY 0xFF != 255
|
||||||
#define EXPR_EQUALITY 0xFF == 255
|
#define EXPR_EQUALITY 0xFF == 255
|
||||||
#define EXPR_AND 0xFF & 1
|
#define EXPR_AND 0xFF & 1
|
||||||
|
|
|
@ -5620,11 +5620,11 @@ exprcompound : expr PLUS expr {
|
||||||
/* Putting >= in the expression literally causes an infinite
|
/* Putting >= in the expression literally causes an infinite
|
||||||
* loop somewhere in the type system. Just workaround for now
|
* loop somewhere in the type system. Just workaround for now
|
||||||
* - SWIG_GE is defined in swiglabels.swg. */
|
* - SWIG_GE is defined in swiglabels.swg. */
|
||||||
$$.val = NewStringf("%s SWIG_GE %s", $1.val, $3.val);
|
$$.val = NewStringf("%s >= %s", $1.val, $3.val);
|
||||||
$$.type = cparse_cplusplus ? T_BOOL : T_INT;
|
$$.type = cparse_cplusplus ? T_BOOL : T_INT;
|
||||||
}
|
}
|
||||||
| expr LESSTHANOREQUALTO expr {
|
| expr LESSTHANOREQUALTO expr {
|
||||||
$$.val = NewStringf("%s SWIG_LE %s", $1.val, $3.val);
|
$$.val = NewStringf("%s <= %s", $1.val, $3.val);
|
||||||
$$.type = cparse_cplusplus ? T_BOOL : T_INT;
|
$$.type = cparse_cplusplus ? T_BOOL : T_INT;
|
||||||
}
|
}
|
||||||
| expr QUESTIONMARK expr COLON expr %prec QUESTIONMARK {
|
| expr QUESTIONMARK expr COLON expr %prec QUESTIONMARK {
|
||||||
|
|
Loading…
Reference in New Issue