From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21270 invoked by alias); 21 Jun 2005 17:55:51 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 21251 invoked by uid 22791); 21 Jun 2005 17:55:47 -0000 Received: from admin.voldemort.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.9) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Tue, 21 Jun 2005 17:55:47 +0000 Received: (qmail 19459 invoked from network); 21 Jun 2005 17:55:44 -0000 Received: from localhost (HELO digraph.polyomino.org.uk) (joseph@127.0.0.1) by mail.codesourcery.com with DES-CBC3-SHA encrypted SMTP; 21 Jun 2005 17:55:44 -0000 Received: from jsm28 (helo=localhost) by digraph.polyomino.org.uk with local-esmtp (Exim 4.51) id 1DkmyM-0004c5-Q9; Tue, 21 Jun 2005 17:55:42 +0000 Date: Tue, 21 Jun 2005 17:55:00 -0000 From: "Joseph S. Myers" X-X-Sender: jsm28@digraph.polyomino.org.uk To: Feng Wang cc: fortran@gcc.gnu.org, gcc@gcc.gnu.org Subject: Re: How to write testcase with two warnings on one line? In-Reply-To: <20050621142135.17517.qmail@web15609.mail.cnb.yahoo.com> Message-ID: References: <20050621142135.17517.qmail@web15609.mail.cnb.yahoo.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-SW-Source: 2005-06/txt/msg00952.txt.bz2 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)