Also skip lint comments in skip_block()
This commit is contained in:
parent
40569c479e
commit
1ad085cfb8
|
@ -49,6 +49,10 @@ int LexSave = 0; /* last character read by GetChar */
|
||||||
#define FLG_DOTSEEN 0x02 /* certainly a floating point number */
|
#define FLG_DOTSEEN 0x02 /* certainly a floating point number */
|
||||||
extern arith full_mask[];
|
extern arith full_mask[];
|
||||||
|
|
||||||
|
#ifdef LINT
|
||||||
|
extern int lint_skip_comment;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef NOPP
|
#ifndef NOPP
|
||||||
static struct token LexStack[MAX_LL_DEPTH];
|
static struct token LexStack[MAX_LL_DEPTH];
|
||||||
static LexSP = 0;
|
static LexSP = 0;
|
||||||
|
@ -460,8 +464,10 @@ skipcomment()
|
||||||
NoUnstack++;
|
NoUnstack++;
|
||||||
c = GetChar();
|
c = GetChar();
|
||||||
#ifdef LINT
|
#ifdef LINT
|
||||||
lint_start_comment();
|
if (! lint_skip_comment) {
|
||||||
lint_comment_char(c);
|
lint_start_comment();
|
||||||
|
lint_comment_char(c);
|
||||||
|
}
|
||||||
#endif /* LINT */
|
#endif /* LINT */
|
||||||
do {
|
do {
|
||||||
while (c != '*') {
|
while (c != '*') {
|
||||||
|
@ -470,14 +476,14 @@ skipcomment()
|
||||||
} else if (c == EOI) {
|
} else if (c == EOI) {
|
||||||
NoUnstack--;
|
NoUnstack--;
|
||||||
#ifdef LINT
|
#ifdef LINT
|
||||||
lint_end_comment();
|
if (! lint_skip_comment) lint_end_comment();
|
||||||
#endif /* LINT */
|
#endif /* LINT */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
oldc = c;
|
oldc = c;
|
||||||
c = GetChar();
|
c = GetChar();
|
||||||
#ifdef LINT
|
#ifdef LINT
|
||||||
lint_comment_char(c);
|
if (! lint_skip_comment) lint_comment_char(c);
|
||||||
#endif /* LINT */
|
#endif /* LINT */
|
||||||
} /* last Character seen was '*' */
|
} /* last Character seen was '*' */
|
||||||
c = GetChar();
|
c = GetChar();
|
||||||
|
@ -485,11 +491,11 @@ skipcomment()
|
||||||
lexwarning("comment inside comment ?");
|
lexwarning("comment inside comment ?");
|
||||||
oldc = '*';
|
oldc = '*';
|
||||||
#ifdef LINT
|
#ifdef LINT
|
||||||
lint_comment_char(c);
|
if (! lint_skip_comment) lint_comment_char(c);
|
||||||
#endif /* LINT */
|
#endif /* LINT */
|
||||||
} while (c != '/');
|
} while (c != '/');
|
||||||
#ifdef LINT
|
#ifdef LINT
|
||||||
lint_end_comment();
|
if (! lint_skip_comment) lint_end_comment();
|
||||||
#endif /* LINT */
|
#endif /* LINT */
|
||||||
NoUnstack--;
|
NoUnstack--;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include "idf.h"
|
#include "idf.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "nopp.h"
|
#include "nopp.h"
|
||||||
|
#include "lint.h"
|
||||||
|
|
||||||
#ifndef NOPP
|
#ifndef NOPP
|
||||||
#include "ifdepth.h"
|
#include "ifdepth.h"
|
||||||
|
@ -148,6 +149,10 @@ domacro()
|
||||||
EoiForNewline = 0;
|
EoiForNewline = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef LINT
|
||||||
|
int lint_skip_comment;
|
||||||
|
#endif
|
||||||
|
|
||||||
skip_block(to_endif)
|
skip_block(to_endif)
|
||||||
int to_endif;
|
int to_endif;
|
||||||
{
|
{
|
||||||
|
@ -164,6 +169,9 @@ int to_endif;
|
||||||
struct token tk;
|
struct token tk;
|
||||||
int toknum;
|
int toknum;
|
||||||
|
|
||||||
|
#ifdef LINT
|
||||||
|
lint_skip_comment++;
|
||||||
|
#endif
|
||||||
NoUnstack++;
|
NoUnstack++;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
ch = GetChar(); /* read first character after newline */
|
ch = GetChar(); /* read first character after newline */
|
||||||
|
@ -172,6 +180,9 @@ int to_endif;
|
||||||
if (ch != '#') {
|
if (ch != '#') {
|
||||||
if (ch == EOI) {
|
if (ch == EOI) {
|
||||||
NoUnstack--;
|
NoUnstack--;
|
||||||
|
#ifdef LINT
|
||||||
|
lint_skip_comment--;
|
||||||
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* A possible '/' is not pushed back */
|
/* A possible '/' is not pushed back */
|
||||||
|
@ -230,6 +241,9 @@ int to_endif;
|
||||||
push_if();
|
push_if();
|
||||||
if (ifexpr()) {
|
if (ifexpr()) {
|
||||||
NoUnstack--;
|
NoUnstack--;
|
||||||
|
#ifdef LINT
|
||||||
|
lint_skip_comment--;
|
||||||
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -245,6 +259,9 @@ int to_endif;
|
||||||
lexstrict("garbage following #else");
|
lexstrict("garbage following #else");
|
||||||
}
|
}
|
||||||
NoUnstack--;
|
NoUnstack--;
|
||||||
|
#ifdef LINT
|
||||||
|
lint_skip_comment--;
|
||||||
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else SkipToNewLine();
|
else SkipToNewLine();
|
||||||
|
@ -258,6 +275,9 @@ int to_endif;
|
||||||
}
|
}
|
||||||
nestlevel--;
|
nestlevel--;
|
||||||
NoUnstack--;
|
NoUnstack--;
|
||||||
|
#ifdef LINT
|
||||||
|
lint_skip_comment--;
|
||||||
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else SkipToNewLine();
|
else SkipToNewLine();
|
||||||
|
|
Loading…
Reference in a new issue