From dab38becd4ab94455bab9e93c6481fc127544af2 Mon Sep 17 00:00:00 2001 From: ceriel Date: Thu, 21 Feb 1991 12:08:13 +0000 Subject: [PATCH] Fixed preprocessor problem with empty macro bodies --- lang/cem/cemcom.ansi/replace.c | 6 ++++-- lang/cem/cpp.ansi/replace.c | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lang/cem/cemcom.ansi/replace.c b/lang/cem/cemcom.ansi/replace.c index 9f7a86503..28873ed94 100644 --- a/lang/cem/cemcom.ansi/replace.c +++ b/lang/cem/cemcom.ansi/replace.c @@ -171,7 +171,9 @@ expand_macro(repl, idf) three tokens: + + ID. Therefore a token separator is 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; } @@ -665,7 +667,7 @@ macro2buffer(repl, idf, args) while (*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); } else { add2repl(repl, *ptr++); diff --git a/lang/cem/cpp.ansi/replace.c b/lang/cem/cpp.ansi/replace.c index 02fcd697e..e5aa73d15 100644 --- a/lang/cem/cpp.ansi/replace.c +++ b/lang/cem/cpp.ansi/replace.c @@ -160,7 +160,9 @@ expand_macro(repl, idf) three tokens: + + ID. Therefore a token separator is 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; } @@ -651,7 +653,7 @@ macro2buffer(repl, idf, args) while (*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); } else { add2repl(repl, *ptr++); -- 2.34.1