• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


Commit MetaInfo

修订版f1735a53a63040cc4b4a735bf18a3f20d308e519 (tree)
时间2017-09-12 06:46:12
作者Tom Tromey <tom@trom...>
CommiterTom Tromey

Log Message

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.

更改概述

差异

--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,26 @@
11 2017-09-11 Tom Tromey <tom@tromey.com>
22
3+ * common/common-utils.h (skip_to_space): Remove macro, redeclare
4+ as function.
5+ (skip_to_space): Rename from skip_to_space_const.
6+ * common/common-utils.c (skip_to_space): New function.
7+ (skip_to_space): Rename from skip_to_space_const.
8+ * cli/cli-utils.h (get_number): Rename from get_number_const.
9+ (extract_arg): Rename from extract_arg_const.
10+ * cli/cli-utils.c (get_number): Rename from get_number_const.
11+ (extract_arg): Rename from extract_arg_const.
12+ (number_or_range_parser::get_number): Use ::get_number.
13+ * aarch64-linux-tdep.c, ada-lang.c, arm-linux-tdep.c, ax-gdb.c,
14+ break-catch-throw.c, breakpoint.c, cli/cli-cmds.c, cli/cli-dump.c,
15+ cli/cli-script.c, cli/cli-setshow.c, compile/compile.c,
16+ completer.c, demangle.c, disasm.c, findcmd.c, linespec.c,
17+ linux-tdep.c, linux-thread-db.c, location.c, mi/mi-parse.c,
18+ minsyms.c, nat/linux-procfs.c, printcmd.c, probe.c,
19+ python/py-breakpoint.c, record.c, rust-exp.y, serial.c, stack.c,
20+ stap-probe.c, tid-parse.c, tracepoint.c: Update all callers.
21+
22+2017-09-11 Tom Tromey <tom@tromey.com>
23+
324 * python/python.c (do_start_initialization): Use
425 py-event-types.def to initialize types.
526 Define all object type structures.
--- a/gdb/aarch64-linux-tdep.c
+++ b/gdb/aarch64-linux-tdep.c
@@ -305,7 +305,7 @@ aarch64_stap_parse_special_token (struct gdbarch *gdbarch,
305305 regname, p->saved_arg);
306306
307307 ++tmp;
308- tmp = skip_spaces_const (tmp);
308+ tmp = skip_spaces (tmp);
309309 /* Now we expect a number. It can begin with '#' or simply
310310 a digit. */
311311 if (*tmp == '#')
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -12732,13 +12732,13 @@ ada_get_next_arg (const char **argsp)
1273212732 const char *end;
1273312733 char *result;
1273412734
12735- args = skip_spaces_const (args);
12735+ args = skip_spaces (args);
1273612736 if (args[0] == '\0')
1273712737 return NULL; /* No more arguments. */
1273812738
1273912739 /* Find the end of the current argument. */
1274012740
12741- end = skip_to_space_const (args);
12741+ end = skip_to_space (args);
1274212742
1274312743 /* Adjust ARGSP to point to the start of the next argument. */
1274412744
@@ -12785,12 +12785,12 @@ catch_ada_exception_command_split (const char *args,
1278512785
1278612786 /* Check to see if we have a condition. */
1278712787
12788- args = skip_spaces_const (args);
12788+ args = skip_spaces (args);
1278912789 if (startswith (args, "if")
1279012790 && (isspace (args[2]) || args[2] == '\0'))
1279112791 {
1279212792 args += 2;
12793- args = skip_spaces_const (args);
12793+ args = skip_spaces (args);
1279412794
1279512795 if (args[0] == '\0')
1279612796 error (_("Condition missing after `if' keyword"));
@@ -13044,14 +13044,14 @@ catch_ada_exception_command (char *arg_entry, int from_tty,
1304413044 static void
1304513045 catch_ada_assert_command_split (const char *args, char **cond_string)
1304613046 {
13047- args = skip_spaces_const (args);
13047+ args = skip_spaces (args);
1304813048
1304913049 /* Check whether a condition was provided. */
1305013050 if (startswith (args, "if")
1305113051 && (isspace (args[2]) || args[2] == '\0'))
1305213052 {
1305313053 args += 2;
13054- args = skip_spaces_const (args);
13054+ args = skip_spaces (args);
1305513055 if (args[0] == '\0')
1305613056 error (_("condition missing after `if' keyword"));
1305713057 *cond_string = xstrdup (args);
--- a/gdb/arm-linux-tdep.c
+++ b/gdb/arm-linux-tdep.c
@@ -1211,7 +1211,7 @@ arm_stap_parse_special_token (struct gdbarch *gdbarch,
12111211 regname, p->saved_arg);
12121212
12131213 ++tmp;
1214- tmp = skip_spaces_const (tmp);
1214+ tmp = skip_spaces (tmp);
12151215 if (*tmp == '#' || *tmp == '$')
12161216 ++tmp;
12171217
--- a/gdb/ax-gdb.c
+++ b/gdb/ax-gdb.c
@@ -2702,7 +2702,7 @@ maint_agent_printf_command (char *exp, int from_tty)
27022702
27032703 cmdrest = exp;
27042704
2705- cmdrest = skip_spaces_const (cmdrest);
2705+ cmdrest = skip_spaces (cmdrest);
27062706
27072707 if (*cmdrest++ != '"')
27082708 error (_("Must start with a format string."));
@@ -2718,14 +2718,14 @@ maint_agent_printf_command (char *exp, int from_tty)
27182718 if (*cmdrest++ != '"')
27192719 error (_("Bad format string, non-terminated '\"'."));
27202720
2721- cmdrest = skip_spaces_const (cmdrest);
2721+ cmdrest = skip_spaces (cmdrest);
27222722
27232723 if (*cmdrest != ',' && *cmdrest != 0)
27242724 error (_("Invalid argument syntax"));
27252725
27262726 if (*cmdrest == ',')
27272727 cmdrest++;
2728- cmdrest = skip_spaces_const (cmdrest);
2728+ cmdrest = skip_spaces (cmdrest);
27292729
27302730 nargs = 0;
27312731 while (*cmdrest != '\0')
--- a/gdb/break-catch-throw.c
+++ b/gdb/break-catch-throw.c
@@ -402,7 +402,7 @@ extract_exception_regexp (const char **string)
402402 const char *start;
403403 const char *last, *last_space;
404404
405- start = skip_spaces_const (*string);
405+ start = skip_spaces (*string);
406406
407407 last = start;
408408 last_space = start;
@@ -416,7 +416,7 @@ extract_exception_regexp (const char **string)
416416
417417 /* No "if" token here. Skip to the next word start. */
418418 last_space = skip_to_space (last);
419- last = skip_spaces_const (last_space);
419+ last = skip_spaces (last_space);
420420 }
421421
422422 *string = last;
@@ -438,7 +438,7 @@ catch_exception_command_1 (enum exception_event_kind ex_event,
438438
439439 if (!arg)
440440 arg = "";
441- arg = skip_spaces_const (arg);
441+ arg = skip_spaces (arg);
442442
443443 std::string except_rx = extract_exception_regexp (&arg);
444444
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -1048,8 +1048,8 @@ condition_completer (struct cmd_list_element *cmd,
10481048 {
10491049 const char *space;
10501050
1051- text = skip_spaces_const (text);
1052- space = skip_to_space_const (text);
1051+ text = skip_spaces (text);
1052+ space = skip_to_space (text);
10531053 if (*space == '\0')
10541054 {
10551055 int len;
@@ -1084,7 +1084,7 @@ condition_completer (struct cmd_list_element *cmd,
10841084 }
10851085
10861086 /* We're completing the expression part. */
1087- text = skip_spaces_const (space);
1087+ text = skip_spaces (space);
10881088 expression_completer (cmd, tracker, text, word);
10891089 }
10901090
@@ -2431,7 +2431,7 @@ parse_cmd_to_aexpr (CORE_ADDR scope, char *cmd)
24312431
24322432 if (*cmdrest == ',')
24332433 ++cmdrest;
2434- cmdrest = skip_spaces_const (cmdrest);
2434+ cmdrest = skip_spaces (cmdrest);
24352435
24362436 if (*cmdrest++ != '"')
24372437 error (_("No format string following the location"));
@@ -2447,14 +2447,14 @@ parse_cmd_to_aexpr (CORE_ADDR scope, char *cmd)
24472447 if (*cmdrest++ != '"')
24482448 error (_("Bad format string, non-terminated '\"'."));
24492449
2450- cmdrest = skip_spaces_const (cmdrest);
2450+ cmdrest = skip_spaces (cmdrest);
24512451
24522452 if (!(*cmdrest == ',' || *cmdrest == '\0'))
24532453 error (_("Invalid argument syntax"));
24542454
24552455 if (*cmdrest == ',')
24562456 cmdrest++;
2457- cmdrest = skip_spaces_const (cmdrest);
2457+ cmdrest = skip_spaces (cmdrest);
24582458
24592459 /* For each argument, make an expression. */
24602460
@@ -8460,7 +8460,7 @@ add_solib_catchpoint (const char *arg, int is_load, int is_temp, int enabled)
84608460
84618461 if (!arg)
84628462 arg = "";
8463- arg = skip_spaces_const (arg);
8463+ arg = skip_spaces (arg);
84648464
84658465 std::unique_ptr<solib_catchpoint> c (new solib_catchpoint ());
84668466
@@ -9204,9 +9204,9 @@ init_breakpoint_sal (struct breakpoint *b, struct gdbarch *gdbarch,
92049204 const char *endp;
92059205 char *marker_str;
92069206
9207- p = skip_spaces_const (p);
9207+ p = skip_spaces (p);
92089208
9209- endp = skip_to_space_const (p);
9209+ endp = skip_to_space (p);
92109210
92119211 marker_str = savestring (p, endp - p);
92129212 t->static_trace_marker_id = marker_str;
@@ -9504,7 +9504,7 @@ find_condition_and_thread (const char *tok, CORE_ADDR pc,
95049504 const char *cond_start = NULL;
95059505 const char *cond_end = NULL;
95069506
9507- tok = skip_spaces_const (tok);
9507+ tok = skip_spaces (tok);
95089508
95099509 if ((*tok == '"' || *tok == ',') && rest)
95109510 {
@@ -9512,7 +9512,7 @@ find_condition_and_thread (const char *tok, CORE_ADDR pc,
95129512 return;
95139513 }
95149514
9515- end_tok = skip_to_space_const (tok);
9515+ end_tok = skip_to_space (tok);
95169516
95179517 toklen = end_tok - tok;
95189518
@@ -9569,9 +9569,9 @@ decode_static_tracepoint_spec (const char **arg_p)
95699569 char *marker_str;
95709570 int i;
95719571
9572- p = skip_spaces_const (p);
9572+ p = skip_spaces (p);
95739573
9574- endp = skip_to_space_const (p);
9574+ endp = skip_to_space (p);
95759575
95769576 marker_str = savestring (p, endp - p);
95779577 old_chain = make_cleanup (xfree, marker_str);
@@ -11064,8 +11064,8 @@ watch_command_1 (const char *arg, int accessflag, int from_tty,
1106411064 else if (val != NULL)
1106511065 release_value (val);
1106611066
11067- tok = skip_spaces_const (arg);
11068- end_tok = skip_to_space_const (tok);
11067+ tok = skip_spaces (arg);
11068+ end_tok = skip_to_space (tok);
1106911069
1107011070 toklen = end_tok - tok;
1107111071 if (toklen >= 1 && strncmp (tok, "if", toklen) == 0)
@@ -11583,7 +11583,7 @@ ep_parse_optional_if_clause (const char **arg)
1158311583
1158411584 /* Skip any extra leading whitespace, and record the start of the
1158511585 condition string. */
11586- *arg = skip_spaces_const (*arg);
11586+ *arg = skip_spaces (*arg);
1158711587 cond_string = *arg;
1158811588
1158911589 /* Assume that the condition occupies the remainder of the arg
@@ -11619,7 +11619,7 @@ catch_fork_command_1 (char *arg_entry, int from_tty,
1161911619
1162011620 if (!arg)
1162111621 arg = "";
11622- arg = skip_spaces_const (arg);
11622+ arg = skip_spaces (arg);
1162311623
1162411624 /* The allowed syntax is:
1162511625 catch [v]fork
@@ -11664,7 +11664,7 @@ catch_exec_command_1 (char *arg_entry, int from_tty,
1166411664
1166511665 if (!arg)
1166611666 arg = "";
11667- arg = skip_spaces_const (arg);
11667+ arg = skip_spaces (arg);
1166811668
1166911669 /* The allowed syntax is:
1167011670 catch exec
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -1240,7 +1240,7 @@ disassemble_command (char *arg, int from_tty)
12401240 }
12411241 }
12421242
1243- p = skip_spaces_const (p);
1243+ p = skip_spaces (p);
12441244 }
12451245
12461246 if ((flags & (DISASSEMBLY_SOURCE_DEPRECATED | DISASSEMBLY_SOURCE))
@@ -1277,7 +1277,7 @@ disassemble_command (char *arg, int from_tty)
12771277 /* Two arguments. */
12781278 int incl_flag = 0;
12791279 low = pc;
1280- p = skip_spaces_const (p);
1280+ p = skip_spaces (p);
12811281 if (p[0] == '+')
12821282 {
12831283 ++p;
--- a/gdb/cli/cli-dump.c
+++ b/gdb/cli/cli-dump.c
@@ -45,7 +45,7 @@ scan_expression (const char **cmd, const char *def)
4545
4646 end = (*cmd) + strcspn (*cmd, " \t");
4747 exp = savestring ((*cmd), end - (*cmd));
48- (*cmd) = skip_spaces_const (end);
48+ (*cmd) = skip_spaces (end);
4949 return gdb::unique_xmalloc_ptr<char> (exp);
5050 }
5151 }
@@ -71,10 +71,10 @@ scan_filename (const char **cmd, const char *defname)
7171 /* FIXME: should parse a possibly quoted string. */
7272 const char *end;
7373
74- (*cmd) = skip_spaces_const (*cmd);
74+ (*cmd) = skip_spaces (*cmd);
7575 end = *cmd + strcspn (*cmd, " \t");
7676 filename.reset (savestring ((*cmd), end - (*cmd)));
77- (*cmd) = skip_spaces_const (end);
77+ (*cmd) = skip_spaces (end);
7878 }
7979 gdb_assert (filename != NULL);
8080
@@ -538,7 +538,7 @@ restore_command (char *args_in, int from_tty)
538538 {
539539 binary_flag = 1;
540540 args += strlen (binary_string);
541- args = skip_spaces_const (args);
541+ args = skip_spaces (args);
542542 }
543543 /* Parse offset (optional). */
544544 if (args != NULL && *args != '\0')
--- a/gdb/cli/cli-script.c
+++ b/gdb/cli/cli-script.c
@@ -888,7 +888,7 @@ line_first_arg (const char *p)
888888 {
889889 const char *first_arg = p + find_command_name_length (p);
890890
891- return skip_spaces_const (first_arg);
891+ return skip_spaces (first_arg);
892892 }
893893
894894 /* Process one input line. If the command is an "end", return such an
@@ -932,7 +932,7 @@ process_next_line (char *p, struct command_line **command, int parse_commands,
932932 const char *cmd_name = p;
933933 struct cmd_list_element *cmd
934934 = lookup_cmd_1 (&cmd_name, cmdlist, NULL, 1);
935- cmd_name = skip_spaces_const (cmd_name);
935+ cmd_name = skip_spaces (cmd_name);
936936 bool inline_cmd = *cmd_name != '\0';
937937
938938 /* If commands are parsed, we skip initial spaces. Otherwise,
--- a/gdb/cli/cli-setshow.c
+++ b/gdb/cli/cli-setshow.c
@@ -134,7 +134,7 @@ is_unlimited_literal (const char *arg)
134134 {
135135 size_t len = sizeof ("unlimited") - 1;
136136
137- arg = skip_spaces_const (arg);
137+ arg = skip_spaces (arg);
138138
139139 return (strncmp (arg, "unlimited", len) == 0
140140 && (isspace (arg[len]) || arg[len] == '\0'));
--- a/gdb/cli/cli-utils.c
+++ b/gdb/cli/cli-utils.c
@@ -93,7 +93,7 @@ get_number_trailer (const char **pp, int trailer)
9393 ++p;
9494 retval = 0;
9595 }
96- p = skip_spaces_const (p);
96+ p = skip_spaces (p);
9797 *pp = p;
9898 return retval;
9999 }
@@ -101,7 +101,7 @@ get_number_trailer (const char **pp, int trailer)
101101 /* See documentation in cli-utils.h. */
102102
103103 int
104-get_number_const (const char **pp)
104+get_number (const char **pp)
105105 {
106106 return get_number_trailer (pp, '\0');
107107 }
@@ -172,8 +172,8 @@ number_or_range_parser::get_number ()
172172 and also remember the end of the final token. */
173173
174174 temp = &m_end_ptr;
175- m_end_ptr = skip_spaces_const (m_cur_tok + 1);
176- m_end_value = get_number_const (temp);
175+ m_end_ptr = skip_spaces (m_cur_tok + 1);
176+ m_end_value = ::get_number (temp);
177177 if (m_end_value < m_last_retval)
178178 {
179179 error (_("inverted range"));
@@ -250,7 +250,7 @@ remove_trailing_whitespace (const char *start, const char *s)
250250 /* See documentation in cli-utils.h. */
251251
252252 char *
253-extract_arg_const (const char **arg)
253+extract_arg (const char **arg)
254254 {
255255 const char *result;
256256
@@ -258,13 +258,13 @@ extract_arg_const (const char **arg)
258258 return NULL;
259259
260260 /* Find the start of the argument. */
261- *arg = skip_spaces_const (*arg);
261+ *arg = skip_spaces (*arg);
262262 if (!**arg)
263263 return NULL;
264264 result = *arg;
265265
266266 /* Find the end of the argument. */
267- *arg = skip_to_space_const (*arg + 1);
267+ *arg = skip_to_space (*arg + 1);
268268
269269 if (result == *arg)
270270 return NULL;
@@ -280,7 +280,7 @@ extract_arg (char **arg)
280280 const char *arg_const = *arg;
281281 char *result;
282282
283- result = extract_arg_const (&arg_const);
283+ result = extract_arg (&arg_const);
284284 *arg += arg_const - *arg;
285285 return result;
286286 }
--- a/gdb/cli/cli-utils.h
+++ b/gdb/cli/cli-utils.h
@@ -33,9 +33,9 @@ extern int get_number_trailer (const char **pp, int trailer);
3333
3434 /* Convenience. Like get_number_trailer, but with no TRAILER. */
3535
36-extern int get_number_const (const char **);
36+extern int get_number (const char **);
3737
38-/* Like get_number_const, but takes a non-const "char **". */
38+/* Like the above, but takes a non-const "char **". */
3939
4040 extern int get_number (char **);
4141
@@ -154,12 +154,12 @@ remove_trailing_whitespace (const char *start, char *s)
154154
155155 extern char *extract_arg (char **arg);
156156
157-/* A const-correct version of "extract_arg".
157+/* A const-correct version of the above.
158158
159159 Since the returned value is xmalloc'd, it eventually needs to be
160160 xfree'ed, which prevents us from making it const as well. */
161161
162-extern char *extract_arg_const (const char **arg);
162+extern char *extract_arg (const char **arg);
163163
164164 /* A helper function that looks for an argument at the start of a
165165 string. The argument must also either be at the end of the string,
--- a/gdb/common/common-utils.c
+++ b/gdb/common/common-utils.c
@@ -298,7 +298,7 @@ skip_spaces (char *chp)
298298 /* A const-correct version of the above. */
299299
300300 const char *
301-skip_spaces_const (const char *chp)
301+skip_spaces (const char *chp)
302302 {
303303 if (chp == NULL)
304304 return NULL;
@@ -310,7 +310,7 @@ skip_spaces_const (const char *chp)
310310 /* See documentation in common-utils.h. */
311311
312312 const char *
313-skip_to_space_const (const char *chp)
313+skip_to_space (const char *chp)
314314 {
315315 if (chp == NULL)
316316 return NULL;
@@ -319,6 +319,14 @@ skip_to_space_const (const char *chp)
319319 return chp;
320320 }
321321
322+/* See documentation in common-utils.h. */
323+
324+char *
325+skip_to_space (char *chp)
326+{
327+ return (char *) skip_to_space ((const char *) chp);
328+}
329+
322330 /* See common/common-utils.h. */
323331
324332 void
--- a/gdb/common/common-utils.h
+++ b/gdb/common/common-utils.h
@@ -93,16 +93,16 @@ extern char *skip_spaces (char *inp);
9393
9494 /* A const-correct version of the above. */
9595
96-extern const char *skip_spaces_const (const char *inp);
96+extern const char *skip_spaces (const char *inp);
9797
9898 /* Skip leading non-whitespace characters in INP, returning an updated
9999 pointer. If INP is NULL, return NULL. */
100100
101-#define skip_to_space(INP) ((char *) skip_to_space_const (INP))
101+extern char *skip_to_space (char *inp);
102102
103103 /* A const-correct version of the above. */
104104
105-extern const char *skip_to_space_const (const char *inp);
105+extern const char *skip_to_space (const char *inp);
106106
107107 /* Assumes that V is an argv for a program, and iterates through
108108 freeing all the elements. */
--- a/gdb/compile/compile.c
+++ b/gdb/compile/compile.c
@@ -367,7 +367,7 @@ get_selected_pc_producer_options (void)
367367
368368 cs = symtab->producer;
369369 while (*cs != 0 && *cs != '-')
370- cs = skip_spaces_const (skip_to_space_const (cs));
370+ cs = skip_spaces (skip_to_space (cs));
371371 if (*cs != '-')
372372 return NULL;
373373 return cs;
--- a/gdb/completer.c
+++ b/gdb/completer.c
@@ -699,7 +699,7 @@ collect_explicit_location_matches (completion_tracker &tracker,
699699 keyword. */
700700 if (keyword != word)
701701 {
702- keyword = skip_spaces_const (keyword);
702+ keyword = skip_spaces (keyword);
703703
704704 tracker.advance_custom_word_point_by (keyword - word);
705705 complete_on_enum (tracker, linespec_keywords, keyword, keyword);
@@ -729,7 +729,7 @@ skip_keyword (completion_tracker &tracker,
729729 const char * const *keywords, const char **text_p)
730730 {
731731 const char *text = *text_p;
732- const char *after = skip_to_space_const (text);
732+ const char *after = skip_to_space (text);
733733 size_t len = after - text;
734734
735735 if (text[len] != ' ')
@@ -1903,7 +1903,7 @@ expand_preserving_ws (const char *orig, size_t orig_len,
19031903 {
19041904 while (p_orig < orig_end && *p_orig == ' ')
19051905 res += *p_orig++;
1906- p_lcd = skip_spaces_const (p_lcd);
1906+ p_lcd = skip_spaces (p_lcd);
19071907 }
19081908 else
19091909 {
--- a/gdb/demangle.c
+++ b/gdb/demangle.c
@@ -174,20 +174,20 @@ demangle_command (char *args, int from_tty)
174174 while (processing_args
175175 && *arg_start == '-')
176176 {
177- const char *p = skip_to_space_const (arg_start);
177+ const char *p = skip_to_space (arg_start);
178178
179179 if (strncmp (arg_start, "-l", p - arg_start) == 0)
180- lang_name.reset (extract_arg_const (&p));
180+ lang_name.reset (extract_arg (&p));
181181 else if (strncmp (arg_start, "--", p - arg_start) == 0)
182182 processing_args = 0;
183183 else
184184 {
185- gdb::unique_xmalloc_ptr<char> option (extract_arg_const (&p));
185+ gdb::unique_xmalloc_ptr<char> option (extract_arg (&p));
186186 error (_("Unrecognized option '%s' to demangle command. "
187187 "Try \"help demangle\"."), option.get ());
188188 }
189189
190- arg_start = skip_spaces_const (p);
190+ arg_start = skip_spaces (p);
191191 }
192192
193193 name = arg_start;
--- a/gdb/disasm.c
+++ b/gdb/disasm.c
@@ -1044,7 +1044,7 @@ disassembler_options_completer (struct cmd_list_element *ignore,
10441044 const char *separator = strrchr (text, ',');
10451045 if (separator != NULL)
10461046 text = separator + 1;
1047- text = skip_spaces_const (text);
1047+ text = skip_spaces (text);
10481048 complete_on_enum (tracker, opts->name, text, word);
10491049 }
10501050 }
--- a/gdb/findcmd.c
+++ b/gdb/findcmd.c
@@ -110,7 +110,7 @@ parse_find_args (char *args, ULONGEST *max_countp,
110110 }
111111 }
112112
113- s = skip_spaces_const (s);
113+ s = skip_spaces (s);
114114 }
115115
116116 /* Get the search range. */
@@ -120,7 +120,7 @@ parse_find_args (char *args, ULONGEST *max_countp,
120120
121121 if (*s == ',')
122122 ++s;
123- s = skip_spaces_const (s);
123+ s = skip_spaces (s);
124124
125125 if (*s == '+')
126126 {
@@ -171,7 +171,7 @@ parse_find_args (char *args, ULONGEST *max_countp,
171171 struct type *t;
172172 ULONGEST pattern_buf_size_need;
173173
174- s = skip_spaces_const (s);
174+ s = skip_spaces (s);
175175
176176 v = parse_to_comma_and_eval (&s);
177177 t = value_type (v);
@@ -220,7 +220,7 @@ parse_find_args (char *args, ULONGEST *max_countp,
220220
221221 if (*s == ',')
222222 ++s;
223- s = skip_spaces_const (s);
223+ s = skip_spaces (s);
224224 }
225225
226226 if (pattern_buf_end == pattern_buf)
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -474,7 +474,7 @@ linespec_lexer_lex_keyword (const char *p)
474474 if (i != IF_KEYWORD_INDEX)
475475 {
476476 p += len;
477- p = skip_spaces_const (p);
477+ p = skip_spaces (p);
478478 for (j = 0; linespec_keywords[j] != NULL; ++j)
479479 {
480480 int nextlen = strlen (linespec_keywords[j]);
@@ -709,7 +709,7 @@ linespec_lexer_lex_string (linespec_parser *parser)
709709 {
710710 if (isspace (*PARSER_STREAM (parser)))
711711 {
712- p = skip_spaces_const (PARSER_STREAM (parser));
712+ p = skip_spaces (PARSER_STREAM (parser));
713713 /* When we get here we know we've found something followed by
714714 a space (we skip over parens and templates below).
715715 So if we find a keyword now, we know it is a keyword and not,
@@ -856,7 +856,7 @@ linespec_lexer_lex_one (linespec_parser *parser)
856856 if (parser->lexer.current.type == LSTOKEN_CONSUMED)
857857 {
858858 /* Skip any whitespace. */
859- PARSER_STREAM (parser) = skip_spaces_const (PARSER_STREAM (parser));
859+ PARSER_STREAM (parser) = skip_spaces (PARSER_STREAM (parser));
860860
861861 /* Check for a keyword, they end the linespec. */
862862 keyword = linespec_lexer_lex_keyword (PARSER_STREAM (parser));
@@ -1770,7 +1770,7 @@ set_completion_after_number (linespec_parser *parser,
17701770 {
17711771 if (*PARSER_STREAM (parser) == ' ')
17721772 {
1773- parser->completion_word = skip_spaces_const (PARSER_STREAM (parser) + 1);
1773+ parser->completion_word = skip_spaces (PARSER_STREAM (parser) + 1);
17741774 parser->complete_what = next;
17751775 }
17761776 else
@@ -2000,7 +2000,7 @@ linespec_parse_basic (linespec_parser *parser)
20002000 if (ptr[i] == ' ')
20012001 {
20022002 LS_TOKEN_STOKEN (token).length = i;
2003- PARSER_STREAM (parser) = skip_spaces_const (ptr + i + 1);
2003+ PARSER_STREAM (parser) = skip_spaces (ptr + i + 1);
20042004 break;
20052005 }
20062006 }
@@ -2697,7 +2697,7 @@ parse_linespec (linespec_parser *parser, const char *arg)
26972697 advances past a keyword automatically, so skip it
26982698 manually. */
26992699 parser->completion_word
2700- = skip_spaces_const (skip_to_space_const (PARSER_STREAM (parser)));
2700+ = skip_spaces (skip_to_space (PARSER_STREAM (parser)));
27012701 parser->complete_what = linespec_complete_what::EXPRESSION;
27022702 }
27032703
--- a/gdb/linux-tdep.c
+++ b/gdb/linux-tdep.c
@@ -440,7 +440,7 @@ read_mapping (const char *line,
440440 p++;
441441 *endaddr = strtoulst (p, &p, 16);
442442
443- p = skip_spaces_const (p);
443+ p = skip_spaces (p);
444444 *permissions = p;
445445 while (*p && !isspace (*p))
446446 p++;
@@ -448,7 +448,7 @@ read_mapping (const char *line,
448448
449449 *offset = strtoulst (p, &p, 16);
450450
451- p = skip_spaces_const (p);
451+ p = skip_spaces (p);
452452 *device = p;
453453 while (*p && !isspace (*p))
454454 p++;
@@ -456,7 +456,7 @@ read_mapping (const char *line,
456456
457457 *inode = strtoulst (p, &p, 10);
458458
459- p = skip_spaces_const (p);
459+ p = skip_spaces (p);
460460 *filename = p;
461461 }
462462
@@ -740,7 +740,7 @@ linux_info_proc (struct gdbarch *gdbarch, const char *args,
740740 pid = current_inferior ()->pid;
741741 }
742742
743- args = skip_spaces_const (args);
743+ args = skip_spaces (args);
744744 if (args && args[0])
745745 error (_("Too many parameters: %s"), args);
746746
@@ -870,7 +870,7 @@ linux_info_proc (struct gdbarch *gdbarch, const char *args,
870870 printf_filtered (_("Process: %s\n"),
871871 pulongest (strtoulst (p, &p, 10)));
872872
873- p = skip_spaces_const (p);
873+ p = skip_spaces (p);
874874 if (*p == '(')
875875 {
876876 /* ps command also relies on no trailing fields
@@ -884,7 +884,7 @@ linux_info_proc (struct gdbarch *gdbarch, const char *args,
884884 }
885885 }
886886
887- p = skip_spaces_const (p);
887+ p = skip_spaces (p);
888888 if (*p)
889889 printf_filtered (_("State: %c\n"), *p++);
890890
--- a/gdb/linux-thread-db.c
+++ b/gdb/linux-thread-db.c
@@ -1560,7 +1560,7 @@ info_auto_load_libthread_db (char *args, int from_tty)
15601560 char *pids;
15611561 int i;
15621562
1563- cs = skip_spaces_const (cs);
1563+ cs = skip_spaces (cs);
15641564 if (*cs)
15651565 error (_("'info auto-load libthread-db' does not accept any parameters"));
15661566
--- a/gdb/location.c
+++ b/gdb/location.c
@@ -746,7 +746,7 @@ string_to_explicit_location (const char **argp,
746746 len = strlen (opt.get ());
747747
748748 /* Get the argument string. */
749- *argp = skip_spaces_const (*argp);
749+ *argp = skip_spaces (*argp);
750750
751751 /* All options have a required argument. Checking for this
752752 required argument is deferred until later. */
@@ -779,7 +779,7 @@ string_to_explicit_location (const char **argp,
779779 else if (strncmp (opt.get (), "-line", len) == 0)
780780 {
781781 set_oarg (explicit_location_lex_one (argp, language, NULL));
782- *argp = skip_spaces_const (*argp);
782+ *argp = skip_spaces (*argp);
783783 if (have_oarg)
784784 {
785785 EL_EXPLICIT (location)->line_offset
@@ -808,7 +808,7 @@ string_to_explicit_location (const char **argp,
808808 return location;
809809 }
810810
811- *argp = skip_spaces_const (*argp);
811+ *argp = skip_spaces (*argp);
812812
813813 /* It's a little lame to error after the fact, but in this
814814 case, it provides a much better user experience to issue
--- a/gdb/mi/mi-parse.c
+++ b/gdb/mi/mi-parse.c
@@ -119,7 +119,7 @@ mi_parse_argv (const char *args, struct mi_parse *parse)
119119 char *arg;
120120
121121 /* Skip leading white space. */
122- chp = skip_spaces_const (chp);
122+ chp = skip_spaces (chp);
123123 /* Three possibilities: EOF, quoted string, or other text. */
124124 switch (*chp)
125125 {
@@ -242,7 +242,7 @@ mi_parse (const char *cmd, char **token)
242242 std::unique_ptr<struct mi_parse> parse (new struct mi_parse);
243243
244244 /* Before starting, skip leading white space. */
245- cmd = skip_spaces_const (cmd);
245+ cmd = skip_spaces (cmd);
246246
247247 /* Find/skip any token and then extract it. */
248248 for (chp = cmd; *chp >= '0' && *chp <= '9'; chp++)
@@ -254,7 +254,7 @@ mi_parse (const char *cmd, char **token)
254254 /* This wasn't a real MI command. Return it as a CLI_COMMAND. */
255255 if (*chp != '-')
256256 {
257- chp = skip_spaces_const (chp);
257+ chp = skip_spaces (chp);
258258 parse->command = xstrdup (chp);
259259 parse->op = CLI_COMMAND;
260260
@@ -279,7 +279,7 @@ mi_parse (const char *cmd, char **token)
279279 _("Undefined MI command: %s"), parse->command);
280280
281281 /* Skip white space following the command. */
282- chp = skip_spaces_const (chp);
282+ chp = skip_spaces (chp);
283283
284284 /* Parse the --thread and --frame options, if present. At present,
285285 some important commands, like '-break-*' are implemented by
@@ -352,7 +352,7 @@ mi_parse (const char *cmd, char **token)
352352
353353 option = "--language";
354354 chp += ls;
355- lang_name = extract_arg_const (&chp);
355+ lang_name = extract_arg (&chp);
356356 old_chain = make_cleanup (xfree, lang_name);
357357
358358 parse->language = language_enum (lang_name);
@@ -367,7 +367,7 @@ mi_parse (const char *cmd, char **token)
367367
368368 if (*chp != '\0' && !isspace (*chp))
369369 error (_("Invalid value for the '%s' option"), option);
370- chp = skip_spaces_const (chp);
370+ chp = skip_spaces (chp);
371371 }
372372
373373 /* For new argv commands, attempt to return the parsed argument
--- a/gdb/minsyms.c
+++ b/gdb/minsyms.c
@@ -90,7 +90,7 @@ msymbol_hash_iw (const char *string)
9090
9191 while (*string && *string != '(')
9292 {
93- string = skip_spaces_const (string);
93+ string = skip_spaces (string);
9494 if (*string && *string != '(')
9595 {
9696 hash = SYMBOL_HASH_NEXT (hash, *string);
--- a/gdb/nat/linux-procfs.c
+++ b/gdb/nat/linux-procfs.c
@@ -96,7 +96,7 @@ enum proc_state
9696 static enum proc_state
9797 parse_proc_status_state (const char *state)
9898 {
99- state = skip_spaces_const (state);
99+ state = skip_spaces (state);
100100
101101 switch (state[0])
102102 {
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -2447,7 +2447,7 @@ ui_printf (const char *arg, struct ui_file *stream)
24472447 if (s == 0)
24482448 error_no_arg (_("format-control string and values to print"));
24492449
2450- s = skip_spaces_const (s);
2450+ s = skip_spaces (s);
24512451
24522452 /* A format string should follow, enveloped in double quotes. */
24532453 if (*s++ != '"')
@@ -2460,14 +2460,14 @@ ui_printf (const char *arg, struct ui_file *stream)
24602460 if (*s++ != '"')
24612461 error (_("Bad format string, non-terminated '\"'."));
24622462
2463- s = skip_spaces_const (s);
2463+ s = skip_spaces (s);
24642464
24652465 if (*s != ',' && *s != 0)
24662466 error (_("Invalid argument syntax"));
24672467
24682468 if (*s == ',')
24692469 s++;
2470- s = skip_spaces_const (s);
2470+ s = skip_spaces (s);
24712471
24722472 {
24732473 int nargs = 0;
--- a/gdb/probe.c
+++ b/gdb/probe.c
@@ -558,12 +558,12 @@ parse_probe_linespec (const char *str, char **provider,
558558 {
559559 *probe_name = *objname = NULL;
560560
561- *provider = extract_arg_const (&str);
561+ *provider = extract_arg (&str);
562562 if (*provider != NULL)
563563 {
564- *probe_name = extract_arg_const (&str);
564+ *probe_name = extract_arg (&str);
565565 if (*probe_name != NULL)
566- *objname = extract_arg_const (&str);
566+ *objname = extract_arg (&str);
567567 }
568568 }
569569
--- a/gdb/python/py-breakpoint.c
+++ b/gdb/python/py-breakpoint.c
@@ -673,7 +673,7 @@ bppy_init (PyObject *self, PyObject *args, PyObject *kwargs)
673673 TRY
674674 {
675675 gdb::unique_xmalloc_ptr<char>
676- copy_holder (xstrdup (skip_spaces_const (spec)));
676+ copy_holder (xstrdup (skip_spaces (spec)));
677677 char *copy = copy_holder.get ();
678678
679679 switch (type)
--- a/gdb/record.c
+++ b/gdb/record.c
@@ -431,7 +431,7 @@ get_insn_number (char **arg)
431431 const char *begin, *end, *pos;
432432
433433 begin = *arg;
434- pos = skip_spaces_const (begin);
434+ pos = skip_spaces (begin);
435435
436436 if (!isdigit (*pos))
437437 error (_("Expected positive number, got: %s."), pos);
--- a/gdb/rust-exp.y
+++ b/gdb/rust-exp.y
@@ -1515,7 +1515,7 @@ lex_number (void)
15151515 gdb_assert (subexps[0].rm_eo > 0);
15161516 if (lexptr[subexps[0].rm_eo - 1] == '.')
15171517 {
1518- const char *next = skip_spaces_const (&lexptr[subexps[0].rm_eo]);
1518+ const char *next = skip_spaces (&lexptr[subexps[0].rm_eo]);
15191519
15201520 if (rust_identifier_start_p (*next) || *next == '.')
15211521 {
--- a/gdb/serial.c
+++ b/gdb/serial.c
@@ -212,7 +212,7 @@ serial_open (const char *name)
212212 ops = serial_interface_lookup ("pipe");
213213 /* Discard ``|'' and any space before the command itself. */
214214 ++open_name;
215- open_name = skip_spaces_const (open_name);
215+ open_name = skip_spaces (open_name);
216216 }
217217 /* Check for a colon, suggesting an IP address/port pair.
218218 Do this *after* checking for all the interesting prefixes. We
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -1285,7 +1285,7 @@ parse_frame_specification (const char *frame_exp, int *selected_frame_p)
12851285 const char *p;
12861286
12871287 /* Skip leading white space, bail of EOL. */
1288- frame_exp = skip_spaces_const (frame_exp);
1288+ frame_exp = skip_spaces (frame_exp);
12891289 if (!*frame_exp)
12901290 break;
12911291
--- a/gdb/stap-probe.c
+++ b/gdb/stap-probe.c
@@ -769,7 +769,7 @@ stap_parse_single_operand (struct stap_parse_info *p)
769769 We handle the register displacement here, and the other cases
770770 recursively. */
771771 if (p->inside_paren_p)
772- tmp = skip_spaces_const (tmp);
772+ tmp = skip_spaces (tmp);
773773
774774 while (isdigit (*tmp))
775775 {
@@ -818,7 +818,7 @@ stap_parse_single_operand (struct stap_parse_info *p)
818818 tmp = endp;
819819
820820 if (p->inside_paren_p)
821- tmp = skip_spaces_const (tmp);
821+ tmp = skip_spaces (tmp);
822822
823823 /* If "stap_is_integer_prefix" returns true, it means we can
824824 accept integers without a prefix here. But we also need to
@@ -901,7 +901,7 @@ stap_parse_argument_conditionally (struct stap_parse_info *p)
901901 have to parse it as it was a separate expression, without
902902 left-side or precedence. */
903903 ++p->arg;
904- p->arg = skip_spaces_const (p->arg);
904+ p->arg = skip_spaces (p->arg);
905905 ++p->inside_paren_p;
906906
907907 stap_parse_argument_1 (p, 0, STAP_OPERAND_PREC_NONE);
@@ -913,7 +913,7 @@ stap_parse_argument_conditionally (struct stap_parse_info *p)
913913
914914 ++p->arg;
915915 if (p->inside_paren_p)
916- p->arg = skip_spaces_const (p->arg);
916+ p->arg = skip_spaces (p->arg);
917917 }
918918 else
919919 error (_("Cannot parse expression `%s'."), p->saved_arg);
@@ -935,7 +935,7 @@ stap_parse_argument_1 (struct stap_parse_info *p, int has_lhs,
935935 gdb_assert (p->arg != NULL);
936936
937937 if (p->inside_paren_p)
938- p->arg = skip_spaces_const (p->arg);
938+ p->arg = skip_spaces (p->arg);
939939
940940 if (!has_lhs)
941941 {
@@ -981,7 +981,7 @@ stap_parse_argument_1 (struct stap_parse_info *p, int has_lhs,
981981
982982 p->arg = tmp_exp_buf;
983983 if (p->inside_paren_p)
984- p->arg = skip_spaces_const (p->arg);
984+ p->arg = skip_spaces (p->arg);
985985
986986 /* Parse the right-side of the expression. */
987987 stap_parse_argument_conditionally (p);
@@ -1074,7 +1074,7 @@ stap_parse_argument (const char **arg, struct type *atype,
10741074
10751075 reallocate_expout (&p.pstate);
10761076
1077- p.arg = skip_spaces_const (p.arg);
1077+ p.arg = skip_spaces (p.arg);
10781078 *arg = p.arg;
10791079
10801080 /* We can safely return EXPOUT here. */
@@ -1189,7 +1189,7 @@ stap_parse_probe_arguments (struct stap_probe *probe, struct gdbarch *gdbarch)
11891189 arg.aexpr = expr;
11901190
11911191 /* Start it over again. */
1192- cur = skip_spaces_const (cur);
1192+ cur = skip_spaces (cur);
11931193
11941194 VEC_safe_push (stap_probe_arg_s, probe->args_u.vec, &arg);
11951195 }
--- a/gdb/tid-parse.c
+++ b/gdb/tid-parse.c
@@ -229,7 +229,7 @@ tid_range_parser::get_tid_or_range (int *inf_num,
229229 {
230230 /* Setup the number range parser to return numbers in the
231231 whole [1,INT_MAX] range. */
232- m_range_parser.setup_range (1, INT_MAX, skip_spaces_const (p + 1));
232+ m_range_parser.setup_range (1, INT_MAX, skip_spaces (p + 1));
233233 m_state = STATE_STAR_RANGE;
234234 }
235235 else
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -618,7 +618,7 @@ decode_agent_options (const char *exp, int *trace_string)
618618 else
619619 error (_("Undefined collection format \"%c\"."), *exp);
620620
621- exp = skip_spaces_const (exp);
621+ exp = skip_spaces (exp);
622622
623623 return exp;
624624 }
@@ -685,7 +685,7 @@ validate_actionline (const char *line, struct breakpoint *b)
685685 if (line == NULL)
686686 return;
687687
688- p = skip_spaces_const (line);
688+ p = skip_spaces (line);
689689
690690 /* Symbol lookup etc. */
691691 if (*p == '\0') /* empty line: just prompt for another line. */
@@ -708,7 +708,7 @@ validate_actionline (const char *line, struct breakpoint *b)
708708 do
709709 { /* Repeat over a comma-separated list. */
710710 QUIT; /* Allow user to bail out with ^C. */
711- p = skip_spaces_const (p);
711+ p = skip_spaces (p);
712712
713713 if (*p == '$') /* Look for special pseudo-symbols. */
714714 {
@@ -771,7 +771,7 @@ validate_actionline (const char *line, struct breakpoint *b)
771771 do
772772 { /* Repeat over a comma-separated list. */
773773 QUIT; /* Allow user to bail out with ^C. */
774- p = skip_spaces_const (p);
774+ p = skip_spaces (p);
775775
776776 tmp_p = p;
777777 for (loc = t->loc; loc; loc = loc->next)
@@ -801,7 +801,7 @@ validate_actionline (const char *line, struct breakpoint *b)
801801 {
802802 char *endp;
803803
804- p = skip_spaces_const (p);
804+ p = skip_spaces (p);
805805 t->step_count = strtol (p, &endp, 0);
806806 if (endp == p || t->step_count == 0)
807807 error (_("while-stepping step count `%s' is malformed."), line);
@@ -1311,7 +1311,7 @@ encode_actions_1 (struct command_line *action,
13111311 {
13121312 QUIT; /* Allow user to bail out with ^C. */
13131313 action_exp = action->line;
1314- action_exp = skip_spaces_const (action_exp);
1314+ action_exp = skip_spaces (action_exp);
13151315
13161316 cmd = lookup_cmd (&action_exp, cmdlist, "", -1, 1);
13171317 if (cmd == 0)
@@ -1327,7 +1327,7 @@ encode_actions_1 (struct command_line *action,
13271327 do
13281328 { /* Repeat over a comma-separated list. */
13291329 QUIT; /* Allow user to bail out with ^C. */
1330- action_exp = skip_spaces_const (action_exp);
1330+ action_exp = skip_spaces (action_exp);
13311331
13321332 if (0 == strncasecmp ("$reg", action_exp, 4))
13331333 {
@@ -1487,7 +1487,7 @@ encode_actions_1 (struct command_line *action,
14871487 do
14881488 { /* Repeat over a comma-separated list. */
14891489 QUIT; /* Allow user to bail out with ^C. */
1490- action_exp = skip_spaces_const (action_exp);
1490+ action_exp = skip_spaces (action_exp);
14911491
14921492 {
14931493 struct cleanup *old_chain1 = NULL;
@@ -2733,7 +2733,7 @@ trace_dump_actions (struct command_line *action,
27332733
27342734 QUIT; /* Allow user to bail out with ^C. */
27352735 action_exp = action->line;
2736- action_exp = skip_spaces_const (action_exp);
2736+ action_exp = skip_spaces (action_exp);
27372737
27382738 /* The collection actions to be done while stepping are
27392739 bracketed by the commands "while-stepping" and "end". */
@@ -2776,7 +2776,7 @@ trace_dump_actions (struct command_line *action,
27762776 QUIT; /* Allow user to bail out with ^C. */
27772777 if (*action_exp == ',')
27782778 action_exp++;
2779- action_exp = skip_spaces_const (action_exp);
2779+ action_exp = skip_spaces (action_exp);
27802780
27812781 next_comma = strchr (action_exp, ',');
27822782