From patchwork Thu Oct 3 15:16:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Edlinger X-Patchwork-Id: 1171242 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-510146-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=hotmail.de Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="fmdrsWbJ"; dkim-atps=neutral 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 46kc6q2q7Lz9sP7 for ; Fri, 4 Oct 2019 01:16:49 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:content-type:mime-version; q=dns; s= default; b=ER8kWCjU+Jq9Qbl4eRTfZC8WYRbp44AW41l3KZ45dWexrmyZGanoo etxuRSuROPjHLaRAOumN7eDUQWG6ftqkcBNuBzeYS29G1cCltSZ580vR5P05WlYc 22pJxcmLf8adfNE9LlPKhTytA6ZqK5JuvN1GmtcCca2B3/arnzOXrY= 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:from :to:subject:date:message-id:content-type:mime-version; s= default; bh=6znZXFedT5VViEWbtffIZtYq4z0=; b=fmdrsWbJSajt49X2eXTt je0scFjtqb4iqdjJBCDsrYyWF2/+c/NmocFDC+ubuXfA3lJnYc4MaYl/cpLVSBwL dI0jzjdXBHwzndj7Et+wNb1txmqjXQii6WhyToLAts+cPGpolwGZeR4ntCyQ4erD IOTY26yrEt+o21M4W4F6H80= Received: (qmail 359 invoked by alias); 3 Oct 2019 15:16:43 -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 350 invoked by uid 89); 3 Oct 2019 15:16:42 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-12.1 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.1 spammy=H*c:HHH X-HELO: EUR01-DB5-obe.outbound.protection.outlook.com Received: from mail-oln040092064087.outbound.protection.outlook.com (HELO EUR01-DB5-obe.outbound.protection.outlook.com) (40.92.64.87) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 03 Oct 2019 15:16:40 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oNsqcP1Ow29onRooUpHiS10ADlHjrDcdq5ckjdxyl0QHExPvMXqZ8jZgiUl2KcwffobAhsqttgvT/0kAkO7PLBuIyqtU/MZkJwDQyyNl1G4+D/CSKbnVsPyui1zEVEgVSS0Izenqf4PkpX18dNirUWD5wjcERQlcdt+ZNngd74x/9W5MLjVyld/zq9yISspY1AqfFjh8KzZjqU/axyv0idnOJKAis+DmKOa9VPmK8Ass52dT3rsdE4Y8jqZVrnIjvQT1czIcnU1VDPVQgxCNdEhpJtpGMZ0VfFw43XyNbc/WG7VrEQAF3ebCAt2uQ3v4WAXVCplEaiaZcIrMeYe8Rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=V0fnMLqyHJbIJMKdFawWo+xj7muRvpYkNSfveB2suHA=; b=l4Z+bvixZHn3Cz5pMHKP28MLCk8dqRWaPps5R6d2+DVp/bFM3UyW4c+fndlkkMyLE3W5F8fEFSH2v77/zMqEX833npYd0bc3r0cxOscpsbXF57r393CKvK/F6NKwCE+kz72TGUytkE3tQ4NWXGDgxVy3q/sVPMz2Sygi8ltNWg9NUIPtKFuSFhczakNwR0T95j5W3voZupbAAWsvvQo3fGnxALIXsf/dQ68skJPJE5eIORLS2EpyS5d1OllT03H2bEQHtUwytqmrwvdMICgXNDPCvWXLkdoSxGC8G+qFRonz/7F0/XXgAqd5slj/FZBZdjCa/HFqXl1b5nmjhHWU4Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none Received: from VE1EUR01FT036.eop-EUR01.prod.protection.outlook.com (10.152.2.53) by VE1EUR01HT193.eop-EUR01.prod.protection.outlook.com (10.152.3.247) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2327.20; Thu, 3 Oct 2019 15:16:36 +0000 Received: from VI1PR03MB4528.eurprd03.prod.outlook.com (10.152.2.52) by VE1EUR01FT036.mail.protection.outlook.com (10.152.3.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2327.20 via Frontend Transport; Thu, 3 Oct 2019 15:16:36 +0000 Received: from VI1PR03MB4528.eurprd03.prod.outlook.com ([fe80::1917:2b45:72b0:548a]) by VI1PR03MB4528.eurprd03.prod.outlook.com ([fe80::1917:2b45:72b0:548a%7]) with mapi id 15.20.2305.023; Thu, 3 Oct 2019 15:16:36 +0000 From: Bernd Edlinger To: "gcc-patches@gcc.gnu.org" Subject: [PATCH] Update documentation of -Wshadow Date: Thu, 3 Oct 2019 15:16:36 +0000 Message-ID: x-microsoft-original-message-id: <89d5f792-77db-1f54-5f30-6a8105bc74c4@hotmail.de> x-ms-exchange-transport-forked: True MIME-Version: 1.0 Hi, I've noticed that the documentation of -Wshadow=x has some missing bits, and I want to add an negative example to -Wshadow=compatble-local. Bootstrapped and reg-tested on x86_64-pc-linux-gnu. Is it OK for trunk? Thanks Bernd. 2019-10-03 Bernd Edlinger * doc/invoke.texi (-Wshadow=global, -Wshadow=local, -Wshadow=compatible-local): Fix description. Add an example where -Wshadow=compatible-local does not warn. Index: gcc/doc/invoke.texi =================================================================== --- gcc/doc/invoke.texi (revision 276484) +++ gcc/doc/invoke.texi (working copy) @@ -6477,13 +6477,14 @@ Do not warn whenever a local variable shadows an i Objective-C method. @item -Wshadow=global -@opindex Wshadow=local +@opindex Wshadow=global The default for @option{-Wshadow}. Warns for any (global) shadowing. +This warning is enabled by @option{-Wshadow=global}. @item -Wshadow=local @opindex Wshadow=local Warn when a local variable shadows another local variable or parameter. -This warning is enabled by @option{-Wshadow=global}. +This warning is enabled by @option{-Wshadow=local}. @item -Wshadow=compatible-local @opindex Wshadow=compatible-local @@ -6515,8 +6516,10 @@ in place of the other, type checking will catch th warning. So not warning (about shadowing) in this case will not lead to undetected bugs. Use of this flag instead of @option{-Wshadow=local} can possibly reduce the number of warnings triggered by intentional shadowing. +Note that this does also mean that shadowing @code{const char *i} by +@code{char *i} will not emit a warning. -This warning is enabled by @option{-Wshadow=local}. +This warning is enabled by @option{-Wshadow=compatible-local}. @item -Wlarger-than=@var{byte-size} @opindex Wlarger-than=