aboutsummaryrefslogtreecommitdiff
path: root/gdb/breakpoint.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2017-09-10 14:19:19 -0600
committerTom Tromey <tom@tromey.com>2017-09-11 15:46:12 -0600
commitf1735a53a63040cc4b4a735bf18a3f20d308e519 (patch)
treeed2e6da354b27e174e0617a15c18a193fbaa8497 /gdb/breakpoint.c
parent7d221d749c0239f06ca571be6c9452cd22b5d582 (diff)
downloadgdb-f1735a53a63040cc4b4a735bf18a3f20d308e519.zip
gdb-f1735a53a63040cc4b4a735bf18a3f20d308e519.tar.gz
gdb-f1735a53a63040cc4b4a735bf18a3f20d308e519.tar.bz2
Rename _const functions to use overloading instead
This renames a few functions -- skip_spaces_const, skip_to_space_const, get_number_const, extract_arg_const -- to drop the "_const" suffix and instead rely on overloading. This makes future const fixes simpler by reducing the number of lines that must be changed. I think it is also not any less clear, as all these functions have the same interface as their non-const versions by design. Furthermore there's an example of using an overload in-tree already, namely check_for_argument. This patch was largely created using some perl one-liners; then a few fixes were applied by hand. ChangeLog 2017-09-11 Tom Tromey <tom@tromey.com> * common/common-utils.h (skip_to_space): Remove macro, redeclare as function. (skip_to_space): Rename from skip_to_space_const. * common/common-utils.c (skip_to_space): New function. (skip_to_space): Rename from skip_to_space_const. * cli/cli-utils.h (get_number): Rename from get_number_const. (extract_arg): Rename from extract_arg_const. * cli/cli-utils.c (get_number): Rename from get_number_const. (extract_arg): Rename from extract_arg_const. (number_or_range_parser::get_number): Use ::get_number. * aarch64-linux-tdep.c, ada-lang.c, arm-linux-tdep.c, ax-gdb.c, break-catch-throw.c, breakpoint.c, cli/cli-cmds.c, cli/cli-dump.c, cli/cli-script.c, cli/cli-setshow.c, compile/compile.c, completer.c, demangle.c, disasm.c, findcmd.c, linespec.c, linux-tdep.c, linux-thread-db.c, location.c, mi/mi-parse.c, minsyms.c, nat/linux-procfs.c, printcmd.c, probe.c, python/py-breakpoint.c, record.c, rust-exp.y, serial.c, stack.c, stap-probe.c, tid-parse.c, tracepoint.c: Update all callers.
Diffstat (limited to 'gdb/breakpoint.c')
-rw-r--r--gdb/breakpoint.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 123420c..b642bc6 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -1048,8 +1048,8 @@ condition_completer (struct cmd_list_element *cmd,
{
const char *space;
- text = skip_spaces_const (text);
- space = skip_to_space_const (text);
+ text = skip_spaces (text);
+ space = skip_to_space (text);
if (*space == '\0')
{
int len;
@@ -1084,7 +1084,7 @@ condition_completer (struct cmd_list_element *cmd,
}
/* We're completing the expression part. */
- text = skip_spaces_const (space);
+ text = skip_spaces (space);
expression_completer (cmd, tracker, text, word);
}
@@ -2431,7 +2431,7 @@ parse_cmd_to_aexpr (CORE_ADDR scope, char *cmd)
if (*cmdrest == ',')
++cmdrest;
- cmdrest = skip_spaces_const (cmdrest);
+ cmdrest = skip_spaces (cmdrest);
if (*cmdrest++ != '"')
error (_("No format string following the location"));
@@ -2447,14 +2447,14 @@ parse_cmd_to_aexpr (CORE_ADDR scope, char *cmd)
if (*cmdrest++ != '"')
error (_("Bad format string, non-terminated '\"'."));
- cmdrest = skip_spaces_const (cmdrest);
+ cmdrest = skip_spaces (cmdrest);
if (!(*cmdrest == ',' || *cmdrest == '\0'))
error (_("Invalid argument syntax"));
if (*cmdrest == ',')
cmdrest++;
- cmdrest = skip_spaces_const (cmdrest);
+ cmdrest = skip_spaces (cmdrest);
/* For each argument, make an expression. */
@@ -8460,7 +8460,7 @@ add_solib_catchpoint (const char *arg, int is_load, int is_temp, int enabled)
if (!arg)
arg = "";
- arg = skip_spaces_const (arg);
+ arg = skip_spaces (arg);
std::unique_ptr<solib_catchpoint> c (new solib_catchpoint ());
@@ -9204,9 +9204,9 @@ init_breakpoint_sal (struct breakpoint *b, struct gdbarch *gdbarch,
const char *endp;
char *marker_str;
- p = skip_spaces_const (p);
+ p = skip_spaces (p);
- endp = skip_to_space_const (p);
+ endp = skip_to_space (p);
marker_str = savestring (p, endp - p);
t->static_trace_marker_id = marker_str;
@@ -9504,7 +9504,7 @@ find_condition_and_thread (const char *tok, CORE_ADDR pc,
const char *cond_start = NULL;
const char *cond_end = NULL;
- tok = skip_spaces_const (tok);
+ tok = skip_spaces (tok);
if ((*tok == '"' || *tok == ',') && rest)
{
@@ -9512,7 +9512,7 @@ find_condition_and_thread (const char *tok, CORE_ADDR pc,
return;
}
- end_tok = skip_to_space_const (tok);
+ end_tok = skip_to_space (tok);
toklen = end_tok - tok;
@@ -9569,9 +9569,9 @@ decode_static_tracepoint_spec (const char **arg_p)
char *marker_str;
int i;
- p = skip_spaces_const (p);
+ p = skip_spaces (p);
- endp = skip_to_space_const (p);
+ endp = skip_to_space (p);
marker_str = savestring (p, endp - p);
old_chain = make_cleanup (xfree, marker_str);
@@ -11064,8 +11064,8 @@ watch_command_1 (const char *arg, int accessflag, int from_tty,
else if (val != NULL)
release_value (val);
- tok = skip_spaces_const (arg);
- end_tok = skip_to_space_const (tok);
+ tok = skip_spaces (arg);
+ end_tok = skip_to_space (tok);
toklen = end_tok - tok;
if (toklen >= 1 && strncmp (tok, "if", toklen) == 0)
@@ -11583,7 +11583,7 @@ ep_parse_optional_if_clause (const char **arg)
/* Skip any extra leading whitespace, and record the start of the
condition string. */
- *arg = skip_spaces_const (*arg);
+ *arg = skip_spaces (*arg);
cond_string = *arg;
/* Assume that the condition occupies the remainder of the arg
@@ -11619,7 +11619,7 @@ catch_fork_command_1 (char *arg_entry, int from_tty,
if (!arg)
arg = "";
- arg = skip_spaces_const (arg);
+ arg = skip_spaces (arg);
/* The allowed syntax is:
catch [v]fork
@@ -11664,7 +11664,7 @@ catch_exec_command_1 (char *arg_entry, int from_tty,
if (!arg)
arg = "";
- arg = skip_spaces_const (arg);
+ arg = skip_spaces (arg);
/* The allowed syntax is:
catch exec