From patchwork Mon Feb 9 23:20:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 5001 Received: (qmail 13325 invoked by alias); 9 Feb 2015 23:21:52 -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 13307 invoked by uid 89); 9 Feb 2015 23:21:51 -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, 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; Mon, 09 Feb 2015 23:21:51 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t19NLnPg007126 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Mon, 9 Feb 2015 18:21:49 -0500 Received: from brno.lan (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t19NKkur026307 for ; Mon, 9 Feb 2015 18:21:48 -0500 From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 28/36] Move exception_none to common code, and use it Date: Mon, 9 Feb 2015 23:20:38 +0000 Message-Id: <1423524046-20605-29-git-send-email-palves@redhat.com> In-Reply-To: <1423524046-20605-1-git-send-email-palves@redhat.com> References: <1423524046-20605-1-git-send-email-palves@redhat.com> gdb/ChangeLog: 2015-02-09 Pedro Alves * common/common-exceptions.h (exception_none): Declare. * common/common-exceptions.c (exception_none): Moved from exceptions.c. (exceptions_state_mc_init): Use exception_none. * exceptions.c (exception_none): Move to common/common-exceptions.c. * exceptions.h (exception_none): Move to common/common-exceptions.h. --- gdb/common/common-exceptions.c | 6 +++--- gdb/common/common-exceptions.h | 3 +++ gdb/exceptions.c | 2 -- gdb/exceptions.h | 3 --- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/gdb/common/common-exceptions.c b/gdb/common/common-exceptions.c index 4308b91..b65f259 100644 --- a/gdb/common/common-exceptions.c +++ b/gdb/common/common-exceptions.c @@ -20,6 +20,8 @@ #include "common-defs.h" #include "common-exceptions.h" +const struct gdb_exception exception_none = { 0, GDB_NO_ERROR, NULL }; + /* Possible catcher states. */ enum catcher_state { /* Initial state, a new catcher has just been created. */ @@ -78,9 +80,7 @@ exceptions_state_mc_init (volatile struct gdb_exception *exception, struct catcher *new_catcher = XCNEW (struct catcher); /* Start with no exception, save it's address. */ - exception->reason = 0; - exception->error = GDB_NO_ERROR; - exception->message = NULL; + *exception = exception_none; new_catcher->exception = exception; new_catcher->mask = mask; diff --git a/gdb/common/common-exceptions.h b/gdb/common/common-exceptions.h index e349ed0..a32e6f9 100644 --- a/gdb/common/common-exceptions.h +++ b/gdb/common/common-exceptions.h @@ -188,4 +188,7 @@ extern void throw_error (enum errors error, const char *fmt, ...) extern void throw_quit (const char *fmt, ...) ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF (1, 2); +/* A pre-defined non-exception. */ +extern const struct gdb_exception exception_none; + #endif /* COMMON_EXCEPTIONS_H */ diff --git a/gdb/exceptions.c b/gdb/exceptions.c index 91ca7d5..0ca4c56 100644 --- a/gdb/exceptions.c +++ b/gdb/exceptions.c @@ -27,8 +27,6 @@ #include "serial.h" #include "gdbthread.h" -const struct gdb_exception exception_none = { 0, GDB_NO_ERROR, NULL }; - void prepare_to_throw_exception (void) { diff --git a/gdb/exceptions.h b/gdb/exceptions.h index 9718573..3b0dbac 100644 --- a/gdb/exceptions.h +++ b/gdb/exceptions.h @@ -22,9 +22,6 @@ #include "ui-out.h" -/* A pre-defined non-exception. */ -extern const struct gdb_exception exception_none; - /* If E is an exception, print it's error message on the specified stream. For _fprintf, prefix the message with PREFIX... */ extern void exception_print (struct ui_file *file, struct gdb_exception e);