dg-error having two regexes

Akshat Garg xkspr7@gmail.com
Tue Aug 13 13:02:00 GMT 2019


On Tue, Aug 13, 2019 at 5:38 PM Jonathan Wakely <jwakely.gcc@gmail.com>
wrote:

> On Tue, 13 Aug 2019 at 12:37, Jonathan Wakely wrote:
> >
> > On Tue, 13 Aug 2019 at 05:23, Akshat Garg <xkspr7@gmail.com> wrote:
> > >
> > > Hi,
> > > I have been trying to make a test case for testsuite. In some
> statements, I
> > > am getting two errors. The other error I am getting is
> > > error: ISO C90 does not support 'long long'
> > >
> > > Can somebody help me how to write dg-error having two regexes or is
> there
> > > any dg-option that can suppress these errors?  I am making the test
> for C2x.
> >
> > Do you actually care about the "long long" error? In other words, is
> > checking for that error part of the purpose of the testcase?
> >
> > If not, you can just suppress it, with either:
> >
> > { dg-prune-output "ISO C90 does not support 'long long'" }
>
Thank you for your reply. I am testing a new type qualifier on different
types like int, float, _Bool, etc. Therefore, I actually don't care about
the ISO error. But I have many ISO errors for different types like "long
long", complex, boolean types. So, should I add these lines for each type
or can we skip it with some regex?

> >
> > or:
> >
> > { dg-excess-errors "" }
>
I want to see what other errors are there. Therefore, it won't help me.

> >
> > (The first one will prune matching lines from the output, the latter
> > will ignore **all** errors that aren't already matched by a dg-error
> > line, which might hide other problems in the testcase).
> >
> > If checking for that error is part of the test then you can either
> > make the regex match it (it's a regex, so it can match multiple
> > things):
> >
> > { dg-error "foo bar|ISO C90 does not support 'long long" }
> >
> > Or you can add a second dg-error directive that expects the string to
> > match the previous line, using arelative  line number of -1:
> >
> > { dg-error "ISO C90 does not support 'long long'" "" { target *-*-* } -1
> }
>
> Actually I think for a relative line number it needs to have a dot
> first, i.e. .-1
>
>
>
> >
> > See
> https://gcc.gnu.org/onlinedocs/gccint/Directives.html#Verify-compiler-messages
> > for more information on these directives.
>



More information about the Gcc-help mailing list