Fixed preprocessor problem with empty macro bodies
This commit is contained in:
parent
12f4a430b0
commit
dab38becd4
2 changed files with 8 additions and 4 deletions
|
@ -171,7 +171,9 @@ expand_macro(repl, idf)
|
||||||
three tokens: + + ID. Therefore a token separator is
|
three tokens: + + ID. Therefore a token separator is
|
||||||
inserted after the replacement.
|
inserted after the replacement.
|
||||||
*/
|
*/
|
||||||
if (*(repl->r_ptr - 1) != TOKSEP) add2repl(repl, TOKSEP);
|
if (repl->r_text == repl->r_ptr || *(repl->r_ptr - 1) != TOKSEP) {
|
||||||
|
add2repl(repl, TOKSEP);
|
||||||
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -665,7 +667,7 @@ macro2buffer(repl, idf, args)
|
||||||
while (*q)
|
while (*q)
|
||||||
add2repl(repl, *q++);
|
add2repl(repl, *q++);
|
||||||
|
|
||||||
if (*(repl->r_ptr - 1) != TOKSEP)
|
if (repl->r_text == repl->r_ptr || *(repl->r_ptr - 1) != TOKSEP)
|
||||||
add2repl(repl, TOKSEP);
|
add2repl(repl, TOKSEP);
|
||||||
} else {
|
} else {
|
||||||
add2repl(repl, *ptr++);
|
add2repl(repl, *ptr++);
|
||||||
|
|
|
@ -160,7 +160,9 @@ expand_macro(repl, idf)
|
||||||
three tokens: + + ID. Therefore a token separator is
|
three tokens: + + ID. Therefore a token separator is
|
||||||
inserted after the replacement.
|
inserted after the replacement.
|
||||||
*/
|
*/
|
||||||
if (*(repl->r_ptr -1) != TOKSEP) add2repl(repl, TOKSEP);
|
if (repl->r_text == repl->r_ptr || *(repl->r_ptr -1) != TOKSEP) {
|
||||||
|
add2repl(repl, TOKSEP);
|
||||||
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -651,7 +653,7 @@ macro2buffer(repl, idf, args)
|
||||||
while (*q)
|
while (*q)
|
||||||
add2repl(repl, *q++);
|
add2repl(repl, *q++);
|
||||||
|
|
||||||
if (*(repl->r_ptr-1) != TOKSEP)
|
if (repl->r_text == repl->r_ptr || *(repl->r_ptr-1) != TOKSEP)
|
||||||
add2repl(repl, TOKSEP);
|
add2repl(repl, TOKSEP);
|
||||||
} else {
|
} else {
|
||||||
add2repl(repl, *ptr++);
|
add2repl(repl, *ptr++);
|
||||||
|
|
Loading…
Add table
Reference in a new issue