Remove exception_none

Now that gdb_exception has a constructor, there's no need for
exception_none.  This patch removes it.

gdb/ChangeLog
2019-04-25  Tom Tromey  <tromey@adacore.com>

	* xml-support.c (gdb_xml_parser::gdb_xml_parser): Update.
	* python/py-value.c (valpy_getitem, valpy_nonzero): Update.
	* python/py-inferior.c (infpy_write_memory, infpy_search_memory):
	Update.
	* python/py-breakpoint.c (bppy_set_condition, bppy_set_commands):
	Update.
	* mi/mi-interp.c (mi_interp::exec): Update.
	* linespec.c (parse_linespec): Update.
	* infcall.c (run_inferior_call): Update.
	* guile/scm-value.c (gdbscm_value_to_lazy_string): Update.
	* guile/scm-symbol.c (gdbscm_lookup_symbol)
	(gdbscm_lookup_global_symbol): Update.
	* guile/scm-param.c (gdbscm_parameter_value): Update.
	* guile/scm-frame.c (gdbscm_frame_read_register)
	(gdbscm_frame_read_var): Update.
	* guile/scm-breakpoint.c (gdbscm_register_breakpoint_x): Update.
	* exec.c (try_open_exec_file): Update.
	* event-top.c (gdb_rl_callback_read_char_wrapper_noexcept)
	(gdb_rl_callback_handler): Update.
	* common/common-exceptions.h (exception_none): Don't declare.
	* common/common-exceptions.c (exception_none): Don't define.
	(struct catcher) <exception>: Update.
	* cli/cli-interp.c (safe_execute_command): Update.
	* breakpoint.c (insert_bp_location, location_to_sals): Update.
This commit is contained in:
Tom Tromey 2019-04-23 15:31:07 -06:00
parent cf532bd136
commit cc06b66897
19 changed files with 50 additions and 29 deletions

View file

@ -1,3 +1,30 @@
2019-04-25 Tom Tromey <tromey@adacore.com>
* xml-support.c (gdb_xml_parser::gdb_xml_parser): Update.
* python/py-value.c (valpy_getitem, valpy_nonzero): Update.
* python/py-inferior.c (infpy_write_memory, infpy_search_memory):
Update.
* python/py-breakpoint.c (bppy_set_condition, bppy_set_commands):
Update.
* mi/mi-interp.c (mi_interp::exec): Update.
* linespec.c (parse_linespec): Update.
* infcall.c (run_inferior_call): Update.
* guile/scm-value.c (gdbscm_value_to_lazy_string): Update.
* guile/scm-symbol.c (gdbscm_lookup_symbol)
(gdbscm_lookup_global_symbol): Update.
* guile/scm-param.c (gdbscm_parameter_value): Update.
* guile/scm-frame.c (gdbscm_frame_read_register)
(gdbscm_frame_read_var): Update.
* guile/scm-breakpoint.c (gdbscm_register_breakpoint_x): Update.
* exec.c (try_open_exec_file): Update.
* event-top.c (gdb_rl_callback_read_char_wrapper_noexcept)
(gdb_rl_callback_handler): Update.
* common/common-exceptions.h (exception_none): Don't declare.
* common/common-exceptions.c (exception_none): Don't define.
(struct catcher) <exception>: Update.
* cli/cli-interp.c (safe_execute_command): Update.
* breakpoint.c (insert_bp_location, location_to_sals): Update.
2019-04-25 Ali Tamur <tamur@google.com> 2019-04-25 Ali Tamur <tamur@google.com>
* dwarf2read.c (skip_one_die): Add DW_FORM_strx. * dwarf2read.c (skip_one_die): Add DW_FORM_strx.

View file

