This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How to write testcase with two warnings on one line?


--- "Joseph S. Myers" <joseph@codesourcery.com>写道:

> 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.
> 
This is ok. Thanks. And add one point, { target *-*-* } is also needed even we
test on all target. If we give the line number, the target is needed. This is
not mentioned in http://gcc.gnu.org/wiki/HowToPrepareATestcase . Maybe the page
need updating.


Best Regards,
Feng Wang

--
Creative Compiler Research Group,
National University of Defense Technology, China.


	

	
		
___________________________________________________________ 
雅虎免费G邮箱-中国第一绝无垃圾邮件骚扰超大邮箱
http://cn.mail.yahoo.com/?id=77071


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]