PATCH: CPP testsuite cleanup
Mark Mitchell
mark@codesourcery.com
Mon Jun 2 20:00:00 GMT 2003
On Mon, 2003-06-02 at 12:38, Neil Booth wrote:
> Mark Mitchell wrote:-
>
> > The new version:
> >
> > { dg-final { scan-file-not cxxcom2.i "is not in C89" } }
> >
> > is considerably nicer.
>
> Cool, thanks a lot Mark. Could you explain to a mere mortal why
> you need the \\n stuff that wasn't there before, like here:
Yes. My Tcl-Fu is strong at the moment.
Before, you were using "grep" which is a DejaGNU procedure that tries to
behave like the grp program; it's line-oriented.
Now, we're using "regexp" in the guts of scan-file; that's not a
line-oriented function. And, Tcl treats "^" and "$" as meaning "the
beginning and end of the input, not a line. (There is a multi-line
regexp mode, but it is only available in recent versions of Tcl, and I
don't think we're requiring very recent versions.)
> > ! /* { dg-final { scan-file "_Pragma4.i" "(^|\\n)#pragma bar($|\\n)" } } */
>
> and then why it's different (one slash only) here:
>
> > ! /* { dg-final { scan-file cmdlne-P.i "(^|\n)int x = 1;($|\n)" } } */
It actually doesn't matter which way you write it. :-)
The "\\n" syntax expands to two characters (a backslash and an "n"),
which Tcl's regexp primitive treats as meaning a carriage-return. The
"\n" syntax expands to a carriage-return up front, which Tcl is
perfectly happy to see in a regular expression.
--
Mark Mitchell <mark@codesourcery.com>
CodeSourcery, LLC
More information about the Gcc-patches
mailing list