This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Escape sequence/parse errors
On Wed, Sep 06, 2000 at 08:45:51PM +0200, Philipp Thomas wrote:
> * Michael Vance (briareos@lokigames.com) [20000906 20:33]:
>
> > #line 2 "console\yyparse.c"
>
> > escape.cc:1: unknown escape sequence `\y'
> >
> > Anyway to turn this sort of error off? egcs 1.1.2 compiles without
> > error.
>
> I'll have to let people like Zack comment on this, but it's obviously
> misinterpreting the path name.
This is a dark corner of the standard. I don't like it much, but:
#include "dir\name.h" /* undefined behavior */
#line 1 "dir\name.h" /* string contains a newline */
The string literal of #line is a string-literal, not a header-name, so
we're required to interpret escapes. See C99 6.10.4 para 4, compare
with 6.10.2 para 3; also see 6.4.5 for the definition of a
string-literal and 6.4.7 for the definition of a header-name.
You shouldn't use \ in #include either: "sequences of characters that
resemble escape sequences cause undefined behavior."
I believe the error will become a warning with -fpermissive.
> I'd say bison should never have used '\' in the path but rather
> '/'. AFAIK there's no way to turn off that error but either fix the
> generated file or bison.
Yep. (Or fix the C standard, then we'll change GCC. :)
zw