Also skip lint comments in skip_block()

This commit is contained in:
ceriel 1993-06-09 10:17:44 +00:00
parent 1ad085cfb8
commit 4ff171c1a5
2 changed files with 31 additions and 6 deletions

View file

@ -39,6 +39,9 @@ int SkipEscNewline = 0; /* how to interpret backslash-newline */
int AccFileSpecifier = 0; /* return filespecifier <...> */ int AccFileSpecifier = 0; /* return filespecifier <...> */
int EoiForNewline = 0; /* return EOI upon encountering newline */ int EoiForNewline = 0; /* return EOI upon encountering newline */
int File_Inserted = 0; /* a file has just been inserted */ int File_Inserted = 0; /* a file has just been inserted */
#ifdef LINT
extern int lint_skip_comment;
#endif
#define MAX_LL_DEPTH 2 #define MAX_LL_DEPTH 2
@ -451,8 +454,10 @@ skipcomment()
NoUnstack++; NoUnstack++;
LoadChar(c); LoadChar(c);
#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 != '*') {
@ -462,22 +467,22 @@ skipcomment()
if (c == EOI) { 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;
} }
LoadChar(c); LoadChar(c);
#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 '*' */
LoadChar(c); LoadChar(c);
#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--;
} }

View file

@ -13,6 +13,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"
@ -137,6 +138,10 @@ domacro()
SkipEscNewline = 0; SkipEscNewline = 0;
} }
#ifdef LINT
int lint_skip_comment;
#endif
PRIVATE PRIVATE
skip_block(to_endif) skip_block(to_endif)
{ {
@ -152,12 +157,18 @@ skip_block(to_endif)
register int skiplevel = nestlevel; /* current nesting level */ register int skiplevel = nestlevel; /* current nesting level */
struct token tk; struct token tk;
#ifdef LINT
lint_skip_comment++;
#endif
NoUnstack++; NoUnstack++;
for (;;) { for (;;) {
LoadChar(ch); /* read first character after newline */ LoadChar(ch); /* read first character after newline */
if (ch != '#') { if (ch != '#') {
if (ch == EOI) { if (ch == EOI) {
NoUnstack--; NoUnstack--;
#ifdef LINT
lint_skip_comment--;
#endif
return; return;
} }
SkipRestOfLine(); SkipRestOfLine();
@ -190,6 +201,9 @@ skip_block(to_endif)
push_if(); push_if();
if (ifexpr()) { if (ifexpr()) {
NoUnstack--; NoUnstack--;
#ifdef LINT
lint_skip_comment--;
#endif
return; return;
} }
} }
@ -203,6 +217,9 @@ skip_block(to_endif)
++(ifstack[nestlevel]); ++(ifstack[nestlevel]);
if (nestlevel == skiplevel) { if (nestlevel == skiplevel) {
NoUnstack--; NoUnstack--;
#ifdef LINT
lint_skip_comment--;
#endif
return; return;
} }
} }
@ -213,6 +230,9 @@ skip_block(to_endif)
if (nestlevel == skiplevel) { if (nestlevel == skiplevel) {
nestlevel--; nestlevel--;
NoUnstack--; NoUnstack--;
#ifdef LINT
lint_skip_comment--;
#endif
return; return;
} }
nestlevel--; nestlevel--;