From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 124024 invoked by alias); 1 Jun 2015 20:50:20 -0000 Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org Received: (qmail 123966 invoked by uid 89); 1 Jun 2015 20:50:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.1 required=5.0 tests=AWL,BAYES_50,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=no 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; Mon, 01 Jun 2015 20:50:19 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 8E7223D470B; Mon, 1 Jun 2015 20:50:18 +0000 (UTC) Received: from c64.redhat.com (vpn-230-103.phx2.redhat.com [10.3.230.103]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t51KoE5C030113; Mon, 1 Jun 2015 16:50:18 -0400 From: David Malcolm To: gcc-patches@gcc.gnu.org, binutils@sourceware.org Cc: David Malcolm Subject: [PATCH 05/16] gcc: driver: add g_driver singleton Date: Mon, 01 Jun 2015 20:50:00 -0000 Message-Id: <1433192664-50156-6-git-send-email-dmalcolm@redhat.com> In-Reply-To: <1433192664-50156-1-git-send-email-dmalcolm@redhat.com> References: <1433192664-50156-1-git-send-email-dmalcolm@redhat.com> X-IsSubscribed: yes X-SW-Source: 2015-06/txt/msg00011.txt.bz2 gcc/ChangeLog: * gcc.c (g_driver): New. (driver::driver): Set "g_driver". (driver::~driver): Unset "g_driver". --- gcc/gcc.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/gcc/gcc.c b/gcc/gcc.c index 7314317..46e750d 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -45,6 +45,9 @@ compilation is specified by a string called a "spec". */ #include "filenames.h" #include "timevar.h" +/* Singleton instance of "driver" class. */ +static driver *g_driver; + /* Manage the manipulation of env vars. We poison getenv and putenv, so that @@ -7029,6 +7032,9 @@ driver::driver (bool can_finalize, bool debug, timer *t) : decoded_options (NULL), m_timer (t) { + gcc_assert (g_driver == NULL); + g_driver = this; + env.init (can_finalize, debug); } @@ -7036,6 +7042,9 @@ driver::~driver () { XDELETEVEC (explicit_link_files); XDELETEVEC (decoded_options); + + gcc_assert (g_driver == this); + g_driver = NULL; } /* driver::main is implemented as a series of driver:: method calls. */ -- 1.8.5.3