Fix handling of // comments inside macro arguments
/* */ are already handled correctly.
This completes the fix from commit
624ec3e1b7 related to swig/swig#974.
This commit is contained in:
parent
d4badb3e1d
commit
30719feaf9
1 changed files with 11 additions and 0 deletions
|
|
@ -610,6 +610,7 @@ static List *find_args(String *s, int ismacro, String *macro_name) {
|
|||
} else if (c == '/') {
|
||||
/* Ensure comments are ignored by eating up the characters */
|
||||
c = Getc(s);
|
||||
/* Handle / * ... * / type comments (multi-line) */
|
||||
if (c == '*') {
|
||||
while ((c = Getc(s)) != EOF) {
|
||||
if (c == '*') {
|
||||
|
|
@ -621,6 +622,16 @@ static List *find_args(String *s, int ismacro, String *macro_name) {
|
|||
c = Getc(s);
|
||||
continue;
|
||||
}
|
||||
/* Handle // ... type comments (single-line) */
|
||||
if (c == '/') {
|
||||
while ((c = Getc(s)) != EOF) {
|
||||
if (c == '\n') {
|
||||
break;
|
||||
}
|
||||
}
|
||||
c = Getc(s);
|
||||
continue;
|
||||
}
|
||||
/* ensure char is available in the stream as this was not a comment*/
|
||||
Ungetc(c, s);
|
||||
c = '/';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue