diff options
author | Pedro Alves <palves@redhat.com> | 2017-04-05 19:21:33 +0100 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2017-04-05 19:21:33 +0100 |
commit | bde6261aed330cd8d108c387bfe659a6171525dd (patch) | |
tree | 48d29babc116b1f69d5ec97969b87288f581efef /gdb/tracepoint.c | |
parent | b38ef47f47bda5509babd768092ceb09ab98828d (diff) | |
download | gdb-bde6261aed330cd8d108c387bfe659a6171525dd.zip gdb-bde6261aed330cd8d108c387bfe659a6171525dd.tar.gz gdb-bde6261aed330cd8d108c387bfe659a6171525dd.tar.bz2 |
-Wwrite-strings: Don't initialize string command variables to empty string
-Wwrite-strings flags these initializations as requiring a cast.
However, these variables are command variables, and as such point to
heap-allocated memory. The initial allocation is always done when the
corresponding command is registered. E.g.,:
dprintf_function = xstrdup ("printf");
add_setshow_string_cmd ("dprintf-function", class_support,
&dprintf_function, _("\
Set the function to use for dynamic printf"), _("\
Show the function to use for dynamic printf"), NULL,
update_dprintf_commands, NULL,
&setlist, &showlist);
That's why we never reach a bogus attempt to free these string
literals.
So, just drop the incorrect initializations.
gdb/ChangeLog:
2017-04-05 Pedro Alves <palves@redhat.com>
* breakpoint.c (dprintf_function, dprintf_channel): Don't initialize.
* tracepoint.c (default_collect): Don't initialize.
Diffstat (limited to 'gdb/tracepoint.c')
-rw-r--r-- | gdb/tracepoint.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index 2da6fdd..87ef141 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -139,7 +139,7 @@ static struct traceframe_info *traceframe_info; static struct cmd_list_element *tfindlist; /* List of expressions to collect by default at each tracepoint hit. */ -char *default_collect = ""; +char *default_collect; static int disconnected_tracing; |