From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10443 invoked by alias); 28 Apr 2011 07:41:43 -0000 Received: (qmail 10432 invoked by uid 22791); 28 Apr 2011 07:41:42 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-ww0-f41.google.com (HELO mail-ww0-f41.google.com) (74.125.82.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 28 Apr 2011 07:41:28 +0000 Received: by wwi18 with SMTP id 18so4090254wwi.2 for ; Thu, 28 Apr 2011 00:41:26 -0700 (PDT) Received: by 10.216.203.195 with SMTP id f45mr6823806weo.89.1303976486730; Thu, 28 Apr 2011 00:41:26 -0700 (PDT) Received: from richards-thinkpad (gbibp9ph1--blueice2n1.emea.ibm.com [195.212.29.75]) by mx.google.com with ESMTPS id w25sm908264wbd.5.2011.04.28.00.41.23 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 28 Apr 2011 00:41:24 -0700 (PDT) From: Richard Sandiford To: Gabriel Dos Reis Mail-Followup-To: Gabriel Dos Reis ,Andrew Pinski , gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Cc: Andrew Pinski , gcc-patches@gcc.gnu.org Subject: Re: restore bootstrap with a C++ compiler References: <87fwp3qi11.fsf@gauss.cs.tamu.edu> <87ei4n2ljn.fsf@gauss.cs.tamu.edu> <87k4efyuyh.fsf@gauss.cs.tamu.edu> Date: Thu, 28 Apr 2011 09:37:00 -0000 In-Reply-To: <87k4efyuyh.fsf@gauss.cs.tamu.edu> (Gabriel Dos Reis's message of "Wed, 27 Apr 2011 21:24:06 -0500") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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 X-SW-Source: 2011-04/txt/msg02201.txt.bz2 Gabriel Dos Reis writes: > Andrew Pinski writes: > > | On Wed, Apr 27, 2011 at 6:48 PM, Gabriel Dos Reis wro= te: > | > A local `extern' declaration does not give the entity an external lin= kage > | > -- irrespective of the linkage of the function enclosing the declarat= ion. > | > It just makes the name locally available for name lookup > | > purpose. =C2=A0 A variable declared const has > | > =C2=A0-- external linkage by default in C > | > =C2=A0-- internal linkage by default in C++ > | > > | > So before the patch: the variables had external linkage in C, but > | > internal linkage in C++. =C2=A0That meant that a link will fail in C+= +, but > | > succeeds in C. =C2=A0All my patch did was to give the external linkage > | > explicitly (both in C and in C++.) > |=20 > | Then I think a better fix is to do: > | Index: internal-fn.c > | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > | --- internal-fn.c (revision 172940) > | +++ internal-fn.c (working copy) > | @@ -27,6 +27,7 @@ along with GCC; see the file COPYING3. > | #include "gimple.h" > |=20 > | /* The names of each internal function, indexed by function number. */ > | +extern const char *const internal_fn_name_array[]; > | const char *const internal_fn_name_array[] =3D { > | #define DEF_INTERNAL_FN(CODE, FLAGS) #CODE, > | #include "internal-fn.def" > | @@ -35,6 +36,7 @@ const char *const internal_fn_name_array > | }; > |=20 > | /* The ECF_* flags of each internal function, indexed by function numb= er. */ > | +extern const int internal_fn_flags_array[]; > | const int internal_fn_flags_array[] =3D { > | #define DEF_INTERNAL_FN(CODE, FLAGS) FLAGS, > | #include "internal-fn.def" > | --- CUT --- > | So nobody is tempted to use those arrays directly from the code but > | rather only use the static inline functions. > > Well, anybody who can put those extern declarations anywhere and use > them directly. The real issue is that the array variables have external > linkage. > > So, I think the patch is largely stylistic but equivalent; I'll defer to > you which one should "prevail". FWIW, I prefer Andrew's patch, but since yours has been applied, I suppose there's no point changing it. Richard