mirror of
https://github.com/cc65/cc65.git
synced 2024-11-19 21:32:19 +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:
parent
208c40eaf7
commit
e9b0009f97
@ -309,7 +309,22 @@ static void ExpandMacroArgs (Macro* M)
|
|||||||
Replacement = FindMacroArg (M, Ident);
|
Replacement = FindMacroArg (M, Ident);
|
||||||
if (Replacement) {
|
if (Replacement) {
|
||||||
keepch ('\"');
|
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 ('\"');
|
keepch ('\"');
|
||||||
} else {
|
} else {
|
||||||
keepch ('#');
|
keepch ('#');
|
||||||
|
Loading…
Reference in New Issue
Block a user