diff --git a/lang/cem/cemcom/LLlex.c b/lang/cem/cemcom/LLlex.c index c9c111150..c07d1fc07 100644 --- a/lang/cem/cemcom/LLlex.c +++ b/lang/cem/cemcom/LLlex.c @@ -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 - lint_start_comment(); - lint_comment_char(c); + 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--; } diff --git a/lang/cem/cemcom/domacro.c b/lang/cem/cemcom/domacro.c index 02677bf10..67889beaa 100644 --- a/lang/cem/cemcom/domacro.c +++ b/lang/cem/cemcom/domacro.c @@ -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--;