* How to write testcase with two warnings on one line?
@ 2005-06-21 14:21 Feng Wang
2005-06-21 14:33 ` Tobias.Schlueter
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Feng Wang @ 2005-06-21 14:21 UTC (permalink / raw)
To: fortran, gcc
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=gb2312, Size: 700 bytes --]
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.
But alwarys get excess errors.
The testcase is used to test one patch for gfortran. Sorry have no more
concrete program for this question.
Best Regards,
Feng Wang
--
Creative Compiler Research Group,
National University of Defense Technology, China.
___________________________________________________________
ÑÅ»¢Ãâ·ÑGÓÊÏä£No.1µÄ·À¶¾·ÀÀ¬»ø³¬´óÓÊÏä
http://cn.mail.yahoo.com/?id=77072
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: How to write testcase with two warnings on one line?
2005-06-21 14:21 How to write testcase with two warnings on one line? Feng Wang
@ 2005-06-21 14:33 ` Tobias.Schlueter
2005-06-21 14:54 ` 回复: " Feng Wang
2005-06-21 16:04 ` Giovanni Bajo
2005-06-21 17:55 ` Joseph S. Myers
2 siblings, 1 reply; 6+ messages in thread
From: Tobias.Schlueter @ 2005-06-21 14:33 UTC (permalink / raw)
To: Feng Wang; +Cc: fortran, gcc
Quoting Feng Wang <wf_cs@yahoo.com>:
> Hi,
>
> I want to write a testcase. The compiler gives two separated warnings on one
> statement. How to write this with Dejagnu?
I don't think this is possible if both warnings are issued for the same location
(which is probably not something we want). If the loci are different, it is
possible to split the line between the warnings and then proceed as usual, say:
do_first_thing & ! { dg-warning "a" }
& do_second_thing ! { dg-warning "b" }
IIRC there are testcases that do just that.
HTH,
- Tobi
^ permalink raw reply [flat|nested] 6+ messages in thread
* 回复: Re: How to write testcase with two warnings on one line?
2005-06-21 14:33 ` Tobias.Schlueter
@ 2005-06-21 14:54 ` Feng Wang
0 siblings, 0 replies; 6+ messages in thread
From: Feng Wang @ 2005-06-21 14:54 UTC (permalink / raw)
To: Tobias.Schlueter; +Cc: fortran, gcc
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=gb2312, Size: 792 bytes --]
--- Tobias.Schlueter@Physik.Uni-Muenchen.DEдµÀ:
> Quoting Feng Wang <wf_cs@yahoo.com>:
>
> > Hi,
> >
> > I want to write a testcase. The compiler gives two separated warnings on
> one
> > statement. How to write this with Dejagnu?
>
> If the loci are different, it is
> possible to split the line between the warnings and then proceed as usual,
> say:
> do_first_thing & ! { dg-warning "a" }
> & do_second_thing ! { dg-warning "b" }
>
This is ok. Thanks, Tobi.
Best Regards,
Feng Wang
--
Creative Compiler Research Group,
National University of Defense Technology, China.
___________________________________________________________
ÑÅ»¢Ãâ·ÑGÓÊÏä£ÖйúµÚÒ»¾øÎÞÀ¬»øÓʼþɧÈų¬´óÓÊÏä
http://cn.mail.yahoo.com/?id=77071
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: How to write testcase with two warnings on one line?
2005-06-21 14:21 How to write testcase with two warnings on one line? Feng Wang
2005-06-21 14:33 ` Tobias.Schlueter
@ 2005-06-21 16:04 ` Giovanni Bajo
2005-06-21 17:55 ` Joseph S. Myers
2 siblings, 0 replies; 6+ messages in thread
From: Giovanni Bajo @ 2005-06-21 16:04 UTC (permalink / raw)
To: Feng Wang; +Cc: gcc
Feng Wang <wf_cs@yahoo.com> wrote:
> I want to write a testcase. The compiler gives two separated warnings on
one
> statement. How to write this with Dejagnu?
http://gcc.gnu.org/wiki/HowToPrepareATestcase
--
Giovanni Bajo
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: How to write testcase with two warnings on one line?
2005-06-21 14:21 How to write testcase with two warnings on one line? Feng Wang
2005-06-21 14:33 ` Tobias.Schlueter
2005-06-21 16:04 ` Giovanni Bajo
@ 2005-06-21 17:55 ` Joseph S. Myers
2005-06-22 1:55 ` Feng Wang
2 siblings, 1 reply; 6+ messages in thread
From: Joseph S. Myers @ 2005-06-21 17:55 UTC (permalink / raw)
To: Feng Wang; +Cc: fortran, gcc
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/
jsm@polyomino.org.uk (personal mail)
joseph@codesourcery.com (CodeSourcery mail)
jsm28@gcc.gnu.org (Bugzilla assignments and CCs)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: How to write testcase with two warnings on one line?
2005-06-21 17:55 ` Joseph S. Myers
@ 2005-06-22 1:55 ` Feng Wang
0 siblings, 0 replies; 6+ messages in thread
From: Feng Wang @ 2005-06-22 1:55 UTC (permalink / raw)
To: Joseph S. Myers; +Cc: fortran, gcc, rasky
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=gb2312, Size: 1544 bytes --]
--- "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
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2005-06-22 1:55 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-21 14:21 How to write testcase with two warnings on one line? Feng Wang
2005-06-21 14:33 ` Tobias.Schlueter
2005-06-21 14:54 ` 回复: " Feng Wang
2005-06-21 16:04 ` Giovanni Bajo
2005-06-21 17:55 ` Joseph S. Myers
2005-06-22 1:55 ` Feng Wang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).