From patchwork Wed Feb 11 11:39:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 5040 Received: (qmail 31098 invoked by alias); 11 Feb 2015 11:39:46 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 31088 invoked by uid 89); 11 Feb 2015 11:39:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 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; Wed, 11 Feb 2015 11:39:45 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t1BBdhRu021983 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 11 Feb 2015 06:39:43 -0500 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t1BBdeKk018828; Wed, 11 Feb 2015 06:39:41 -0500 Message-ID: <54DB3F7B.7030704@redhat.com> Date: Wed, 11 Feb 2015 11:39:39 +0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: Yao Qi CC: gdb-patches@sourceware.org Subject: [PATCH] xcoffread.c: delete 'within_function' definition (Re: [PATCH 05/36] Fix redefinition errors in C++ mode) References: <1423524046-20605-1-git-send-email-palves@redhat.com> <1423524046-20605-6-git-send-email-palves@redhat.com> <54DB2A32.1030109@gmail.com> <54DB3D5C.3040106@redhat.com> In-Reply-To: <54DB3D5C.3040106@redhat.com> On 02/11/2015 11:30 AM, Pedro Alves wrote: > On 02/11/2015 10:08 AM, Yao Qi wrote: >> On 09/02/15 23:20, Pedro Alves wrote: >> >>> The intent of static here is naturally to avoid making these objects >>> visible outside the compilation unit. The equivalent in C++ would be >>> to instead define the objects in the anonymous namespace. But given >>> that it's desirable to leave the codebase compiling as both C and C++ >>> for a while, this just makes the objects extern. >> >> It is a little pity to do so, but I don't know any other better way. >> The patch looks good to me. > > Yeah, we can revisit when we require C++. We already tend to give > fairly unique names to these objects, and, GDB will fail to link > in C++ with multiple definition errors if there's a collision > we miss. Speaking of which, here's one that linking an --enable-targets=all build in C++ mode found. In C (-fcommon), the linker merges both instances of within_function, so it's really one variable. Pushed as obvious. ------------ From 18ad82c16379e7ed7daa3043abdacee1d934867d Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Tue, 10 Feb 2015 11:01:21 +0000 Subject: [PATCH] xcoffread.c: delete 'within_function' definition Linking GDB as a C++ program, we get: src/gdb/buildsym.c:226: multiple definition of `within_function' xcoffread.o:src/gdb/xcoffread.c:181: first defined here gdb/ 2015-02-11 Pedro Alves * xcoffread.c (within_function): Delete. --- gdb/ChangeLog | 4 ++++ gdb/xcoffread.c | 5 ----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 17a00a0..02232a5 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2015-02-11 Pedro Alves + + * xcoffread.c (within_function): Delete. + 2015-02-11 Tom Tromey Pedro Alves diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c index dde9185..6015711 100644 --- a/gdb/xcoffread.c +++ b/gdb/xcoffread.c @@ -119,11 +119,6 @@ static CORE_ADDR first_object_file_end; #define INITIAL_STABVECTOR_LENGTH 40 -/* Nonzero if within a function (so symbols should be local, - if nothing says specifically). */ - -int within_function; - /* Size of a COFF symbol. I think it is always 18, so I'm not sure there is any reason not to just use a #define, but might as well ask BFD for the size and store it here, I guess. */