added warning for nested comment
authoreck <none@none>
Tue, 10 Apr 1990 10:52:52 +0000 (10:52 +0000)
committereck <none@none>
Tue, 10 Apr 1990 10:52:52 +0000 (10:52 +0000)
lang/cem/cpp.ansi/preprocess.c

index 1a31034..025af03 100644 (file)
@@ -378,7 +378,7 @@ char *op;
 int *lineno;
 {
        char *ob = &_obuf[OBUFSIZE];
-       register int c;
+       register int c, oldc = '\0';
 
        NoUnstack++;
        if (options['C']) {
@@ -410,8 +410,14 @@ int *lineno;
                                        echo(c);
                                }
                                break;                  /* for(;;) */
+                       } else if (oldc == '/') {
+                               warning("comment inside comment ?");
                        }
-               } else c = GetChar();
+                       oldc = '*';
+               } else {
+                       oldc = c;
+                       c = GetChar();
+               }
        }
        NoUnstack--;
        return op;