From da0fd87adf99893833f1c40e8a64802e5a1998a1 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Mon, 5 Nov 2018 00:21:56 +0100 Subject: [PATCH] xgettext: C: Treat invalid escape sequences like GCC does. * gettext-tools/src/x-c.c (phase7_getc): For invalid escape sequences "\c", produce c, not a backslash. --- gettext-tools/src/x-c.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/gettext-tools/src/x-c.c b/gettext-tools/src/x-c.c index 0d43fc8d2..a81b85101 100644 --- a/gettext-tools/src/x-c.c +++ b/gettext-tools/src/x-c.c @@ -1028,11 +1028,8 @@ phase7_getc () switch (c) { default: - /* Unknown escape sequences really should be an error, but just - ignore them, and let the real compiler complain. */ - phase3_ungetc (c); - return '\\'; - + /* Invalid escape sequences generate a GCC warning, and GCC transforms + \c to the character c. So let's do the same. */ case '"': case '\'': case '?': -- 2.47.3