public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Joseph S. Myers" <joseph@codesourcery.com>
To: Feng Wang <wf_cs@yahoo.com>
Cc: fortran@gcc.gnu.org, gcc@gcc.gnu.org
Subject: Re: How to write testcase with two warnings on one line?
Date: Tue, 21 Jun 2005 17:55:00 -0000	[thread overview]
Message-ID: <Pine.LNX.4.61.0506211751380.14695@digraph.polyomino.org.uk> (raw)
In-Reply-To: <20050621142135.17517.qmail@web15609.mail.cnb.yahoo.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.

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)

  parent reply	other threads:[~2005-06-21 17:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-21 14:21 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 [this message]
2005-06-22  1:55   ` Feng Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.61.0506211751380.14695@digraph.polyomino.org.uk \
    --to=joseph@codesourcery.com \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc@gcc.gnu.org \
    --cc=wf_cs@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).