This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Move exception_none to common code, and use it


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ad6aff7dead678cc0fa4f786fa59c6040c6fa758

commit ad6aff7dead678cc0fa4f786fa59c6040c6fa758
Author: Pedro Alves <palves@redhat.com>
Date:   Mon Feb 9 14:59:12 2015 +0000

    Move exception_none to common code, and use it
    
    gdb/ChangeLog:
    2015-02-27  Pedro Alves  <palves@redhat.com>
    
    	* 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.

Diff:
---
 gdb/ChangeLog                  | 11 +++++++++++
 gdb/common/common-exceptions.c |  6 +++---
 gdb/common/common-exceptions.h |  3 +++
 gdb/exceptions.c               |  2 --
 gdb/exceptions.h               |  3 ---
 5 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 39ae8a4..81ee82c 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,16 @@
 2015-02-27  Pedro Alves  <palves@redhat.com>
 
+	* 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.
+
+2015-02-27  Pedro Alves  <palves@redhat.com>
+
 	* main.c (catch_command_errors, catch_command_errors_const):
 	Remove 'mask' argument.  Adjust.
 	(captured_main): Adjust callers.
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);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]