fix in preprocessor part: macro invocation with parameterlist on the
next line did not work
This commit is contained in:
parent
5d247a2055
commit
87c8b648fc
6 changed files with 18 additions and 13 deletions
|
@ -288,7 +288,7 @@ do_define()
|
||||||
LoadChar(ch);
|
LoadChar(ch);
|
||||||
}
|
}
|
||||||
/* read the replacement text if there is any */
|
/* 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);
|
ASSERT(ch != EOI);
|
||||||
if (class(ch) == STNL) {
|
if (class(ch) == STNL) {
|
||||||
/* Treat `#define something' as `#define something ""'
|
/* Treat `#define something' as `#define something ""'
|
||||||
|
@ -415,7 +415,7 @@ getparams(buf, parbuf)
|
||||||
register char **pbuf2;
|
register char **pbuf2;
|
||||||
|
|
||||||
LoadChar(c);
|
LoadChar(c);
|
||||||
c = skipspaces(c);
|
c = skipspaces(c,0);
|
||||||
if (c == ')') { /* no parameters: #define name() */
|
if (c == ')') { /* no parameters: #define name() */
|
||||||
*pbuf = (char *) 0;
|
*pbuf = (char *) 0;
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -448,7 +448,7 @@ getparams(buf, parbuf)
|
||||||
}
|
}
|
||||||
|
|
||||||
pbuf++;
|
pbuf++;
|
||||||
c = skipspaces(c);
|
c = skipspaces(c,0);
|
||||||
if (c == ')') { /* end of the formal parameter list */
|
if (c == ')') { /* end of the formal parameter list */
|
||||||
*pbuf = (char *) 0;
|
*pbuf = (char *) 0;
|
||||||
return pbuf - buf;
|
return pbuf - buf;
|
||||||
|
@ -458,7 +458,7 @@ getparams(buf, parbuf)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
LoadChar(c);
|
LoadChar(c);
|
||||||
c = skipspaces(c);
|
c = skipspaces(c,0);
|
||||||
}
|
}
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,7 @@ replace(idef)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
LoadChar(c);
|
LoadChar(c);
|
||||||
c = skipspaces(c);
|
c = skipspaces(c,1);
|
||||||
if (c != '(') { /* no replacement if no () */
|
if (c != '(') { /* no replacement if no () */
|
||||||
lexerror("(warning) macro %s needs arguments",
|
lexerror("(warning) macro %s needs arguments",
|
||||||
idef->id_text);
|
idef->id_text);
|
||||||
|
|
|
@ -14,14 +14,14 @@
|
||||||
|
|
||||||
#ifndef NOPP
|
#ifndef NOPP
|
||||||
PRIVATE int
|
PRIVATE int
|
||||||
skipspaces(ch)
|
skipspaces(ch, skipnl)
|
||||||
register int ch;
|
register int ch;
|
||||||
{
|
{
|
||||||
/* skipspaces() skips any white space and returns the first
|
/* skipspaces() skips any white space and returns the first
|
||||||
non-space character.
|
non-space character.
|
||||||
*/
|
*/
|
||||||
for (;;) {
|
for (;;) {
|
||||||
while (class(ch) == STSKIP)
|
while (class(ch) == STSKIP || (skipnl && class(ch) == STNL))
|
||||||
LoadChar(ch);
|
LoadChar(ch);
|
||||||
|
|
||||||
/* How about "\\\n"????????? */
|
/* How about "\\\n"????????? */
|
||||||
|
|
|
@ -307,7 +307,7 @@ do_define()
|
||||||
LoadChar(ch);
|
LoadChar(ch);
|
||||||
}
|
}
|
||||||
/* read the replacement text if there is any */
|
/* 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);
|
assert(ch != EOI);
|
||||||
if (class(ch) == STNL) {
|
if (class(ch) == STNL) {
|
||||||
/* Treat `#define something' as `#define something ""'
|
/* Treat `#define something' as `#define something ""'
|
||||||
|
@ -463,7 +463,7 @@ getparams(buf, parbuf)
|
||||||
register char **pbuf2;
|
register char **pbuf2;
|
||||||
|
|
||||||
LoadChar(c);
|
LoadChar(c);
|
||||||
c = skipspaces(c);
|
c = skipspaces(c,0);
|
||||||
if (c == ')') { /* no parameters: #define name() */
|
if (c == ')') { /* no parameters: #define name() */
|
||||||
*pbuf = (char *) 0;
|
*pbuf = (char *) 0;
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -496,7 +496,7 @@ getparams(buf, parbuf)
|
||||||
}
|
}
|
||||||
|
|
||||||
pbuf++;
|
pbuf++;
|
||||||
c = skipspaces(c);
|
c = skipspaces(c,0);
|
||||||
if (c == ')') { /* end of the formal parameter list */
|
if (c == ')') { /* end of the formal parameter list */
|
||||||
*pbuf = (char *) 0;
|
*pbuf = (char *) 0;
|
||||||
return pbuf - buf;
|
return pbuf - buf;
|
||||||
|
@ -506,7 +506,7 @@ getparams(buf, parbuf)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
LoadChar(c);
|
LoadChar(c);
|
||||||
c = skipspaces(c);
|
c = skipspaces(c,0);
|
||||||
}
|
}
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ replace(idef)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
LoadChar(c);
|
LoadChar(c);
|
||||||
c = skipspaces(c);
|
c = skipspaces(c,1);
|
||||||
if (c != '(') { /* no replacement if no () */
|
if (c != '(') { /* no replacement if no () */
|
||||||
error("macro %s needs arguments",
|
error("macro %s needs arguments",
|
||||||
idef->id_text);
|
idef->id_text);
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
|
|
||||||
int
|
int
|
||||||
skipspaces(ch)
|
skipspaces(ch, skipnl)
|
||||||
register int ch;
|
register int ch;
|
||||||
{
|
{
|
||||||
/* skipspaces() skips any white space and returns the first
|
/* skipspaces() skips any white space and returns the first
|
||||||
|
@ -19,6 +19,11 @@ skipspaces(ch)
|
||||||
for (;;) {
|
for (;;) {
|
||||||
while (class(ch) == STSKIP)
|
while (class(ch) == STSKIP)
|
||||||
LoadChar(ch);
|
LoadChar(ch);
|
||||||
|
if (skipnl && class(ch) == STNL) {
|
||||||
|
LoadChar(ch);
|
||||||
|
++LineNumber;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
/* How about "\\\n"????????? */
|
/* How about "\\\n"????????? */
|
||||||
if (ch == '/') {
|
if (ch == '/') {
|
||||||
LoadChar(ch);
|
LoadChar(ch);
|
||||||
|
|
Loading…
Add table
Reference in a new issue