From patchwork Wed Feb 6 16:16:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Sebor X-Patchwork-Id: 1037617 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-495389-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 43vmmF13M1z9sLw for ; Thu, 7 Feb 2019 03:16:41 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :subject:to:message-id:date:mime-version:content-type; q=dns; s= default; b=tBfy0NATFr1+NQu5NjD4XDAvdUFgHMkw4f846gON7MAwyRPm2uEUc qQf1I5eUxtbwdwB6OcpPRTjpBQoCOcjcooN7dBMpjOpoeLI2zJCMQ2FSk90HQ2Pl JPPeM2JkW7Irx3UdkLpwr8X3HXipBCkCGDTsTB3J0KZ0/DNMeSXGRU= 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 :subject:to:message-id:date:mime-version:content-type; s= default; bh=q6ShHWFXL+QnBArKSCjqmWQoB/w=; b=MEbMpM4cg0ew+YNDqzsd Bq8JtE6jD9IgcZdiLoDrhze7RhAd7NxZLPWndf51or3CmC5hvD1DBmrRtRDkSJ1e c6RDRQ0I0fFyLqNSjBWg2ON7Q6iBYhadZiKATei1a5o8vlW0J2E35fK9hS8lBW/I NxdwcWMqo2jXTvYX4Ji5W40= Received: (qmail 85716 invoked by alias); 6 Feb 2019 16:16:34 -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 85707 invoked by uid 89); 6 Feb 2019 16:16:34 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-16.9 required=5.0 tests=BAYES_00, FREEMAIL_FROM, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=absence, documents X-HELO: mail-qt1-f172.google.com Received: from mail-qt1-f172.google.com (HELO mail-qt1-f172.google.com) (209.85.160.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 06 Feb 2019 16:16:32 +0000 Received: by mail-qt1-f172.google.com with SMTP id o6so2078378qtk.6 for ; Wed, 06 Feb 2019 08:16:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:subject:to:message-id:date:user-agent:mime-version :content-language; bh=0eQr56be/pmKHg0IbOh5GQ7LhfR9cr4AP8UU8BANi4E=; b=l3L7Ya++bLtyJiQqni1YDwJRYJZ2R+tBPHlJ9oKL9aOmANytqetzzLEmFZOCTgqdjt Y+wqy0V8CsOf38DhzF2GXQpR6OvXyGMv7oz3u3I0RSehgkqvgziqaxzFDjwhIeiCEJGx VyEj5skHgwfwOJ83zBp6nVwp94X4DXWvmHTcoAerPfxYwzZDUzct+oB2PevwaLraN+pe 9ClWobuosk5lrHMOUFyOqeSrWBoJtq2FZ3LNpSC41oZtSCVQxsHcgITlyTFdeSa7BG2X wLhobfNHODNSKf+4nRBl/1cxTZAx0KWTkX/SfRC8lhH4flzrlJklzF2JMdX69fga+FbF YsHg== Received: from [192.168.0.106] (97-118-121-10.hlrn.qwest.net. [97.118.121.10]) by smtp.gmail.com with ESMTPSA id u42sm6081389qtu.39.2019.02.06.08.16.29 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Feb 2019 08:16:29 -0800 (PST) From: Martin Sebor Subject: [PATCH doc] correct/improve -Wmissing-attributes and -Wattribute-alias To: "gcc-patches@gcc.gnu.org" Message-ID: Date: Wed, 6 Feb 2019 09:16:28 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1 MIME-Version: 1.0 X-IsSubscribed: yes The manual documents the -Wno-missing-attributes form of the option as if it was enabled by default, even though it's enabled by -Wall (I can't get this -Wno- convention straight in my head). I also got private comments on the documentation of the option suggesting to add cross-references, and to list the attributes -Wattribute-alias considers (the same ones as -Wmissing-attributes). The attached patch makes these changes. Martin gcc/ChangeLog: * doc/invoke.texi (-Wmissing-attributes): Invert entry. Add cross-references. (-Wattribute-alias): Mention considered attributes (same as for -Wmissing-attributes). Index: gcc/doc/invoke.texi =================================================================== --- gcc/doc/invoke.texi (revision 268583) +++ gcc/doc/invoke.texi (working copy) @@ -5055,10 +5055,10 @@ about the layout of the file that the directive re This warning is enabled by @option{-Wall} in C and C++. -@item -Wno-missing-attributes +@item -Wmissing-attributes @opindex Wmissing-attributes @opindex Wno-missing-attributes -Warn when a declaration of a function is missing one or more attributes +Do not warn when a declaration of a function is missing one or more attributes that a related function is declared with and whose absence may adversely affect the correctness or efficiency of generated code. For example, the warning is issued for declarations of aliases that use attributes @@ -5079,6 +5079,11 @@ or @code{nonnull} is declared without it. Attribu @code{error}, and @code{warning} suppress the warning. (@pxref{Function Attributes}). +The the @code{copy} attribute provides a mechanism for applying the same +set of attributes to a declaration as that on another declaration without +explicitly enumerating the attributes. (@pxref{Function Attributes}. +@pxref{Variable Attributes}. @pxref{Variable Attributes}.) + @option{-Wmissing-attributes} is enabled by @option{-Wall}. For example, since the declaration of the primary function template @@ -6101,9 +6106,14 @@ false positives and is deactivated by default. @opindex -Wattribute-alias @opindex -Wno-attribute-alias Warn about declarations using the @code{alias} and similar attributes whose -target is incompatible with the type of the alias. +target is incompatible with the type of the alias. Attributes considered +include @code{alloc_align}, @code{alloc_size}, @code{cold}, @code{const}, +@code{hot}, @code{leaf}, @code{malloc}, @code{nonnull}, @code{noreturn}, +@code{nothrow}, @code{pure}, @code{returns_nonnull}, and @code{returns_twice}. + @xref{Function Attributes,,Declaring Attributes of Functions}. -The @option{-Wattribute-alias=1} is enabled by @option{-Wall}. +The @option{-Wattribute-alias=1} option is enabled by @option{-Wall}. +See also the related @option{-Wmissing-attributes} option. @table @gcctabopt @item -Wattribute-alias=1