From 1ad085cfb843952e5b5875ba888fdc8507f7c266 Mon Sep 17 00:00:00 2001 From: ceriel Date: Wed, 9 Jun 1993 09:40:54 +0000 Subject: [PATCH] Also skip lint comments in skip_block() --- lang/cem/cemcom.ansi/LLlex.c | 18 ++++++++++++------ lang/cem/cemcom.ansi/domacro.c | 20 ++++++++++++++++++++ 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/lang/cem/cemcom.ansi/LLlex.c b/lang/cem/cemcom.ansi/LLlex.c index 094c66eba..99c678618 100644 --- a/lang/cem/cemcom.ansi/LLlex.c +++ b/lang/cem/cemcom.ansi/LLlex.c @@ -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 - lint_start_comment(); - lint_comment_char(c); + 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--; } diff --git a/lang/cem/cemcom.ansi/domacro.c b/lang/cem/cemcom.ansi/domacro.c index 9f97682ff..3f4f43b20 100644 --- a/lang/cem/cemcom.ansi/domacro.c +++ b/lang/cem/cemcom.ansi/domacro.c @@ -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();