On Tue, 21 Jun 2005, Feng Wang wrote: > Hi, > > I want to write a testcase. The compiler gives two separated warnings on one > statement. How to write this with Dejagnu? > > I tried: > { dg-warning "Warning1" "Warning2" } > and > { dg-warning "Warning1" 8} > { dg-warning "Warning2" 8} > 8 is the line number of the statment.
The correct way of writing warning tests with a line number is { dg-warning "warning" } (on original line, no number needed) { dg-warning "warning 2" "description" { target *-*-* } 8 } (for each other warning) The description is needed and needs to be nonempty and distinct for the second and subsequent warnings on a given line, because it is used to form the distinct test assertion names which appear after PASS or FAIL in the .sum files - having multiple tests with the same name causes ambiguity for regression testers. Listing the warnings separately like this is preferable to using a regular expression which matches both warnings because this way you detect if just one of the warnings disappears. -- Joseph S. Myers http://www.srcf.ucam.org/~jsm28/gcc/ [EMAIL PROTECTED] (personal mail) [EMAIL PROTECTED] (CodeSourcery mail) [EMAIL PROTECTED] (Bugzilla assignments and CCs)