Rename _const functions to use overloading instead
authorTom Tromey <tom@tromey.com>
Sun, 10 Sep 2017 20:19:19 +0000 (14:19 -0600)
committerTom Tromey <tom@tromey.com>
Mon, 11 Sep 2017 21:46:12 +0000 (15:46 -0600)
commitf1735a53a63040cc4b4a735bf18a3f20d308e519
treeed2e6da354b27e174e0617a15c18a193fbaa8497
parent7d221d749c0239f06ca571be6c9452cd22b5d582
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.
37 files changed:
gdb/ChangeLog
gdb/aarch64-linux-tdep.c
gdb/ada-lang.c
gdb/arm-linux-tdep.c
gdb/ax-gdb.c
gdb/break-catch-throw.c
gdb/breakpoint.c
gdb/cli/cli-cmds.c
gdb/cli/cli-dump.c
gdb/cli/cli-script.c
gdb/cli/cli-setshow.c
gdb/cli/cli-utils.c
gdb/cli/cli-utils.h
gdb/common/common-utils.c
gdb/common/common-utils.h
gdb/compile/compile.c
gdb/completer.c
gdb/demangle.c
gdb/disasm.c
gdb/findcmd.c
gdb/linespec.c
gdb/linux-tdep.c
gdb/linux-thread-db.c
gdb/location.c
gdb/mi/mi-parse.c
gdb/minsyms.c
gdb/nat/linux-procfs.c
gdb/printcmd.c
gdb/probe.c
gdb/python/py-breakpoint.c
gdb/record.c
gdb/rust-exp.y
gdb/serial.c
gdb/stack.c
gdb/stap-probe.c
gdb/tid-parse.c
gdb/tracepoint.c