Code cleanup: compile: Constify some parameters
gdb/ChangeLog 2015-05-06 Jan Kratochvil <jan.kratochvil@redhat.com> * compile/compile.c (compile_to_object): Make the cmd_string parameter const. Use new variables for the const compatibility. (eval_compile_command): Make the cmd_string parameter const. * compile/compile.h (eval_compile_command): Make the cmd_string parameter const.
This commit is contained in:
parent
80ad801e90
commit
851c90917f
3 changed files with 19 additions and 7 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2015-05-06 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||||
|
|
||||||
|
* compile/compile.c (compile_to_object): Make the cmd_string parameter
|
||||||
|
const. Use new variables for the const compatibility.
|
||||||
|
(eval_compile_command): Make the cmd_string parameter const.
|
||||||
|
* compile/compile.h (eval_compile_command): Make the cmd_string
|
||||||
|
parameter const.
|
||||||
|
|
||||||
2015-05-06 Joel Brobecker <brobecker@adacore.com>
|
2015-05-06 Joel Brobecker <brobecker@adacore.com>
|
||||||
|
|
||||||
* defs.h (deprecated_init_ui_hook): Delete. Remove associated
|
* defs.h (deprecated_init_ui_hook): Delete. Remove associated
|
||||||
|
|
|
@ -415,11 +415,12 @@ print_callback (void *ignore, const char *message)
|
||||||
freeing both strings. */
|
freeing both strings. */
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
compile_to_object (struct command_line *cmd, char *cmd_string,
|
compile_to_object (struct command_line *cmd, const char *cmd_string,
|
||||||
enum compile_i_scope_types scope,
|
enum compile_i_scope_types scope,
|
||||||
char **source_filep)
|
char **source_filep)
|
||||||
{
|
{
|
||||||
char *code;
|
char *code;
|
||||||
|
const char *input;
|
||||||
char *source_file, *object_file;
|
char *source_file, *object_file;
|
||||||
struct compile_instance *compiler;
|
struct compile_instance *compiler;
|
||||||
struct cleanup *cleanup, *inner_cleanup;
|
struct cleanup *cleanup, *inner_cleanup;
|
||||||
|
@ -459,6 +460,7 @@ compile_to_object (struct command_line *cmd, char *cmd_string,
|
||||||
{
|
{
|
||||||
struct ui_file *stream = mem_fileopen ();
|
struct ui_file *stream = mem_fileopen ();
|
||||||
struct command_line *iter;
|
struct command_line *iter;
|
||||||
|
char *stream_buf;
|
||||||
|
|
||||||
make_cleanup_ui_file_delete (stream);
|
make_cleanup_ui_file_delete (stream);
|
||||||
for (iter = cmd->body_list[0]; iter; iter = iter->next)
|
for (iter = cmd->body_list[0]; iter; iter = iter->next)
|
||||||
|
@ -467,15 +469,16 @@ compile_to_object (struct command_line *cmd, char *cmd_string,
|
||||||
fputs_unfiltered ("\n", stream);
|
fputs_unfiltered ("\n", stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
code = ui_file_xstrdup (stream, NULL);
|
stream_buf = ui_file_xstrdup (stream, NULL);
|
||||||
make_cleanup (xfree, code);
|
make_cleanup (xfree, stream_buf);
|
||||||
|
input = stream_buf;
|
||||||
}
|
}
|
||||||
else if (cmd_string != NULL)
|
else if (cmd_string != NULL)
|
||||||
code = cmd_string;
|
input = cmd_string;
|
||||||
else
|
else
|
||||||
error (_("Neither a simple expression, or a multi-line specified."));
|
error (_("Neither a simple expression, or a multi-line specified."));
|
||||||
|
|
||||||
code = current_language->la_compute_program (compiler, code, gdbarch,
|
code = current_language->la_compute_program (compiler, input, gdbarch,
|
||||||
expr_block, expr_pc);
|
expr_block, expr_pc);
|
||||||
make_cleanup (xfree, code);
|
make_cleanup (xfree, code);
|
||||||
if (compile_debug)
|
if (compile_debug)
|
||||||
|
@ -556,7 +559,7 @@ compile_command (char *args, int from_tty)
|
||||||
/* See compile.h. */
|
/* See compile.h. */
|
||||||
|
|
||||||
void
|
void
|
||||||
eval_compile_command (struct command_line *cmd, char *cmd_string,
|
eval_compile_command (struct command_line *cmd, const char *cmd_string,
|
||||||
enum compile_i_scope_types scope)
|
enum compile_i_scope_types scope)
|
||||||
{
|
{
|
||||||
char *object_file, *source_file;
|
char *object_file, *source_file;
|
||||||
|
|
|
@ -28,7 +28,8 @@ struct dynamic_prop;
|
||||||
expression command. GDB returns either a CMD, or a CMD_STRING, but
|
expression command. GDB returns either a CMD, or a CMD_STRING, but
|
||||||
never both. */
|
never both. */
|
||||||
|
|
||||||
extern void eval_compile_command (struct command_line *cmd, char *cmd_string,
|
extern void eval_compile_command (struct command_line *cmd,
|
||||||
|
const char *cmd_string,
|
||||||
enum compile_i_scope_types scope);
|
enum compile_i_scope_types scope);
|
||||||
|
|
||||||
/* Compile a DWARF location expression to C, suitable for use by the
|
/* Compile a DWARF location expression to C, suitable for use by the
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue