mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-02 04:27:46 +08:00
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.
This commit is contained in:
@ -618,7 +618,7 @@ decode_agent_options (const char *exp, int *trace_string)
|
||||
else
|
||||
error (_("Undefined collection format \"%c\"."), *exp);
|
||||
|
||||
exp = skip_spaces_const (exp);
|
||||
exp = skip_spaces (exp);
|
||||
|
||||
return exp;
|
||||
}
|
||||
@ -685,7 +685,7 @@ validate_actionline (const char *line, struct breakpoint *b)
|
||||
if (line == NULL)
|
||||
return;
|
||||
|
||||
p = skip_spaces_const (line);
|
||||
p = skip_spaces (line);
|
||||
|
||||
/* Symbol lookup etc. */
|
||||
if (*p == '\0') /* empty line: just prompt for another line. */
|
||||
@ -708,7 +708,7 @@ validate_actionline (const char *line, struct breakpoint *b)
|
||||
do
|
||||
{ /* Repeat over a comma-separated list. */
|
||||
QUIT; /* Allow user to bail out with ^C. */
|
||||
p = skip_spaces_const (p);
|
||||
p = skip_spaces (p);
|
||||
|
||||
if (*p == '$') /* Look for special pseudo-symbols. */
|
||||
{
|
||||
@ -771,7 +771,7 @@ validate_actionline (const char *line, struct breakpoint *b)
|
||||
do
|
||||
{ /* Repeat over a comma-separated list. */
|
||||
QUIT; /* Allow user to bail out with ^C. */
|
||||
p = skip_spaces_const (p);
|
||||
p = skip_spaces (p);
|
||||
|
||||
tmp_p = p;
|
||||
for (loc = t->loc; loc; loc = loc->next)
|
||||
@ -801,7 +801,7 @@ validate_actionline (const char *line, struct breakpoint *b)
|
||||
{
|
||||
char *endp;
|
||||
|
||||
p = skip_spaces_const (p);
|
||||
p = skip_spaces (p);
|
||||
t->step_count = strtol (p, &endp, 0);
|
||||
if (endp == p || t->step_count == 0)
|
||||
error (_("while-stepping step count `%s' is malformed."), line);
|
||||
@ -1311,7 +1311,7 @@ encode_actions_1 (struct command_line *action,
|
||||
{
|
||||
QUIT; /* Allow user to bail out with ^C. */
|
||||
action_exp = action->line;
|
||||
action_exp = skip_spaces_const (action_exp);
|
||||
action_exp = skip_spaces (action_exp);
|
||||
|
||||
cmd = lookup_cmd (&action_exp, cmdlist, "", -1, 1);
|
||||
if (cmd == 0)
|
||||
@ -1327,7 +1327,7 @@ encode_actions_1 (struct command_line *action,
|
||||
do
|
||||
{ /* Repeat over a comma-separated list. */
|
||||
QUIT; /* Allow user to bail out with ^C. */
|
||||
action_exp = skip_spaces_const (action_exp);
|
||||
action_exp = skip_spaces (action_exp);
|
||||
|
||||
if (0 == strncasecmp ("$reg", action_exp, 4))
|
||||
{
|
||||
@ -1487,7 +1487,7 @@ encode_actions_1 (struct command_line *action,
|
||||
do
|
||||
{ /* Repeat over a comma-separated list. */
|
||||
QUIT; /* Allow user to bail out with ^C. */
|
||||
action_exp = skip_spaces_const (action_exp);
|
||||
action_exp = skip_spaces (action_exp);
|
||||
|
||||
{
|
||||
struct cleanup *old_chain1 = NULL;
|
||||
@ -2733,7 +2733,7 @@ trace_dump_actions (struct command_line *action,
|
||||
|
||||
QUIT; /* Allow user to bail out with ^C. */
|
||||
action_exp = action->line;
|
||||
action_exp = skip_spaces_const (action_exp);
|
||||
action_exp = skip_spaces (action_exp);
|
||||
|
||||
/* The collection actions to be done while stepping are
|
||||
bracketed by the commands "while-stepping" and "end". */
|
||||
@ -2776,7 +2776,7 @@ trace_dump_actions (struct command_line *action,
|
||||
QUIT; /* Allow user to bail out with ^C. */
|
||||
if (*action_exp == ',')
|
||||
action_exp++;
|
||||
action_exp = skip_spaces_const (action_exp);
|
||||
action_exp = skip_spaces (action_exp);
|
||||
|
||||
next_comma = strchr (action_exp, ',');
|
||||
|
||||
|
Reference in New Issue
Block a user