diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2016-12-01 16:05:17 -0500 |
---|---|---|
committer | Simon Marchi <simon.marchi@ericsson.com> | 2016-12-01 16:05:17 -0500 |
commit | 33b2fac610fff1255a24763277a4bf77f1b59ef1 (patch) | |
tree | c08dc9784a1383b8d9fce71e923462aef9b5fdec /gdb/ui-out.h | |
parent | 909c0aa5824080c287b390f82726cf5bfb7011e3 (diff) | |
download | gdb-33b2fac610fff1255a24763277a4bf77f1b59ef1.zip gdb-33b2fac610fff1255a24763277a4bf77f1b59ef1.tar.gz gdb-33b2fac610fff1255a24763277a4bf77f1b59ef1.tar.bz2 |
Simplify ui-out level code
Now that we use a vector to store the levels, we don't have to keep a
separate level field in ui_out to keep track of the current level. We
can efficiently derive it from the vector size. That causes a little
change in the meaning of the level, as in they are now 1-based instead
of 0-based (the initial level has the "id" 1 now), but it shouldn't
change anything in the behavior.
Additionally, push_level and pop_level don't really need to return the
new level, making them return void simplifies the code a bit.
Finally, the ui_out_begin/ui_out_end callbacks in the ui_out_impl
interface don't need to be passed the level, it's never actually used.
New in v2:
- Remove or update stale comments.
gdb/ChangeLog:
* ui-out.h (ui_out_begin_ftype): Remove level parameter.
(ui_out_end_ftype): Likewise.
* ui-out.c (struct ui_out) <level>: Replace field with a method
that dynamically computes the result.
(current_level): Get vector's back item instead of using
uiout->level.
(push_level): Make return type void.
(pop_level): Make return type void and update access to
ui_out::level.
(uo_begin): Remove level parameter.
(uo_end): Likewise.
(ui_out_table_begin): Update access to uiout::level.
(ui_out_begin): Don't read return value from push_level, call
uiout->level() instead, update call to uo_begin.
(ui_out_end): Don't read return value from pop_level, update
call to uo_end.
(verify_field): Update access to uiout->level.
(ui_out_new): Don't initialize ui_out::level, call push_level
to push the initial level instead of doing it by hand.
* cli-out.c (cli_begin): Remove level parameter.
(cli_end): Likewise.
* mi/mi-out.c (mi_begin): Likewise.
(mi_end): Likewise.
Diffstat (limited to 'gdb/ui-out.h')
-rw-r--r-- | gdb/ui-out.h | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/gdb/ui-out.h b/gdb/ui-out.h index ed2911d..06c05e2 100644 --- a/gdb/ui-out.h +++ b/gdb/ui-out.h @@ -157,14 +157,12 @@ typedef void (table_header_ftype) (struct ui_out * uiout, int width, enum ui_align align, const std::string &col_name, const std::string &col_hdr); -/* Note: level 0 is the top-level so LEVEL is always greater than - zero. */ + typedef void (ui_out_begin_ftype) (struct ui_out *uiout, enum ui_out_type type, - int level, const char *id); + const char *id); typedef void (ui_out_end_ftype) (struct ui_out *uiout, - enum ui_out_type type, - int level); + enum ui_out_type type); typedef void (field_int_ftype) (struct ui_out * uiout, int fldno, int width, enum ui_align align, const char *fldname, int value); |