Merge branch 'redbrain-parser-fix'
* redbrain-parser-fix: Add testcase for macros with commas in comment Fix bug with comments inline in macros - commit fixes #974 Closes #974
This commit is contained in:
commit
fcde570091
4 changed files with 40 additions and 0 deletions
|
|
@ -7,6 +7,9 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
|
||||||
Version 4.0.0 (in progress)
|
Version 4.0.0 (in progress)
|
||||||
===========================
|
===========================
|
||||||
|
|
||||||
|
2017-04-27: redbrain
|
||||||
|
Issue #974, Patch #976 - Fix preprocessor handling of macros with commas in a comment.
|
||||||
|
|
||||||
2017-04-25: jleveque
|
2017-04-25: jleveque
|
||||||
[Lua] #959 - Fix Visual Studio C4244 conversion warnings in Lua wrappers.
|
[Lua] #959 - Fix Visual Studio C4244 conversion warnings in Lua wrappers.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -370,3 +370,20 @@ int methodX(int x);
|
||||||
int methodX(int x) { return x+100; }
|
int methodX(int x) { return x+100; }
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
// Comma in macro - Github issue #974
|
||||||
|
%inline %{
|
||||||
|
#define __attribute__(x)
|
||||||
|
#define TCX_PACKED(d) d __attribute__ ((__packed__))
|
||||||
|
|
||||||
|
TCX_PACKED (typedef struct tcxMessageTestImpl
|
||||||
|
{
|
||||||
|
int mHeader; /**< comment */
|
||||||
|
}) tcxMessageTest;
|
||||||
|
|
||||||
|
|
||||||
|
TCX_PACKED (typedef struct tcxMessageBugImpl
|
||||||
|
{
|
||||||
|
int mBid; /**< Bid price and size, check PresentMap if available in message */
|
||||||
|
}) tcxMessageBug;
|
||||||
|
%}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,3 +14,6 @@ if 2 * preproc.one != preproc.two:
|
||||||
|
|
||||||
if preproc.methodX(99) != 199:
|
if preproc.methodX(99) != 199:
|
||||||
raise RuntimeError
|
raise RuntimeError
|
||||||
|
|
||||||
|
t1 = preproc.tcxMessageTest()
|
||||||
|
t2 = preproc.tcxMessageBug()
|
||||||
|
|
|
||||||
|
|
@ -607,6 +607,23 @@ static List *find_args(String *s, int ismacro, String *macro_name) {
|
||||||
skip_tochar(s, '\'', str);
|
skip_tochar(s, '\'', str);
|
||||||
c = Getc(s);
|
c = Getc(s);
|
||||||
continue;
|
continue;
|
||||||
|
} else if (c == '/') {
|
||||||
|
/* Ensure comments are ignored by eating up the characters */
|
||||||
|
c = Getc(s);
|
||||||
|
if (c == '*') {
|
||||||
|
while ((c = Getc(s)) != EOF) {
|
||||||
|
if (c == '*') {
|
||||||
|
c = Getc(s);
|
||||||
|
if (c == '/' || c == EOF)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
c = Getc(s);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
/* ensure char is available in the stream as this was not a comment*/
|
||||||
|
Ungetc(c, s);
|
||||||
|
c = '/';
|
||||||
}
|
}
|
||||||
if ((c == ',') && (level == 0))
|
if ((c == ',') && (level == 0))
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue