Also skip lint comments in skip_block()

This commit is contained in:
ceriel 1993-06-09 09:40:54 +00:00
parent 40569c479e
commit 1ad085cfb8
2 changed files with 32 additions and 6 deletions

View file

@ -49,6 +49,10 @@ int LexSave = 0; /* last character read by GetChar */
#define FLG_DOTSEEN 0x02 /* certainly a floating point number */
extern arith full_mask[];
#ifdef LINT
extern int lint_skip_comment;
#endif
#ifndef NOPP
static struct token LexStack[MAX_LL_DEPTH];
static LexSP = 0;
@ -460,8 +464,10 @@ skipcomment()
NoUnstack++;
c = GetChar();
#ifdef LINT
if (! lint_skip_comment) {
lint_start_comment();
lint_comment_char(c);
}
#endif /* LINT */
do {
while (c != '*') {
@ -470,14 +476,14 @@ skipcomment()
} else if (c == EOI) {
NoUnstack--;
#ifdef LINT
lint_end_comment();
if (! lint_skip_comment) lint_end_comment();
#endif /* LINT */
return;
}
oldc = c;
c = GetChar();
#ifdef LINT
lint_comment_char(c);
if (! lint_skip_comment) lint_comment_char(c);
#endif /* LINT */
} /* last Character seen was '*' */
c = GetChar();
@ -485,11 +491,11 @@ skipcomment()
lexwarning("comment inside comment ?");
oldc = '*';
#ifdef LINT
lint_comment_char(c);
if (! lint_skip_comment) lint_comment_char(c);
#endif /* LINT */
} while (c != '/');
#ifdef LINT
lint_end_comment();
if (! lint_skip_comment) lint_end_comment();
#endif /* LINT */
NoUnstack--;
}

View file

@ -12,6 +12,7 @@
#include "idf.h"
#include "input.h"
#include "nopp.h"
#include "lint.h"
#ifndef NOPP
#include "ifdepth.h"
@ -148,6 +149,10 @@ domacro()
EoiForNewline = 0;
}
#ifdef LINT
int lint_skip_comment;
#endif
skip_block(to_endif)
int to_endif;
{
@ -164,6 +169,9 @@ int to_endif;
struct token tk;
int toknum;
#ifdef LINT
lint_skip_comment++;
#endif
NoUnstack++;
for (;;) {
ch = GetChar(); /* read first character after newline */
@ -172,6 +180,9 @@ int to_endif;
if (ch != '#') {
if (ch == EOI) {
NoUnstack--;
#ifdef LINT
lint_skip_comment--;
#endif
return;
}
/* A possible '/' is not pushed back */
@ -230,6 +241,9 @@ int to_endif;
push_if();
if (ifexpr()) {
NoUnstack--;
#ifdef LINT
lint_skip_comment--;
#endif
return;
}
}
@ -245,6 +259,9 @@ int to_endif;
lexstrict("garbage following #else");
}
NoUnstack--;
#ifdef LINT
lint_skip_comment--;
#endif
return;
}
else SkipToNewLine();
@ -258,6 +275,9 @@ int to_endif;
}
nestlevel--;
NoUnstack--;
#ifdef LINT
lint_skip_comment--;
#endif
return;
}
else SkipToNewLine();