On Tue, 13 Aug 2019 at 12:37, Jonathan Wakely wrote: > > On Tue, 13 Aug 2019 at 05:23, Akshat Garg <xkspr7@xxxxxxxxx> 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'" } > > or: > > { dg-excess-errors "" } > > (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.