diff --git a/Source/Preprocessor/cpp.c b/Source/Preprocessor/cpp.c index 10018a787..af1775007 100644 --- a/Source/Preprocessor/cpp.c +++ b/Source/Preprocessor/cpp.c @@ -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 = '/';