From 89de4da46b3b3629c51e6e1a37177a6269dc8b05 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Mon, 23 Dec 2013 20:53:23 -0700 Subject: [PATCH] constify ui_out_impl This patch constifies ui_out_impl in struct ui_out, and various instances of ui_out_impl. This removes a couple of FIXME comments (near cli_ui_out_impl and mi_ui_out_impl) that did not make sense to me. Tested by rebuilding. 2014-02-28 Tom Tromey * cli-out.c (cli_ui_out_impl): Now const. Remove comment. * cli-out.h (cli_ui_out_impl): Now const. * mi/mi-out.c (mi_ui_out_impl): Now const. Remove comment. * ui-out.c (struct ui_out) : Now const. (default_ui_out_impl): Now const. (ui_out_new): Make 'impl' parameter const. * ui-out.h (ui_out_new): Update. --- gdb/ChangeLog | 10 ++++++++++ gdb/cli-out.c | 5 +---- gdb/cli-out.h | 2 +- gdb/mi/mi-out.c | 5 +---- gdb/ui-out.c | 6 +++--- gdb/ui-out.h | 2 +- 6 files changed, 17 insertions(+), 13 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index c99510c5979..2c615be3f19 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,13 @@ +2014-02-28 Tom Tromey + + * cli-out.c (cli_ui_out_impl): Now const. Remove comment. + * cli-out.h (cli_ui_out_impl): Now const. + * mi/mi-out.c (mi_ui_out_impl): Now const. Remove comment. + * ui-out.c (struct ui_out) : Now const. + (default_ui_out_impl): Now const. + (ui_out_new): Make 'impl' parameter const. + * ui-out.h (ui_out_new): Update. + 2014-02-27 Mark Kettenis * solib-svr4.c (svr4_read_so_list): Initialize first_l_name to 0. diff --git a/gdb/cli-out.c b/gdb/cli-out.c index b936f30a93d..5943fa79be1 100644 --- a/gdb/cli-out.c +++ b/gdb/cli-out.c @@ -349,10 +349,7 @@ field_separator (void) /* This is the CLI ui-out implementation functions vector */ -/* FIXME: This can be initialized dynamically after default is set to - handle initial output in main.c */ - -struct ui_out_impl cli_ui_out_impl = +const struct ui_out_impl cli_ui_out_impl = { cli_table_begin, cli_table_body, diff --git a/gdb/cli-out.h b/gdb/cli-out.h index db7824d6f1b..a5928904413 100644 --- a/gdb/cli-out.h +++ b/gdb/cli-out.h @@ -37,7 +37,7 @@ struct cli_ui_out_data int suppress_output; }; -extern struct ui_out_impl cli_ui_out_impl; +extern const struct ui_out_impl cli_ui_out_impl; extern struct ui_out *cli_out_new (struct ui_file *stream); diff --git a/gdb/mi/mi-out.c b/gdb/mi/mi-out.c index a8a3d8dcde3..6ec41e6aab2 100644 --- a/gdb/mi/mi-out.c +++ b/gdb/mi/mi-out.c @@ -67,10 +67,7 @@ static int mi_redirect (struct ui_out *uiout, struct ui_file *outstream); /* This is the MI ui-out implementation functions vector */ -/* FIXME: This can be initialized dynamically after default is set to - handle initial output in main.c */ - -struct ui_out_impl mi_ui_out_impl = +static const struct ui_out_impl mi_ui_out_impl = { mi_table_begin, mi_table_body, diff --git a/gdb/ui-out.c b/gdb/ui-out.c index a5913527ddb..2edb1405002 100644 --- a/gdb/ui-out.c +++ b/gdb/ui-out.c @@ -102,7 +102,7 @@ struct ui_out { int flags; /* Specific implementation of ui-out. */ - struct ui_out_impl *impl; + const struct ui_out_impl *impl; void *data; /* Current level. */ @@ -198,7 +198,7 @@ static void default_data_destroy (struct ui_out *uiout); /* This is the default ui-out implementation functions vector. */ -struct ui_out_impl default_ui_out_impl = +const struct ui_out_impl default_ui_out_impl = { default_table_begin, default_table_body, @@ -1095,7 +1095,7 @@ ui_out_query_field (struct ui_out *uiout, int colno, /* Initalize private members at startup. */ struct ui_out * -ui_out_new (struct ui_out_impl *impl, void *data, +ui_out_new (const struct ui_out_impl *impl, void *data, int flags) { struct ui_out *uiout = XNEW (struct ui_out); diff --git a/gdb/ui-out.h b/gdb/ui-out.h index 27e68016c6e..cbd0b9b5d15 100644 --- a/gdb/ui-out.h +++ b/gdb/ui-out.h @@ -234,7 +234,7 @@ extern void uo_field_string (struct ui_out *uiout, int fldno, int width, /* Create a ui_out object */ -extern struct ui_out *ui_out_new (struct ui_out_impl *impl, +extern struct ui_out *ui_out_new (const struct ui_out_impl *impl, void *data, int flags); -- 2.30.2