From patchwork Wed May 8 09:02:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 1096851 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-500297-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="C3D+j49t"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=oracle.com header.i=@oracle.com header.b="oiiLTuuw"; 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 44zVqd4BP2z9s4Y for ; Wed, 8 May 2019 19:02: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:to:cc :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=PAPCBdhz8Ikk/jXU/Q6aV4fyv9jKCKg49LJlTXp/OFxIIeO949 Dw4eM/eqG4IBc7km/lYmz3xP9LgIdRufYsC+nDXiz+ST07fZSqJDTSUb5DglygKt mQxDtued+a5SrYdZZSNlGpLApkunHThfrJk4IslUJEgU6TaSMwzGwQrYI= 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:to:cc :from:subject:message-id:date:mime-version:content-type; s= default; bh=5df5+bz1JwxnPSR0fyn9TIQYX9A=; b=C3D+j49tjQHXGxp8UIU7 6p+r4G8zNidzmlVrTt8dqCnBIpaRLfEPSZSAaZsjdhpIJT0Aerwd0GSnAB506lx4 TrQu7aUIdOaW2fPbw71X6lanuCniY69A30oSD4DyDIrBXu+TKl/PuopTVaVsvmgf qG5/OfFjlAVpD1jpQRaIyMw= Received: (qmail 57460 invoked by alias); 8 May 2019 09:02:40 -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 57409 invoked by uid 89); 8 May 2019 09:02:39 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-9.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, SPF_HELO_PASS autolearn=ham version=3.3.1 spammy=H*r:Gateway X-HELO: userp2130.oracle.com Received: from userp2130.oracle.com (HELO userp2130.oracle.com) (156.151.31.86) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 08 May 2019 09:02:38 +0000 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x488xJZO110908; Wed, 8 May 2019 09:02:36 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=to : cc : from : subject : message-id : date : mime-version : content-type; s=corp-2018-07-02; bh=Oz2/wJ+M8tiTRMUjDcp7nZBJYjX8ZEsi4AsPIK4boOw=; b=oiiLTuuwFizo1WgYZiS8N/Tc228+t8IdfCTR8D958nxuVLUk47iizPrIyOt/EqGSDDkR rL8rJPu+2yvemTTvDGZJXSWWlw6pu1MYtS+YVhg3Yq7hJXaDi6YeYTxaeTQ7s+KFGCwH VatmouK7yhch7jQWS/BDxnPdWu++ToidugS8chyppWANfdQt/bbqYTybt/3jPWWA8Hi6 kWuna6YoFU1psJ4JfxsaGaIiCRQ7RrM8W98/peJGrIfOg7olAwVcfOWgex2fhbAP4vjs ytdaPSodITqeFSi+U4XBL4jTzye9tuUHO7++C75vJzfwkJR6yN8U0+RLi+n6TqY6lZim 6w== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2130.oracle.com with ESMTP id 2s94bg2g93-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 08 May 2019 09:02:36 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x489142I144201; Wed, 8 May 2019 09:02:35 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3020.oracle.com with ESMTP id 2s9ayfcd8c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 08 May 2019 09:02:35 +0000 Received: from abhmp0012.oracle.com (abhmp0012.oracle.com [141.146.116.18]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x4892YbR011340; Wed, 8 May 2019 09:02:34 GMT Received: from [192.168.1.4] (/79.16.32.200) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 08 May 2019 02:02:34 -0700 To: "gcc-patches@gcc.gnu.org" Cc: Jason Merrill From: Paolo Carlini Subject: [C++ Patch] One more location fix Message-ID: <379075c8-4a86-4a5b-653b-bd82dde26666@oracle.com> Date: Wed, 8 May 2019 11:02:31 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 X-IsSubscribed: yes Hi again, one more straightforward fixlet which remained in my tree for a while. Tested x86_64-linux. Thanks, Paolo. ///////////////// /cp 2019-04-29 Paolo Carlini * decl.c (grokvardecl): Use an accurate location in error message about main as a global variable. /testsuite 2019-04-29 Paolo Carlini * g++.dg/diagnostic/main1.C: New. Index: cp/decl.c =================================================================== --- cp/decl.c (revision 270643) +++ cp/decl.c (working copy) @@ -9475,7 +9475,8 @@ grokvardecl (tree type, if (DECL_NAME (decl) && MAIN_NAME_P (DECL_NAME (decl)) && scope == global_namespace) - error ("cannot declare %<::main%> to be a global variable"); + error_at (DECL_SOURCE_LOCATION (decl), + "cannot declare %<::main%> to be a global variable"); /* Check that the variable can be safely declared as a concept. Note that this also forbids explicit specializations. */ Index: testsuite/g++.dg/diagnostic/main1.C =================================================================== --- testsuite/g++.dg/diagnostic/main1.C (nonexistent) +++ testsuite/g++.dg/diagnostic/main1.C (working copy) @@ -0,0 +1 @@ +int main __attribute__((unused)); // { dg-error "5:cannot declare" }