From patchwork Fri Feb 19 12:22:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 585170 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 7B8EF140BA8 for ; Fri, 19 Feb 2016 23:22:29 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=io39EKCH; 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:message-id:reply-to:references:mime-version :content-type:in-reply-to; q=dns; s=default; b=qXSWZSc8I7MFSBqUz Q4Kmd4wiA9u/+sQMg/Cr638A50asvVpIOc1EvsYirPFawTGpHTZo1A5KrsP7Jtmy NLcUZ7GRRgJnZb2DUpdzYQWSvEgRFRIPU1RUpEUxnS2XUo5R/RyW8MSt/Wf0Vs/Y FjwdkWWloD4Vtc3EnLVCtb8QWE= 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:message-id:reply-to:references:mime-version :content-type:in-reply-to; s=default; bh=FI0JdwxE+xA9yUprrxLH2j2 vUNk=; b=io39EKCHHpHZkCXQQZVWech7rr6x8pDLTa8KYz19g/pCPcy9lUo3A2C RuX00wRgwCs5tWLYiTxLi2vFyA6552TwtsKRHrkdTpiUHWpU5BJuG3yFrp6VVtTx usjZOcecc3ZM9RU8pdDT0nyiboqZpox3+YQPLjo/lw+19h0LlH/4= Received: (qmail 16834 invoked by alias); 19 Feb 2016 12:22:21 -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 16814 invoked by uid 89); 19 Feb 2016 12:22:20 -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, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=391, prototypes, 303, 1614 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 19 Feb 2016 12:22:19 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id DC17464361; Fri, 19 Feb 2016 12:22:17 +0000 (UTC) Received: from tucnak.zalov.cz ([10.3.113.11]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u1JCMGuA028063 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 19 Feb 2016 07:22:17 -0500 Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id u1JCMEgm029005; Fri, 19 Feb 2016 13:22:14 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id u1JCMCYN028814; Fri, 19 Feb 2016 13:22:12 +0100 Date: Fri, 19 Feb 2016 13:22:12 +0100 From: Jakub Jelinek To: Bernd Edlinger Cc: "gcc-patches@gcc.gnu.org" , Jason Merrill , Jonathan Wakely Subject: Re: [C++ PATCH] Fix option handling when -std=gnu++14 is not used (PR 69865) Message-ID: <20160219122212.GD3017@tucnak.redhat.com> Reply-To: Jakub Jelinek References: <20160219105612.GA3017@tucnak.redhat.com> <20160219113126.GB3017@tucnak.redhat.com> <20160219115945.GC3017@tucnak.redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20160219115945.GC3017@tucnak.redhat.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-IsSubscribed: yes Hi! On Fri, Feb 19, 2016 at 12:59:45PM +0100, Jakub Jelinek wrote: > Of course not, and that would be the wrong thing to do. > The definition spot of libc_name_p comes from gperf itself, the prototype > from cfns.gperf, which we can of course adjust. This is related to https://gcc.gnu.org/ml/gcc-patches/2015-08/msg00375.html But, as we use it in a header, in C++ and don't provide an out of line definition for it, we really don't want the gnu_inline attribute in this case, because unlike in C, where gnu_inline attribute has one meaning when applied to inline and another when applied to extern inline, in C++ it always means the extern inline GNU inline semantics. And gperf clearly wants the C inline __attribute__((gnu_inline)) semantics. IMHO gperf should be fixed to only use __attribute__((gnu_inline)) for C++. BTW, the prototypes aren't really needed anymore in cfns.gperf, we use it in C++ only and C++ doesn't have -Wstrict-prototypes -Wmissing-prototypes. So, for cfns.* I think we should use until gperf is fixed: 2016-02-19 Jakub Jelinek * cfns.gperf: Remove prototypes for hash and libc_name_p inlines. Undefine __GNUC_STDC_INLINE__ and __GNUC_GNU_INLINE__ for C++. * cfns.h: Regenerated. Jakub --- gcc/cp/cfns.gperf.jj 2016-01-04 14:55:57.000000000 +0100 +++ gcc/cp/cfns.gperf 2016-02-19 13:16:50.374311181 +0100 @@ -16,14 +16,13 @@ for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see . */ -#ifdef __GNUC__ -__inline + +/* Don't use gnu_inline attribute that gperf 3.0.3 and later emits + for C++. */ +#if defined(__cplusplus) && defined(__GNUC__) +# undef __GNUC_STDC_INLINE__ +# undef __GNUC_GNU_INLINE__ #endif -static unsigned int hash (const char *, unsigned int); -#ifdef __GNUC__ -__inline -#endif -const char * libc_name_p (const char *, unsigned int); %} %% # The standard C library functions, for feeding to gperf; the result is used --- gcc/cp/cfns.h.jj 2016-01-04 14:55:57.000000000 +0100 +++ gcc/cp/cfns.h 2016-02-19 13:17:02.458142071 +0100 @@ -1,4 +1,4 @@ -/* ANSI-C code produced by gperf version 3.0.3 */ +/* ANSI-C code produced by gperf version 3.0.4 */ /* Command-line: gperf -o -C -E -k '1-6,$' -j1 -D -N libc_name_p -L ANSI-C cfns.gperf */ #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ @@ -47,14 +47,13 @@ for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see . */ -#ifdef __GNUC__ -__inline -#endif -static unsigned int hash (const char *, unsigned int); -#ifdef __GNUC__ -__inline + +/* Don't use gnu_inline attribute that gperf 3.0.3 and later emits + for C++. */ +#if defined(__cplusplus) && defined(__GNUC__) +# undef __GNUC_STDC_INLINE__ +# undef __GNUC_GNU_INLINE__ #endif -const char * libc_name_p (const char *, unsigned int); /* maximum key range = 391, duplicates = 0 */ #ifdef __GNUC__ @@ -124,7 +123,7 @@ hash (register const char *str, register #ifdef __GNUC__ __inline -#ifdef __GNUC_STDC_INLINE__ +#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__ __attribute__ ((__gnu_inline__)) #endif #endif