Also skip lint comments in skip_block()
This commit is contained in:
parent
1ad085cfb8
commit
4ff171c1a5
|
@ -39,6 +39,9 @@ int SkipEscNewline = 0; /* how to interpret backslash-newline */
|
|||
int AccFileSpecifier = 0; /* return filespecifier <...> */
|
||||
int EoiForNewline = 0; /* return EOI upon encountering newline */
|
||||
int File_Inserted = 0; /* a file has just been inserted */
|
||||
#ifdef LINT
|
||||
extern int lint_skip_comment;
|
||||
#endif
|
||||
|
||||
#define MAX_LL_DEPTH 2
|
||||
|
||||
|
@ -451,8 +454,10 @@ skipcomment()
|
|||
NoUnstack++;
|
||||
LoadChar(c);
|
||||
#ifdef LINT
|
||||
if (! lint_skip_comment) {
|
||||
lint_start_comment();
|
||||
lint_comment_char(c);
|
||||
}
|
||||
#endif /* LINT */
|
||||
do {
|
||||
while (c != '*') {
|
||||
|
@ -462,22 +467,22 @@ skipcomment()
|
|||
if (c == EOI) {
|
||||
NoUnstack--;
|
||||
#ifdef LINT
|
||||
lint_end_comment();
|
||||
if (! lint_skip_comment) lint_end_comment();
|
||||
#endif /* LINT */
|
||||
return;
|
||||
}
|
||||
LoadChar(c);
|
||||
#ifdef LINT
|
||||
lint_comment_char(c);
|
||||
if (! lint_skip_comment) lint_comment_char(c);
|
||||
#endif /* LINT */
|
||||
} /* last Character seen was '*' */
|
||||
LoadChar(c);
|
||||
#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--;
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "idf.h"
|
||||
#include "input.h"
|
||||
#include "nopp.h"
|
||||
#include "lint.h"
|
||||
|
||||
#ifndef NOPP
|
||||
#include "ifdepth.h"
|
||||
|
@ -137,6 +138,10 @@ domacro()
|
|||
SkipEscNewline = 0;
|
||||
}
|
||||
|
||||
#ifdef LINT
|
||||
int lint_skip_comment;
|
||||
#endif
|
||||
|
||||
PRIVATE
|
||||
skip_block(to_endif)
|
||||
{
|
||||
|
@ -152,12 +157,18 @@ skip_block(to_endif)
|
|||
register int skiplevel = nestlevel; /* current nesting level */
|
||||
struct token tk;
|
||||
|
||||
#ifdef LINT
|
||||
lint_skip_comment++;
|
||||
#endif
|
||||
NoUnstack++;
|
||||
for (;;) {
|
||||
LoadChar(ch); /* read first character after newline */
|
||||
if (ch != '#') {
|
||||
if (ch == EOI) {
|
||||
NoUnstack--;
|
||||
#ifdef LINT
|
||||
lint_skip_comment--;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
SkipRestOfLine();
|
||||
|
@ -190,6 +201,9 @@ skip_block(to_endif)
|
|||
push_if();
|
||||
if (ifexpr()) {
|
||||
NoUnstack--;
|
||||
#ifdef LINT
|
||||
lint_skip_comment--;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -203,6 +217,9 @@ skip_block(to_endif)
|
|||
++(ifstack[nestlevel]);
|
||||
if (nestlevel == skiplevel) {
|
||||
NoUnstack--;
|
||||
#ifdef LINT
|
||||
lint_skip_comment--;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -213,6 +230,9 @@ skip_block(to_endif)
|
|||
if (nestlevel == skiplevel) {
|
||||
nestlevel--;
|
||||
NoUnstack--;
|
||||
#ifdef LINT
|
||||
lint_skip_comment--;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
nestlevel--;
|
||||
|
|
Loading…
Reference in a new issue