Only assume it is a k&r-declaration, if the unknown identifier in the parameter list...
[cparser] / lexer.c
diff --git a/lexer.c b/lexer.c
index 10bca9d..5ca734a 100644 (file)
--- a/lexer.c
+++ b/lexer.c
@@ -1150,7 +1150,10 @@ static void skip_multiline_comment(void)
                case '/':
                        next_char();
                        if (c == '*') {
-                               /* TODO: nested comment, warn here */
+                               /* nested comment, warn here */
+                               if (warning.comment) {
+                                       warningf(&lexer_token.source_position, "'/*' within comment");
+                               }
                        }
                        break;
                case '*':
@@ -1192,6 +1195,15 @@ static void skip_line_comment(void)
                case '\r':
                        return;
 
+               case '\\':
+                       next_char();
+                       if (c == '\n' || c == '\r') {
+                               if (warning.comment)
+                                       warningf(&lexer_token.source_position, "multi-line comment");
+                               return;
+                       }
+                       break;
+
                default:
                        next_char();
                        break;