@ -2434,7 +2434,7 @@ insert_bp_location (struct bp_location *bl,
int *hw_breakpoint_error, int *hw_breakpoint_error,
int *hw_bp_error_explained_already) int *hw_bp_error_explained_already)
{ {
gdb_exception bp_excpt = exception_none; gdb_exception bp_excpt;
if (!should_be_inserted (bl) || (bl->inserted && !bl->needs_update)) if (!should_be_inserted (bl) || (bl->inserted && !bl->needs_update))
return 0; return 0;
@ -13593,7 +13593,7 @@ static std::vector<symtab_and_line>
location_to_sals (struct breakpoint *b, struct event_location *location, location_to_sals (struct breakpoint *b, struct event_location *location,
struct program_space *search_pspace, int *found) struct program_space *search_pspace, int *found)
{ {
struct gdb_exception exception = exception_none; struct gdb_exception exception;
gdb_assert (b->ops != NULL); gdb_assert (b->ops != NULL);

View file

@ -357,7 +357,7 @@ static struct gdb_exception
safe_execute_command (struct ui_out *command_uiout, const char *command, safe_execute_command (struct ui_out *command_uiout, const char *command,
int from_tty) int from_tty)
{ {
struct gdb_exception e = exception_none; struct gdb_exception e;
/* Save and override the global ``struct ui_out'' builder. */ /* Save and override the global ``struct ui_out'' builder. */
scoped_restore saved_uiout = make_scoped_restore (&current_uiout, scoped_restore saved_uiout = make_scoped_restore (&current_uiout,

View file

@ -21,8 +21,6 @@
#include "common-exceptions.h" #include "common-exceptions.h"
#include <forward_list> #include <forward_list>
const struct gdb_exception exception_none;
/* Possible catcher states. */ /* Possible catcher states. */
enum catcher_state { enum catcher_state {
/* Initial state, a new catcher has just been created. */ /* Initial state, a new catcher has just been created. */
@ -47,7 +45,7 @@ struct catcher
/* Jump buffer pointing back at the exception handler. */ /* Jump buffer pointing back at the exception handler. */
jmp_buf buf; jmp_buf buf;
/* Status buffer belonging to the exception handler. */ /* Status buffer belonging to the exception handler. */
struct gdb_exception exception = exception_none; struct gdb_exception exception;
}; };
/* Where to go for throw_exception(). */ /* Where to go for throw_exception(). */

View file

@ -295,7 +295,4 @@ extern void throw_error (enum errors error, const char *fmt, ...)
extern void throw_quit (const char *fmt, ...) extern void throw_quit (const char *fmt, ...)
ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF (1, 2); ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF (1, 2);
/* A pre-defined non-exception. */
extern const struct gdb_exception exception_none;
#endif /* COMMON_COMMON_EXCEPTIONS_H */ #endif /* COMMON_COMMON_EXCEPTIONS_H */

View file

@ -164,7 +164,7 @@ void (*after_char_processing_hook) (void);
static struct gdb_exception static struct gdb_exception
gdb_rl_callback_read_char_wrapper_noexcept () noexcept gdb_rl_callback_read_char_wrapper_noexcept () noexcept
{ {
struct gdb_exception gdb_expt = exception_none; struct gdb_exception gdb_expt;
/* C++ exceptions can't normally be thrown across readline (unless /* C++ exceptions can't normally be thrown across readline (unless
it is built with -fexceptions, but it won't by default on many it is built with -fexceptions, but it won't by default on many
@ -205,7 +205,7 @@ gdb_rl_callback_read_char_wrapper (gdb_client_data client_data)
static void static void
gdb_rl_callback_handler (char *rl) noexcept gdb_rl_callback_handler (char *rl) noexcept
{ {
struct gdb_exception gdb_rl_expt = exception_none; struct gdb_exception gdb_rl_expt;
struct ui *ui = current_ui; struct ui *ui = current_ui;
try try

View file

@ -148,7 +148,7 @@ void
try_open_exec_file (const char *exec_file_host, struct inferior *inf, try_open_exec_file (const char *exec_file_host, struct inferior *inf,
symfile_add_flags add_flags) symfile_add_flags add_flags)
{ {
struct gdb_exception prev_err = exception_none; struct gdb_exception prev_err;
/* exec_file_attach and symbol_file_add_main may throw an error if the file /* exec_file_attach and symbol_file_add_main may throw an error if the file
cannot be opened either locally or remotely. cannot be opened either locally or remotely.

View file

@ -411,7 +411,7 @@ gdbscm_register_breakpoint_x (SCM self)
{ {
breakpoint_smob *bp_smob breakpoint_smob *bp_smob
= bpscm_get_breakpoint_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME); = bpscm_get_breakpoint_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
struct gdb_exception except = exception_none; struct gdb_exception except;
const char *location, *copy; const char *location, *copy;
/* We only support registering breakpoints created with make-breakpoint. */ /* We only support registering breakpoints created with make-breakpoint. */

View file

@ -777,7 +777,7 @@ gdbscm_frame_read_register (SCM self, SCM register_scm)
gdbscm_parse_function_args (FUNC_NAME, SCM_ARG2, NULL, "s", gdbscm_parse_function_args (FUNC_NAME, SCM_ARG2, NULL, "s",
register_scm, &register_str); register_scm, &register_str);
struct gdb_exception except = exception_none; struct gdb_exception except;
try try
{ {
@ -864,7 +864,7 @@ gdbscm_frame_read_var (SCM self, SCM symbol_scm, SCM rest)
} }
else if (scm_is_string (symbol_scm)) else if (scm_is_string (symbol_scm))
{ {
struct gdb_exception except = exception_none; struct gdb_exception except;
if (! SCM_UNBNDP (block_scm)) if (! SCM_UNBNDP (block_scm))
{ {

View file

@ -1056,7 +1056,7 @@ gdbscm_parameter_value (SCM self)
struct cmd_list_element *alias, *prefix, *cmd; struct cmd_list_element *alias, *prefix, *cmd;
char *newarg; char *newarg;
int found = -1; int found = -1;
struct gdb_exception except = exception_none; struct gdb_exception except;
gdb::unique_xmalloc_ptr<char> name gdb::unique_xmalloc_ptr<char> name
= gdbscm_scm_to_host_string (self, NULL, &except_scm); = gdbscm_scm_to_host_string (self, NULL, &except_scm);

View file

@ -614,7 +614,7 @@ gdbscm_lookup_symbol (SCM name_scm, SCM rest)
} }
} }
struct gdb_exception except = exception_none; struct gdb_exception except;
try try
{ {
symbol = lookup_symbol (name, block, (domain_enum) domain, symbol = lookup_symbol (name, block, (domain_enum) domain,
@ -646,7 +646,7 @@ gdbscm_lookup_global_symbol (SCM name_scm, SCM rest)
int domain_arg_pos = -1; int domain_arg_pos = -1;
int domain = VAR_DOMAIN; int domain = VAR_DOMAIN;
struct symbol *symbol = NULL; struct symbol *symbol = NULL;
struct gdb_exception except = exception_none; struct gdb_exception except;
gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, keywords, "s#i", gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, keywords, "s#i",
name_scm, &name, rest, name_scm, &name, rest,

View file

@ -1048,7 +1048,7 @@ gdbscm_value_to_lazy_string (SCM self, SCM rest)
char *encoding = NULL; char *encoding = NULL;
int length = -1; int length = -1;
SCM result = SCM_BOOL_F; /* -Wall */ SCM result = SCM_BOOL_F; /* -Wall */
struct gdb_exception except = exception_none; struct gdb_exception except;
/* The sequencing here, as everywhere else, is important. /* The sequencing here, as everywhere else, is important.
We can't have existing cleanups when a Scheme exception is thrown. */ We can't have existing cleanups when a Scheme exception is thrown. */

View file

@ -568,7 +568,7 @@ static struct gdb_exception
run_inferior_call (struct call_thread_fsm *sm, run_inferior_call (struct call_thread_fsm *sm,
struct thread_info *call_thread, CORE_ADDR real_pc) struct thread_info *call_thread, CORE_ADDR real_pc)
{ {
struct gdb_exception caught_error = exception_none; struct gdb_exception caught_error;
int saved_in_infcall = call_thread->control.in_infcall; int saved_in_infcall = call_thread->control.in_infcall;
ptid_t call_thread_ptid = call_thread->ptid; ptid_t call_thread_ptid = call_thread->ptid;
enum prompt_state saved_prompt_state = current_ui->prompt_state; enum prompt_state saved_prompt_state = current_ui->prompt_state;

View file

@ -2508,7 +2508,7 @@ parse_linespec (linespec_parser *parser, const char *arg,
symbol_name_match_type match_type) symbol_name_match_type match_type)
{ {
linespec_token token; linespec_token token;
struct gdb_exception file_exception = exception_none; struct gdb_exception file_exception;
/* A special case to start. It has become quite popular for /* A special case to start. It has become quite popular for
IDEs to work around bugs in the previous parser by quoting IDEs to work around bugs in the previous parser by quoting

View file

@ -181,7 +181,7 @@ gdb_exception
mi_interp::exec (const char *command) mi_interp::exec (const char *command)
{ {
mi_execute_command_wrapper (command); mi_execute_command_wrapper (command);
return exception_none; return gdb_exception ();
} }
void void

View file

@ -445,7 +445,7 @@ bppy_set_condition (PyObject *self, PyObject *newvalue, void *closure)
gdb::unique_xmalloc_ptr<char> exp_holder; gdb::unique_xmalloc_ptr<char> exp_holder;
const char *exp = NULL; const char *exp = NULL;
gdbpy_breakpoint_object *self_bp = (gdbpy_breakpoint_object *) self; gdbpy_breakpoint_object *self_bp = (gdbpy_breakpoint_object *) self;
struct gdb_exception except = exception_none; struct gdb_exception except;
BPPY_SET_REQUIRE_VALID (self_bp); BPPY_SET_REQUIRE_VALID (self_bp);
@ -515,7 +515,7 @@ static int
bppy_set_commands (PyObject *self, PyObject *newvalue, void *closure) bppy_set_commands (PyObject *self, PyObject *newvalue, void *closure)
{ {
gdbpy_breakpoint_object *self_bp = (gdbpy_breakpoint_object *) self; gdbpy_breakpoint_object *self_bp = (gdbpy_breakpoint_object *) self;
struct gdb_exception except = exception_none; struct gdb_exception except;
BPPY_SET_REQUIRE_VALID (self_bp); BPPY_SET_REQUIRE_VALID (self_bp);

View file

@ -546,7 +546,7 @@ infpy_read_memory (PyObject *self, PyObject *args, PyObject *kw)
static PyObject * static PyObject *
infpy_write_memory (PyObject *self, PyObject *args, PyObject *kw) infpy_write_memory (PyObject *self, PyObject *args, PyObject *kw)
{ {
struct gdb_exception except = exception_none; struct gdb_exception except;
Py_ssize_t buf_len; Py_ssize_t buf_len;
const gdb_byte *buffer; const gdb_byte *buffer;
CORE_ADDR addr, length; CORE_ADDR addr, length;
@ -682,7 +682,7 @@ get_char_buffer (PyObject *self, Py_ssize_t segment, char **ptrptr)
static PyObject * static PyObject *
infpy_search_memory (PyObject *self, PyObject *args, PyObject *kw) infpy_search_memory (PyObject *self, PyObject *args, PyObject *kw)
{ {
struct gdb_exception except = exception_none; struct gdb_exception except;
CORE_ADDR start_addr, length; CORE_ADDR start_addr, length;
static const char *keywords[] = { "address", "length", "pattern", NULL }; static const char *keywords[] = { "address", "length", "pattern", NULL };
PyObject *start_addr_obj, *length_obj; PyObject *start_addr_obj, *length_obj;

View file

@ -903,7 +903,7 @@ get_field_type (PyObject *field)
static PyObject * static PyObject *
valpy_getitem (PyObject *self, PyObject *key) valpy_getitem (PyObject *self, PyObject *key)
{ {
struct gdb_exception except = exception_none; struct gdb_exception except;
value_object *self_value = (value_object *) self; value_object *self_value = (value_object *) self;
gdb::unique_xmalloc_ptr<char> field; gdb::unique_xmalloc_ptr<char> field;
struct type *base_class_type = NULL, *field_type = NULL; struct type *base_class_type = NULL, *field_type = NULL;
@ -1480,7 +1480,7 @@ valpy_absolute (PyObject *self)
static int static int
valpy_nonzero (PyObject *self) valpy_nonzero (PyObject *self)
{ {
struct gdb_exception except = exception_none; struct gdb_exception except;
value_object *self_value = (value_object *) self; value_object *self_value = (value_object *) self;
struct type *type; struct type *type;
int nonzero = 0; /* Appease GCC warning. */ int nonzero = 0; /* Appease GCC warning. */

View file

@ -479,7 +479,6 @@ gdb_xml_parser::gdb_xml_parser (const char *name,
void *user_data) void *user_data)
: m_name (name), : m_name (name),
m_user_data (user_data), m_user_data (user_data),
m_error (exception_none),
m_last_line (0), m_last_line (0),
m_dtd_name (NULL), m_dtd_name (NULL),
m_is_xinclude (false) m_is_xinclude (false)