[Bug c++/24985] caret diagnostics

manu at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Apr 5 12:14:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24985

--- Comment #22 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2012-04-05 12:13:01 UTC ---
(In reply to comment #21)
> Created attachment 27093 [details]
> Patch to prune caret diagnostics from gcc output
> 
> Actually, this seems like a better approach: rather than disable the caret
> diagnostics, prune them from the output.  This regexp will remove any pair of
> lines where the first starts with a space and the second consists of spaces
> followed by a caret.

Unfortunately this does not work for several reasons:

* DejaGNU trims leading whitespace before passing the text to prune.
* DejaGNU matches as many lines as possible for each dg-* directive, so if you
have something in the source line printed that is matched by a dg-* directive,
the line is removed and the above regexp fails to prune the caret line.

The problem is that the default regexp of DejaGNU is:

"(^|\n)(\[^\n\]+$line\[^\n\]*($pattern)\[^\n\]*\n?)+"

the "+" at the end means that it matches as many lines as possible. It also
matches any trailing and any leading whitespace. That is, it is impossible to
tell to DejaGNU to match some line exactly.



More information about the Gcc-bugs mailing list