From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17757 invoked by alias); 3 Jun 2014 16:02:05 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 17743 invoked by uid 89); 3 Jun 2014 16:02:03 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 03 Jun 2014 16:02:03 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s53G21EB026192 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 3 Jun 2014 12:02:01 -0400 Received: from redhat.com (ovpn-116-106.ams2.redhat.com [10.36.116.106]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s53G1vcQ010487 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NO); Tue, 3 Jun 2014 12:02:00 -0400 Date: Tue, 03 Jun 2014 16:02:00 -0000 From: Marek Polacek To: GCC Patches Cc: "Joseph S. Myers" Subject: [C PATCH] Use inform for "shadowed decl" (PR c/48062) Message-ID: <20140603160157.GE29196@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-SW-Source: 2014-06/txt/msg00250.txt.bz2 For "shadowed declaration" note we were calling warning_at, while we should use inform. Regtested/bootstrapped on x86_64-linux, ok for trunk? 2014-06-03 Marek Polacek PR c/48062 * c-decl.c (warn_if_shadowing): Call inform instead of warning_at. * gcc.dg/Wshadow-1.c: Use dg-message for "shadowed declaration". * gcc.dg/Wshadow-3.c: Likewise. diff --git gcc/c/c-decl.c gcc/c/c-decl.c index dc8dbc2..05ab20e 100644 --- gcc/c/c-decl.c +++ gcc/c/c-decl.c @@ -2635,8 +2635,8 @@ warn_if_shadowing (tree new_decl) warning (OPT_Wshadow, "declaration of %q+D shadows a previous local", new_decl); - warning_at (DECL_SOURCE_LOCATION (old_decl), OPT_Wshadow, - "shadowed declaration is here"); + inform (DECL_SOURCE_LOCATION (old_decl), + "shadowed declaration is here"); break; } diff --git gcc/testsuite/gcc.dg/Wshadow-1.c gcc/testsuite/gcc.dg/Wshadow-1.c index 40073f3..6075711 100644 --- gcc/testsuite/gcc.dg/Wshadow-1.c +++ gcc/testsuite/gcc.dg/Wshadow-1.c @@ -5,7 +5,7 @@ /* Source: Neil Booth, 5 Dec 2001. */ -int decl1; /* { dg-warning "shadowed declaration" } */ +int decl1; /* { dg-message "shadowed declaration" } */ void foo (double decl1) /* { dg-warning "shadows a global decl" } */ { } @@ -16,7 +16,7 @@ void foo1 (int d) /* { dg-message "note: previous definition" } */ /* { dg-error "redeclared as different" "" { target *-*-* } 15 } */ } -void foo2 (int d) /* { dg-warning "shadowed declaration" } */ +void foo2 (int d) /* { dg-message "shadowed declaration" } */ { { double d; /* { dg-warning "shadows a parameter" } */ @@ -25,7 +25,7 @@ void foo2 (int d) /* { dg-warning "shadowed declaration" } */ void foo3 () { - int local; /* { dg-warning "shadowed declaration" } */ + int local; /* { dg-message "shadowed declaration" } */ { int local; /* { dg-warning "shadows a previous local" } */ } diff --git gcc/testsuite/gcc.dg/Wshadow-3.c gcc/testsuite/gcc.dg/Wshadow-3.c index a7f06a2..ce2879c 100644 --- gcc/testsuite/gcc.dg/Wshadow-3.c +++ gcc/testsuite/gcc.dg/Wshadow-3.c @@ -5,7 +5,7 @@ /* { dg-do compile } */ /* { dg-options "-std=gnu89 -Wshadow" } */ -int v; /* { dg-warning "shadowed declaration" } */ +int v; /* { dg-message "shadowed declaration" } */ int f1(int v); int f2(int v, int x[v]); /* { dg-warning "declaration of 'v' shadows a global declaration" } */ int f3(int v, int y[sizeof(v)]); /* { dg-warning "declaration of 'v' shadows a global declaration" } */ @@ -18,4 +18,4 @@ int f9(x) int x; { return 0; } int f10(v) { return 0; } /* { dg-warning "declaration of 'v' shadows a global declaration" } */ int f11(int a, int b(int a)); int f12(int a, int b(int a, int x[a])); /* { dg-warning "declaration of 'a' shadows a parameter" } */ -/* { dg-warning "shadowed declaration" "outer parm" { target *-*-* } 20 } */ +/* { dg-message "shadowed declaration" "outer parm" { target *-*-* } 20 } */ Marek