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:
Luca Longinotti 2017-11-30 11:10:44 +01:00 committed by Olly Betts
commit 30719feaf9

View file

@ -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 = '/';