1
0
mirror of https://github.com/cc65/cc65.git synced 2024-10-02 21:54:47 +00:00

Bug fixed: The preprocessor # operator did not work correctly with string arguments

git-svn-id: svn://svn.cc65.org/cc65/trunk@1167 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2002-03-06 07:35:20 +00:00
parent 208c40eaf7
commit e9b0009f97

View File

@ -309,7 +309,22 @@ static void ExpandMacroArgs (Macro* M)
Replacement = FindMacroArg (M, Ident);
if (Replacement) {
keepch ('\"');
keepstr (Replacement);
/* We have to escape any characters inside replacement that
* may not be part of a string unescaped.
*/
while (*Replacement) {
switch (*Replacement) {
case '\"':
case '\\':
case '\'':
keepch ('\\');
/* FALLTHROUGH */
default:
keepch (*Replacement);
break;
}
++Replacement;
}
keepch ('\"');
} else {
keepch ('#');