diff options
author | Tom Tromey <tom@tromey.com> | 2017-09-10 14:19:19 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2017-09-11 15:46:12 -0600 |
commit | f1735a53a63040cc4b4a735bf18a3f20d308e519 (patch) | |
tree | ed2e6da354b27e174e0617a15c18a193fbaa8497 /gdb/stap-probe.c | |
parent | 7d221d749c0239f06ca571be6c9452cd22b5d582 (diff) | |
download | gdb-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/stap-probe.c')
-rw-r--r-- | gdb/stap-probe.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/gdb/stap-probe.c b/gdb/stap-probe.c index c0cc662..3dc2d73 100644 --- a/gdb/stap-probe.c +++ b/gdb/stap-probe.c @@ -769,7 +769,7 @@ stap_parse_single_operand (struct stap_parse_info *p) We handle the register displacement here, and the other cases recursively. */ if (p->inside_paren_p) - tmp = skip_spaces_const (tmp); + tmp = skip_spaces (tmp); while (isdigit (*tmp)) { @@ -818,7 +818,7 @@ stap_parse_single_operand (struct stap_parse_info *p) tmp = endp; if (p->inside_paren_p) - tmp = skip_spaces_const (tmp); + tmp = skip_spaces (tmp); /* If "stap_is_integer_prefix" returns true, it means we can accept integers without a prefix here. But we also need to @@ -901,7 +901,7 @@ stap_parse_argument_conditionally (struct stap_parse_info *p) have to parse it as it was a separate expression, without left-side or precedence. */ ++p->arg; - p->arg = skip_spaces_const (p->arg); + p->arg = skip_spaces (p->arg); ++p->inside_paren_p; stap_parse_argument_1 (p, 0, STAP_OPERAND_PREC_NONE); @@ -913,7 +913,7 @@ stap_parse_argument_conditionally (struct stap_parse_info *p) ++p->arg; if (p->inside_paren_p) - p->arg = skip_spaces_const (p->arg); + p->arg = skip_spaces (p->arg); } else error (_("Cannot parse expression `%s'."), p->saved_arg); @@ -935,7 +935,7 @@ stap_parse_argument_1 (struct stap_parse_info *p, int has_lhs, gdb_assert (p->arg != NULL); if (p->inside_paren_p) - p->arg = skip_spaces_const (p->arg); + p->arg = skip_spaces (p->arg); if (!has_lhs) { @@ -981,7 +981,7 @@ stap_parse_argument_1 (struct stap_parse_info *p, int has_lhs, p->arg = tmp_exp_buf; if (p->inside_paren_p) - p->arg = skip_spaces_const (p->arg); + p->arg = skip_spaces (p->arg); /* Parse the right-side of the expression. */ stap_parse_argument_conditionally (p); @@ -1074,7 +1074,7 @@ stap_parse_argument (const char **arg, struct type *atype, reallocate_expout (&p.pstate); - p.arg = skip_spaces_const (p.arg); + p.arg = skip_spaces (p.arg); *arg = p.arg; /* We can safely return EXPOUT here. */ @@ -1189,7 +1189,7 @@ stap_parse_probe_arguments (struct stap_probe *probe, struct gdbarch *gdbarch) arg.aexpr = expr; /* Start it over again. */ - cur = skip_spaces_const (cur); + cur = skip_spaces (cur); VEC_safe_push (stap_probe_arg_s, probe->args_u.vec, &arg); } |