Fix handling of modulo operator (%) in constant expressions (SF#2818562).
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11774 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
bcda9644f1
commit
02eb6a81d1
4 changed files with 19 additions and 3 deletions
|
|
@ -1,6 +1,10 @@
|
|||
Version 1.3.41 (in progress)
|
||||
============================
|
||||
|
||||
2009-12-04: olly
|
||||
Fix handling of modulo operator (%) in constant expressions
|
||||
(SF#2818562).
|
||||
|
||||
2009-12-04: olly
|
||||
[PHP] "empty" is a reserved word in PHP, so rename empty() method
|
||||
on STL classes to "is_empty()" (previously this was automatically
|
||||
|
|
|
|||
|
|
@ -441,6 +441,7 @@ C_TEST_CASES += \
|
|||
arrays \
|
||||
char_constant \
|
||||
const_const \
|
||||
constant_expr \
|
||||
empty \
|
||||
enums \
|
||||
extern_declaration \
|
||||
|
|
|
|||
11
Examples/test-suite/constant_expr.i
Normal file
11
Examples/test-suite/constant_expr.i
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
%module constant_expr;
|
||||
/* Tests of constant expressions. */
|
||||
|
||||
%inline %{
|
||||
|
||||
/* % didn't work in SWIG 1.3.40 and earlier. */
|
||||
const int X = 123%7;
|
||||
#define FOO 12 % 6
|
||||
double d_array[12 % 6];
|
||||
|
||||
%}
|
||||
|
|
@ -1647,7 +1647,7 @@ static void tag_nodes(Node *n, const_String_or_char_ptr attrname, DOH *value) {
|
|||
%token NATIVE INLINE
|
||||
%token TYPEMAP EXCEPT ECHO APPLY CLEAR SWIGTEMPLATE FRAGMENT
|
||||
%token WARN
|
||||
%token LESSTHAN GREATERTHAN MODULO DELETE_KW
|
||||
%token LESSTHAN GREATERTHAN DELETE_KW
|
||||
%token LESSTHANOREQUALTO GREATERTHANOREQUALTO EQUALTO NOTEQUALTO
|
||||
%token QUESTIONMARK
|
||||
%token TYPES PARMS
|
||||
|
|
@ -1668,7 +1668,7 @@ static void tag_nodes(Node *n, const_String_or_char_ptr attrname, DOH *value) {
|
|||
%left GREATERTHAN LESSTHAN GREATERTHANOREQUALTO LESSTHANOREQUALTO
|
||||
%left LSHIFT RSHIFT
|
||||
%left PLUS MINUS
|
||||
%left STAR SLASH MODULUS
|
||||
%left STAR SLASH MODULO
|
||||
%left UMINUS NOT LNOT
|
||||
%left DCOLON
|
||||
|
||||
|
|
@ -5745,7 +5745,7 @@ exprcompound : expr PLUS expr {
|
|||
$$.val = NewStringf("%s/%s",$1.val,$3.val);
|
||||
$$.type = promote($1.type,$3.type);
|
||||
}
|
||||
| expr MODULUS expr {
|
||||
| expr MODULO expr {
|
||||
$$.val = NewStringf("%s%%%s",$1.val,$3.val);
|
||||
$$.type = promote($1.type,$3.type);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue