From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 44160 invoked by alias); 3 Jan 2019 22:10:37 -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 44125 invoked by uid 89); 3 Jan 2019 22:10:36 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=oversight, synonymous, leaf, tweaks X-HELO: mail-qt1-f196.google.com Received: from mail-qt1-f196.google.com (HELO mail-qt1-f196.google.com) (209.85.160.196) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 03 Jan 2019 22:10:34 +0000 Received: by mail-qt1-f196.google.com with SMTP id l12so38508977qtf.8 for ; Thu, 03 Jan 2019 14:10:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:from:to:references:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=tvNXpreIrZaVaeAmGcNx7jfL2H3S9/3JJ86fAcV25J8=; b=SWc4/9OJVEkqi7WoYm/Mi8AmdFF52UlPCHNNiofAHDyRWmP/G30+2z6IWN6UCel2Jh v63/lqXfaSWB7DvY7UNahA/jVyPiEQf2YdDWZVkZIcMyLmZO4FVSWSxl+hi79Kjmb1Lj dmeWHaNw8mWAQ5caqY5gHs/9dNxrqm1HYEaD0YZyjGVLfMaAaI9/qKHn/EgKO83UDu9I ieUwZuX1/KAJm2RlBAhnzloUHX9jP97Ya2s3I9p0aOCtsjtKpFQeHjmJCbJOkLdsRHWE ZYu/pHj6lJ1/ZDE6lmg2mssfmRSycKOVeIVGAlLmiRkNfS3DLziSHEOAv5wJi6o99cGm 3g7w== Return-Path: Received: from [192.168.0.106] (174-16-101-177.hlrn.qwest.net. [174.16.101.177]) by smtp.gmail.com with ESMTPSA id k103sm5742459qkh.89.2019.01.03.14.10.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 Jan 2019 14:10:31 -0800 (PST) Subject: Re: [PATCH] attribute copy, leaf, weakref and -Wmisisng-attributes (PR 88546) From: Martin Sebor To: gcc-patches@gcc.gnu.org, Jakub Jelinek , "Joseph S. Myers" , Marek Polacek , Jason Merrill , Richard Biener References: <6ff6565b-51d8-8620-f345-a0082747297b@gmail.com> <2f0b2202-ba56-0554-1cc9-f290cda2a740@gmail.com> Message-ID: Date: Thu, 03 Jan 2019 22:10:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1 MIME-Version: 1.0 In-Reply-To: <2f0b2202-ba56-0554-1cc9-f290cda2a740@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2019-01/txt/msg00123.txt.bz2 Ping: https://gcc.gnu.org/ml/gcc-patches/2018-12/msg01616.html (The first sentence in the second paragraph below should have read "...independently of the question whether leaf should be accepted on extern declarations.") On 12/21/18 4:50 PM, Martin Sebor wrote: > The first revision of the patch was missing a test and didn't > completely or completely correctly handle attribute noreturn. > Attached is an update with the test included and the omission > and bug fixed. > > I think it makes sense to consider the patch independently of > the question whether weakrefs should be extern.  That change can > be made separately, with only minor tweaks to the attribute copy > handling and the warning.  None of the other fixes in this patch > (precipitated by more thorough testing) should be affected by it. > > Martin > > On 12/20/18 8:45 PM, Martin Sebor wrote: >> The enhancement to detect mismatched attributes between function >> aliases and their targets triggers (expected) warnings in GCC >> builds due to aliases being declared with fewer attributes than >> their targets. >> >> Using attribute copy as recommended to copy the attributes from >> the target to the alias triggers another warning, this time due >> to applying attribute leaf to static functions (the attribute >> only applies to extern functions).  This is due to an oversight >> in both the handler for attribute copy and in >> the -Wmissing-attributes warning. >> >> In addition, the copy attribute handler doesn't account for C11 >> _Noreturn and C++ throw() specifications, both of which set >> the corresponding tree bits but don't attach the synonymous >> attribute to it.  This also leads to warnings in GCC builds >> (in libgfortran). >> >> The attached patch corrects all of these problems: the attribute >> copy handler to avoid copying attribute leaf to declarations of >> static functions, and to set the noreturn and nonthrow bits, and >> the missing attribute warning to avoid triggering for static >> weakref aliases whose targets are decorated wiwth attribute leaf. >> >> With this patch, GCC should build with no -Wmissing-attributes >> warnings. >> >> Tested on x86_64-linux. >> >> Martin >