|
From: | Akim Demaille |
Subject: | Re: [PATCH] Miscellaneous code readability improvements. |
Date: | Fri, 14 Aug 2009 13:51:57 +0200 |
Le 13 août 09 à 21:11, Akim Demaille a écrit :
I think it should be+ complain_at (*loc, _("unrecognized escape sequence: `\\ %s'"), yytext +1);to cope with \ followed by a non printable character (including \n).I'm not sure what you're going for. As far as I can tell, that just movesthe "\" from the argument to the format string. A following special character like newline still prints as a newline.Sorry Joel, I meant to restore the call to quote on yytext + 1.
But that's not nice, since in the case of a non printable character, say \n, we would display
`\\n'which is very misleading. GCC seems to decide to issue the initial backslash when the culprit is printable, otherwise it converts the non- printable character into octal and pretends that the octal sequence was used, but it does not print the initial backslash:
const char *cp = "\z\é\ ";
gives:
foo.cc:2:1: warning: unknown escape sequence '\z' foo.cc:2:1: warning: unknown escape sequence: '\303' foo.cc:2:1: warning: unknown escape sequence: '\040'
(the inconsistency on the colon looks like an error to me, it's been a long time since I last filed a bug report about gcc ;).
Maybe we need to get rid of the backslash from the culprit part: invalid character for \-escape: `z' invalid character for \-escape: `\n' ?
[Prev in Thread] | Current Thread | [Next in Thread] |