From patchwork Wed Nov 23 07:44:38 2016
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Gerald Pfeifer
X-Patchwork-Id: 698084
Return-Path:
X-Original-To: incoming@patchwork.ozlabs.org
Delivered-To: patchwork-incoming@bilbo.ozlabs.org
Received: from sourceware.org (server1.sourceware.org [209.132.180.131])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256
bits)) (No client certificate requested)
by ozlabs.org (Postfix) with ESMTPS id 3tNvWT1FHQz9t17
for ;
Wed, 23 Nov 2016 18:44:54 +1100 (AEDT)
Authentication-Results: ozlabs.org; dkim=pass (1024-bit key;
unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org
header.b="qxA2Qqoc"; dkim-atps=neutral
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id
:list-unsubscribe:list-archive:list-post:list-help:sender:date
:from:to:cc:subject:in-reply-to:message-id:references
:mime-version:content-type; q=dns; s=default; b=boOskfLNVVDruzCT
ZKa7Xsb/e/lRvIM7cEUEBPoJnXt4eZ1fKatdXOmwXZhR7u15H9kBKfE/0NKQcejA
Gr0oN6D1/ifE6mqapbJzML1HEc80RdQ1u0vxejC3H8Uzd/8O09c/FjlwqnJ//KRy
2wwwa136XJSANQilRyGlt80ztHk=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id
:list-unsubscribe:list-archive:list-post:list-help:sender:date
:from:to:cc:subject:in-reply-to:message-id:references
:mime-version:content-type; s=default; bh=0L8mAFDhHCWpg3hVhJZAKB
7RUYs=; b=qxA2QqocbLRPix2AZlLauRobLVPw7egFgUAkGebxzQYfROrFtFau3m
af+9jnckDLntNtIPvLvSJl0X6LAaa10sCiogA1znmdr1B5y6AVbC9czdWBweWu30
+UBraT5/aMjQBcPvKP9s5YgffFxtNGkef8+gWJ7mpXrzu9CzLo1AI=
Received: (qmail 39585 invoked by alias); 23 Nov 2016 07:44:47 -0000
Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id:
List-Unsubscribe:
List-Archive:
List-Post:
List-Help:
Sender: gcc-patches-owner@gcc.gnu.org
Delivered-To: mailing list gcc-patches@gcc.gnu.org
Received: (qmail 39563 invoked by uid 89); 23 Nov 2016 07:44:46 -0000
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,
RCVD_IN_DNSWL_NONE,
SPF_PASS autolearn=ham version=3.3.2 spammy=sk:compati,
H*RU:sk:ip-109-, H*r:sk:ip-109-,
Hx-spam-relays-external:sk:ip-109-
X-HELO: ainaz.pair.com
Received: from ainaz.pair.com (HELO ainaz.pair.com) (209.68.2.66) by
sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;
Wed, 23 Nov 2016 07:44:44 +0000
Received: from anthias (ip-109-43-3-148.web.vodafone.de
[109.43.3.148]) (using TLSv1.2 with cipher
ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client
certificate requested) by ainaz.pair.com (Postfix) with
ESMTPSA id EBC703F530; Wed, 23 Nov 2016 02:44:40 -0500 (EST)
Date: Wed, 23 Nov 2016 08:44:38 +0100 (CET)
From: Gerald Pfeifer
To: Mark Wielaard
cc: gcc-patches@gcc.gnu.org
Subject: Re: [www-patch] Document new -Wshadow= variants in
gcc-7/changes.html
In-Reply-To:
Message-ID:
References: <20161105215057.GA2702@stream> <20161113174557.GC29330@stream>
<1479736398.3728.15.camel@klomp.org>
MIME-Version: 1.0
X-IsSubscribed: yes
A few markup fixes on top of the committed patch that I just
applied.
Essentially must not be within and was
missing in one case.
Thanks again for providing this nice documentation!
Gerald
Index: changes.html
===================================================================
RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-7/changes.html,v
retrieving revision 1.27
retrieving revision 1.30
diff -u -r1.27 -r1.30
--- changes.html 22 Nov 2016 10:14:25 -0000 1.27
+++ changes.html 23 Nov 2016 07:38:58 -0000 1.30
@@ -131,7 +131,9 @@
shadowing variable can be converted to that of the shadowed variable).
The following example shows the different kinds of shadow
-warnings:
+warnings:
+
+
enum operation { add, count };
struct container { int nr; };
@@ -145,34 +147,41 @@
r += count.nr;
}
return r;
-}
+}
-Wshadow=compatible-local
will warn for the parameter being
-shadowed with the same type:
+shadowed with the same type:
+
+
warn-test.c:8:12: warning: declaration of 'count' shadows a parameter [-Wshadow=compatible-local]
for (int count = 0; count > 0; count--)
^~~~~
warn-test.c:5:42: note: shadowed declaration is here
container_count (struct container c, int count)
- ^~~~~
+ ^~~~~
-Wshadow=local
will warn for the above and for the shadowed
-declaration with incompatible type:
+declaration with incompatible type:
+
+
warn-test.c:10:24: warning: declaration of 'count' shadows a previous local [-Wshadow=local]
struct container count = c;
^~~~~
warn-test.c:8:12: note: shadowed declaration is here
for (int count = 0; count > 0; count--)
- ^~~~~
+ ^~~~~
-Wshadow=global
will warn for all of the above and the shadowing
-of the global declaration:
+of the global declaration:
+
+
warn-test.c:5:42: warning: declaration of 'count' shadows a global declaration [-Wshadow]
container_count (struct container c, int count)
^~~~~
warn-test.c:1:23: note: shadowed declaration is here
enum operation { add, count };
- ^~~~~
+ ^~~~~
+
C