From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20201 invoked by alias); 15 Jun 2011 02:39:49 -0000 Received: (qmail 20192 invoked by uid 22791); 15 Jun 2011 02:39:48 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from mel.act-europe.fr (HELO mel.act-europe.fr) (194.98.77.210) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 15 Jun 2011 02:39:33 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id BD353CB03CC for ; Wed, 15 Jun 2011 04:39:32 +0200 (CEST) Received: from mel.act-europe.fr ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id cwPQ0TK3oIqj for ; Wed, 15 Jun 2011 04:39:29 +0200 (CEST) Received: from [192.168.0.11] (mtg95-3-82-238-192-125.fbx.proxad.net [82.238.192.125]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mel.act-europe.fr (Postfix) with ESMTP id 6AB9ECB03C5 for ; Wed, 15 Jun 2011 04:39:29 +0200 (CEST) From: Tristan Gingold Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Subject: [RFA] Do not define variable in header files Date: Wed, 15 Jun 2011 02:39:00 -0000 Message-Id: <45256FF5-7F83-4DF9-8E82-C5601FA14796@adacore.com> To: "gdb-patches@sourceware.org ml" Mime-Version: 1.0 (Apple Message framework v1084) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-06/txt/msg00202.txt.bz2 Hi, defining variables in header files is a UNIX extension (common variable) on= ANSI-C, which results in duplicate symbols if -fno-common is used (I always use this option on one of my compiler). This patch avoids this issue by declaring the variable as extern in the hea= der and defining it in a file. Might be considered as obvious ? Ok for trunk ? Tristan. 2011-06-14 Tristan Gingold * python/py-events.h (gdb_py_events): Make it extern. * python/py-evtregistry.c (gdb_py_events): Declare. diff --git a/gdb/python/py-events.h b/gdb/python/py-events.h index 6d4dae5..bd54418 100644 --- a/gdb/python/py-events.h +++ b/gdb/python/py-events.h @@ -51,7 +51,7 @@ typedef struct } events_object; =20 /* Python events singleton. */ -events_object gdb_py_events; +extern events_object gdb_py_events; =20 extern eventregistry_object *create_eventregistry_object (void); extern int evregpy_no_listeners_p (eventregistry_object *registry); diff --git a/gdb/python/py-evtregistry.c b/gdb/python/py-evtregistry.c index e1b4346..67d5715 100644 --- a/gdb/python/py-evtregistry.c +++ b/gdb/python/py-evtregistry.c @@ -21,6 +21,8 @@ #include "command.h" #include "py-events.h" =20 +events_object gdb_py_events; + static PyTypeObject eventregistry_object_type; =20 /* Implementation of EventRegistry.connect () -> NULL.