We have seen several regressions and PRs with respect to this. It is possible to workaround this by using: /* { dg-bogus "message.*message" } */ /* { dg-warning "message" "" { target *-*-* } 1 } */ However, the test must be alone in one file. Otherwise, strange things may happen. This is obviously very cumbersome and not practical in the long run.
It seems that /* { dg-warning "xxxx" "" } */ Is eating all lines where xxxx occurs together with the line on which the warning is declared. Otherwise, we'd get an excess errors (which would be perfectly fine as a way of detecting this). you can't even do this: line-with-dup-warning // { dg-warning "match-text" "" } // { dg-warning "match-text" "" { target *-*-* } last-line-no }
The reason is the regexp that dejagnu uses to match the output /usr/share/dejagnu/dg.exp # Remove all error messages for the line [lindex $i 0] # in the source file. If we find any, success! set line [lindex $i 0] set pattern [lindex $i 2] set comment [lindex $i 3] #send_user "Before:\n$comp_output\n" if {[regsub -all "(^|\n)(\[^\n\]+$line\[^\n\]*($pattern)\[^\n\]*\n?)+" $comp_output "\n" comp_output]} { set comp_output [string trimleft $comp_output] set ok pass set uhoh fail } else { set ok fail set uhoh pass } It would be nice if this were configurable or if we could override it.
(In reply to comment #2) > The reason is the regexp that dejagnu uses to match the output > /usr/share/dejagnu/dg.exp ... > It would be nice if this were configurable or if we could override it. yeah - I've just found another gotcha I want to test for warning: foo but not warning: foo bar. I can't do that with: /* { dg-warning "foo" ... /* { dg-bogus "bar" "" { target ... is there another way?
Subject: Re: Testsuite cannot detect duplicated error/warning messages > > is there another way? In this case, I think this will work: /* { dg-bogus "foo bar" } */ /* { dg-warning "foo" } */ no? Cheers, Manuel.
(In reply to comment #4) > Subject: Re: Testsuite cannot detect duplicated > error/warning messages > In this case, I think this will work: > > /* { dg-bogus "foo bar" } */ /* { dg-warning "foo" } */ > > no? well, apparently not ; with two comments on one line I get a dg error. If I put them on consecutive lines.. In the case that both tests pass - all is OK. in the case that the dg-bogus test fails the second test also fails - I guess dg-bogus eats output lines like warning does.