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:
William S Fulton 2009-09-11 18:47:05 +00:00
parent 719cfe68bf
commit 2726424a7f
6 changed files with 13 additions and 6 deletions

View File

@ -1,6 +1,9 @@
Version 1.3.41 (in progress)
============================
2009-09-07: wsfulton
Fix constant expressions containing <= or >=.
2009-09-02: wsfulton
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:

View File

@ -667,7 +667,7 @@ in order for this to work.
</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>
<div class="indent"><p>
@ -676,7 +676,7 @@ pointer.
</p></div>
<p>
<b><tt>void memmove(void *ptr, char *s)</tt></b>
<b><tt>void memmove(void *ptr, const char *s)</tt></b>
</p>
<div class="indent"><p>

View File

@ -51,6 +51,8 @@ public class runme {
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_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_EQUALITY.GetType() );
assert( typeof(int) == preproc_constants_c.EXPR_AND.GetType() );

View File

@ -50,6 +50,8 @@ public class runme {
assert( typeof(int) == preproc_constants.EXPR_MINUS.GetType() );
assert( typeof(int) == preproc_constants.EXPR_LSHIFT.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_EQUALITY.GetType() );
assert( typeof(int) == preproc_constants.EXPR_AND.GetType() );

View File

@ -68,9 +68,9 @@
/* FIXME
#define EXPR_LT 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_EQUALITY 0xFF == 255
#define EXPR_AND 0xFF & 1

View File

@ -5620,11 +5620,11 @@ exprcompound : expr PLUS expr {
/* Putting >= in the expression literally causes an infinite
* loop somewhere in the type system. Just workaround for now
* - 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;
}
| 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;
}
| expr QUESTIONMARK expr COLON expr %prec QUESTIONMARK {