keep comments in actions; they may be significant (for lint)

This commit is contained in:
ceriel 1990-08-07 10:48:02 +00:00
parent 17158641e0
commit 4a34358b6a
2 changed files with 7 additions and 4 deletions

View file

@ -589,6 +589,7 @@ copyact(ch1,ch2,flag,level) char ch1,ch2; {
ch = input();
unput(ch);
if (ch == '*') {
putc('/', f);
skipcomment(1);
continue;
}

View file

@ -240,20 +240,22 @@ unput(c) {
skipcomment(flag) {
/*
* Skip comment. If flag != 0, the comment is inside a fragment
* of C-code, so the newlines in it must be copied to enable the
* C-compiler to keep a correct line count
* of C-code, so keep it.
*/
register int ch;
int saved; /* line count on which comment starts */
saved = linecount;
if (input() != '*') error(linecount,"Illegal comment");
if (flag) putc('*', fact);
do {
ch = input();
if (flag) putc(ch, fact);
while (ch == '*') {
if ((ch = input()) == '/') return;
ch = input();
if (flag) putc(ch, fact);
if (ch == '/') return;
}
if (flag && ch == '\n') putc(ch,fact);
} while (ch != EOF);
error(saved,"Comment does not terminate");
}