diff options
Diffstat (limited to 'libcpp/macro.c')
-rw-r--r-- | libcpp/macro.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/libcpp/macro.c b/libcpp/macro.c index de18c2210cf..fab1cb051dc 100644 --- a/libcpp/macro.c +++ b/libcpp/macro.c @@ -502,13 +502,21 @@ cpp_quote_string (uchar *dest, const uchar *src, unsigned int len) { uchar c = *src++; - if (c == '\\' || c == '"') + switch (c) { + case '\n': + /* Naked LF can appear in raw string literals */ + c = 'n'; + /* FALLTHROUGH */ + + case '\\': + case '"': *dest++ = '\\'; + /* FALLTHROUGH */ + + default: *dest++ = c; } - else - *dest++ = c; } return dest; |