From: ceriel Date: Fri, 29 Jul 1988 18:38:25 +0000 (+0000) Subject: fix in preprocessor part: macro invocation with parameterlist on the X-Git-Tag: release-5-5~2965 X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=87c8b648fc92139cbe9e57c108c4588f88ce0e59;p=ack.git fix in preprocessor part: macro invocation with parameterlist on the next line did not work --- diff --git a/lang/cem/cemcom/domacro.c b/lang/cem/cemcom/domacro.c index b2f2ea955..ee5288384 100644 --- a/lang/cem/cemcom/domacro.c +++ b/lang/cem/cemcom/domacro.c @@ -288,7 +288,7 @@ do_define() LoadChar(ch); } /* read the replacement text if there is any */ - ch = skipspaces(ch); /* find first character of the text */ + ch = skipspaces(ch,0); /* find first character of the text */ ASSERT(ch != EOI); if (class(ch) == STNL) { /* Treat `#define something' as `#define something ""' @@ -415,7 +415,7 @@ getparams(buf, parbuf) register char **pbuf2; LoadChar(c); - c = skipspaces(c); + c = skipspaces(c,0); if (c == ')') { /* no parameters: #define name() */ *pbuf = (char *) 0; return 0; @@ -448,7 +448,7 @@ getparams(buf, parbuf) } pbuf++; - c = skipspaces(c); + c = skipspaces(c,0); if (c == ')') { /* end of the formal parameter list */ *pbuf = (char *) 0; return pbuf - buf; @@ -458,7 +458,7 @@ getparams(buf, parbuf) return -1; } LoadChar(c); - c = skipspaces(c); + c = skipspaces(c,0); } /*NOTREACHED*/ } diff --git a/lang/cem/cemcom/replace.c b/lang/cem/cemcom/replace.c index dafa2fa2a..82af873b9 100644 --- a/lang/cem/cemcom/replace.c +++ b/lang/cem/cemcom/replace.c @@ -68,7 +68,7 @@ replace(idef) return 0; } LoadChar(c); - c = skipspaces(c); + c = skipspaces(c,1); if (c != '(') { /* no replacement if no () */ lexerror("(warning) macro %s needs arguments", idef->id_text); diff --git a/lang/cem/cemcom/skip.c b/lang/cem/cemcom/skip.c index cac355383..53b231203 100644 --- a/lang/cem/cemcom/skip.c +++ b/lang/cem/cemcom/skip.c @@ -14,14 +14,14 @@ #ifndef NOPP PRIVATE int -skipspaces(ch) +skipspaces(ch, skipnl) register int ch; { /* skipspaces() skips any white space and returns the first non-space character. */ for (;;) { - while (class(ch) == STSKIP) + while (class(ch) == STSKIP || (skipnl && class(ch) == STNL)) LoadChar(ch); /* How about "\\\n"????????? */ diff --git a/util/cpp/domacro.c b/util/cpp/domacro.c index aa8cd716f..2e84e4192 100644 --- a/util/cpp/domacro.c +++ b/util/cpp/domacro.c @@ -307,7 +307,7 @@ do_define() LoadChar(ch); } /* read the replacement text if there is any */ - ch = skipspaces(ch); /* find first character of the text */ + ch = skipspaces(ch,0); /* find first character of the text */ assert(ch != EOI); if (class(ch) == STNL) { /* Treat `#define something' as `#define something ""' @@ -463,7 +463,7 @@ getparams(buf, parbuf) register char **pbuf2; LoadChar(c); - c = skipspaces(c); + c = skipspaces(c,0); if (c == ')') { /* no parameters: #define name() */ *pbuf = (char *) 0; return 0; @@ -496,7 +496,7 @@ getparams(buf, parbuf) } pbuf++; - c = skipspaces(c); + c = skipspaces(c,0); if (c == ')') { /* end of the formal parameter list */ *pbuf = (char *) 0; return pbuf - buf; @@ -506,7 +506,7 @@ getparams(buf, parbuf) return -1; } LoadChar(c); - c = skipspaces(c); + c = skipspaces(c,0); } /*NOTREACHED*/ } diff --git a/util/cpp/replace.c b/util/cpp/replace.c index 36cfafac7..9299cdb99 100644 --- a/util/cpp/replace.c +++ b/util/cpp/replace.c @@ -64,7 +64,7 @@ replace(idef) return 0; } LoadChar(c); - c = skipspaces(c); + c = skipspaces(c,1); if (c != '(') { /* no replacement if no () */ error("macro %s needs arguments", idef->id_text); diff --git a/util/cpp/skip.c b/util/cpp/skip.c index 641b3ef9a..42a6697a3 100644 --- a/util/cpp/skip.c +++ b/util/cpp/skip.c @@ -10,7 +10,7 @@ #include "input.h" int -skipspaces(ch) +skipspaces(ch, skipnl) register int ch; { /* skipspaces() skips any white space and returns the first @@ -19,6 +19,11 @@ skipspaces(ch) for (;;) { while (class(ch) == STSKIP) LoadChar(ch); + if (skipnl && class(ch) == STNL) { + LoadChar(ch); + ++LineNumber; + continue; + } /* How about "\\\n"????????? */ if (ch == '/') { LoadChar(ch);