diff options
author | Pedro Alves <palves@redhat.com> | 2017-04-05 19:21:36 +0100 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2017-04-05 19:21:36 +0100 |
commit | 63160a43508fb50d9013df061b2191de71f67b50 (patch) | |
tree | 8bb51f1a9eb796916af8ebaeb56e71e966ead758 /gdb/breakpoint.h | |
parent | 9b2eba3dcc6b41f17180e1aee29ed133f942c733 (diff) | |
download | gdb-63160a43508fb50d9013df061b2191de71f67b50.zip gdb-63160a43508fb50d9013df061b2191de71f67b50.tar.gz gdb-63160a43508fb50d9013df061b2191de71f67b50.tar.bz2 |
-Wwrite-strings: Some constification in gdb/breakpoint.c
The main motivation here is avoiding having to write a couple casts
like these:
if (!arg)
- arg = "";
+ arg = (char *) "";
in catch_exception_command_1 and catch_exec_command_1.
That requires making ep_parse_optional_if_clause and
check_for_argument take pointers to const strings. I then tried
propagating the resulting constification all the way, but that was
spiraling out of control, so instead I settled for keeping const and
non-const overloads.
gdb/ChangeLog:
2017-04-05 Pedro Alves <palves@redhat.com>
* break-catch-throw.c (handle_gnu_v3_exceptions): Constify
'cond_string' parameter.
(extract_exception_regexp): Constify 'string' parameter.
(catch_exception_command_1): Constify.
* breakpoint.c (init_catchpoint)
(create_fork_vfork_event_catchpoint): Constify 'cond_string'
parameter.
(ep_parse_optional_if_clause, catch_fork_command_1)
(catch_exec_command_1): Constify.
* breakpoint.h (init_catchpoint): Constify 'cond_string'
parameter.
(ep_parse_optional_if_clause): Constify.
* cli/cli-utils.c (remove_trailing_whitespace)
(check_for_argument): Constify.
* cli/cli-utils.h (remove_trailing_whitespace): Constify and add
non-const overload.
(check_for_argument): Likewise.
Diffstat (limited to 'gdb/breakpoint.h')
-rw-r--r-- | gdb/breakpoint.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index 7d08057..6940270 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -1295,7 +1295,7 @@ extern void extern void init_catchpoint (struct breakpoint *b, struct gdbarch *gdbarch, int tempflag, - char *cond_string, + const char *cond_string, const struct breakpoint_ops *ops); /* Add breakpoint B on the breakpoint list, and notify the user, the @@ -1641,7 +1641,7 @@ extern struct gdbarch *get_sal_arch (struct symtab_and_line sal); extern void breakpoint_free_objfile (struct objfile *objfile); -extern char *ep_parse_optional_if_clause (char **arg); +extern const char *ep_parse_optional_if_clause (const char **arg); /* Print the "Thread ID hit" part of "Thread ID hit Breakpoint N" to UIOUT iff debugging multiple threads. */ |