[PATCH 06/22] Remove verbosity from ui_out_message and friends

Simon Marchi
2016-11-24T15:24:41Z

That concept is never actually used, so it's just a burden. Removing it
facilitates the refactoring in upcoming patches.

gdb/ChangeLog:

* mi/mi-out.c (mi_message): Remove verbosity argument.
* ada-tasks.c (print_ada_task_info, info_task, task_command):
Update call.
* auto-load.c (auto_load_info_scripts): Likewise.
* breakpoint.c (breakpoint_1, watchpoints_info, tracepoints_info):
Likewise.
* cli-out.c (cli_message): Remove verbosity argument.
* inferior.c (print_inferior): Update call.
* linux-thread-db.c (info_auto_load_libthread_db): Likewise.
* probe.c (info_probes_for_ops): Likewise.
* skip.c (skip_info): Likewise.
* solib.c (info_sharedlibrary_command): Likewise.
* symfile.c (load_progress): Likewise.
* thread.c (print_thread_info_1): Likewise.
* ui-out.c (uo_message, ui_out_message): Remove verbosity argument.
(ui_out_get_verblvl): Remove.
* ui-out.h (ui_out_message): Remove verbosity argument.
(ui_out_get_verblvl): Remove.
(message_ftype): Remove verbosity argument.
---
gdb/ada-tasks.c | 6 +++---
gdb/auto-load.c | 4 ++--
gdb/breakpoint.c | 12 ++++++------
gdb/cli-out.c | 13 ++++---------
gdb/inferior.c | 2 +-
gdb/linux-thread-db.c | 2 +-
gdb/mi/mi-out.c | 8 +++-----
gdb/probe.c | 14 +++++++-------
gdb/skip.c | 4 ++--
gdb/solib.c | 6 +++---
gdb/symfile.c | 2 +-
gdb/thread.c | 8 ++++----
gdb/ui-out.c | 23 ++++++-----------------
gdb/ui-out.h | 11 ++++-------
14 files changed, 47 insertions(+), 68 deletions(-)

diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c
index c067ae6..31092fd 100644
--- a/gdb/ada-tasks.c
+++ b/gdb/ada-tasks.c
@@ -1013,7 +1013,7 @@ print_ada_task_info (struct ui_out *uiout,

if (ada_build_task_list () == 0)
{
- ui_out_message (uiout, 0,
+ ui_out_message (uiout,
_("Your application does not use any Ada tasks.\n"));
return;
}
@@ -1163,7 +1163,7 @@ info_task (struct ui_out *uiout, char *taskno_str, struct inferior *inf)

if (ada_build_task_list () == 0)
{
- ui_out_message (uiout, 0,
+ ui_out_message (uiout,
_("Your application does not use any Ada tasks.\n"));
return;
}
@@ -1328,7 +1328,7 @@ task_command (char *taskno_str, int from_tty)

if (ada_build_task_list () == 0)
{
- ui_out_message (uiout, 0,
+ ui_out_message (uiout,
_("Your application does not use any Ada tasks.\n"));
return;
}
diff --git a/gdb/auto-load.c b/gdb/auto-load.c
index de64112..958c24e 100644
--- a/gdb/auto-load.c
+++ b/gdb/auto-load.c
@@ -1401,10 +1401,10 @@ auto_load_info_scripts (char *pattern, int from_tty,
if (nr_scripts == 0)
{
if (pattern && *pattern)
- ui_out_message (uiout, 0, "No auto-load scripts matching %s.\n",
+ ui_out_message (uiout, "No auto-load scripts matching %s.\n",
pattern);
else
- ui_out_message (uiout, 0, "No auto-load scripts.\n");
+ ui_out_message (uiout, "No auto-load scripts.\n");
}
}

diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 67b610c..89ae6c5 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -6954,9 +6954,9 @@ breakpoint_1 (char *args, int allflag,
if (!filter)
{
if (args == NULL || *args == '\0')
- ui_out_message (uiout, 0, "No breakpoints or watchpoints.\n");
+ ui_out_message (uiout, "No breakpoints or watchpoints.\n");
else
- ui_out_message (uiout, 0,
+ ui_out_message (uiout,
"No breakpoint or watchpoint matching '%s'.\n",
args);
}
@@ -7012,9 +7012,9 @@ watchpoints_info (char *args, int from_tty)
if (num_printed == 0)
{
if (args == NULL || *args == '\0')
- ui_out_message (uiout, 0, "No watchpoints.\n");
+ ui_out_message (uiout, "No watchpoints.\n");
else
- ui_out_message (uiout, 0, "No watchpoint matching '%s'.\n", args);
+ ui_out_message (uiout, "No watchpoint matching '%s'.\n", args);
}
}

@@ -15478,9 +15478,9 @@ tracepoints_info (char *args, int from_tty)
if (num_printed == 0)
{
if (args == NULL || *args == '\0')
- ui_out_message (uiout, 0, "No tracepoints.\n");
+ ui_out_message (uiout, "No tracepoints.\n");
else
- ui_out_message (uiout, 0, "No tracepoint matching '%s'.\n", args);
+ ui_out_message (uiout, "No tracepoint matching '%s'.\n", args);
}

default_collect_info ();
diff --git a/gdb/cli-out.c b/gdb/cli-out.c
index d208207..e882756 100644
--- a/gdb/cli-out.c
+++ b/gdb/cli-out.c
@@ -272,21 +272,16 @@ cli_text (struct ui_out *uiout, const char *string)
fputs_filtered (string, stream);
}

-static void ATTRIBUTE_PRINTF (3, 0)
-cli_message (struct ui_out *uiout, int verbosity,
- const char *format, va_list args)
+static void ATTRIBUTE_PRINTF (2, 0)
+cli_message (struct ui_out *uiout, const char *format, va_list args)
{
cli_out_data *data = (cli_out_data *) ui_out_data (uiout);

if (data->suppress_output)
return;

- if (ui_out_get_verblvl (uiout) >= verbosity)
- {
- struct ui_file *stream = VEC_last (ui_filep, data->streams);
-
- vfprintf_unfiltered (stream, format, args);
- }
+ struct ui_file *stream = VEC_last (ui_filep, data->streams);
+ vfprintf_unfiltered (stream, format, args);
}

static void
diff --git a/gdb/inferior.c b/gdb/inferior.c
index 92a18d6..0abd2c0 100644
--- a/gdb/inferior.c
+++ b/gdb/inferior.c
@@ -594,7 +594,7 @@ print_inferior (struct ui_out *uiout, char *requested_inferiors)

if (inf_count == 0)
{
- ui_out_message (uiout, 0, "No inferiors.\n");
+ ui_out_message (uiout, "No inferiors.\n");
return;
}

diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c
index 6ed3997..c1626ff 100644
--- a/gdb/linux-thread-db.c
+++ b/gdb/linux-thread-db.c
@@ -1668,7 +1668,7 @@ info_auto_load_libthread_db (char *args, int from_tty)
do_cleanups (back_to);

if (info_count == 0)
- ui_out_message (uiout, 0, _("No auto-loaded libthread-db.\n"));
+ ui_out_message (uiout, _("No auto-loaded libthread-db.\n"));
}

static void
diff --git a/gdb/mi/mi-out.c b/gdb/mi/mi-out.c
index 960529c..44e28b1 100644
--- a/gdb/mi/mi-out.c
+++ b/gdb/mi/mi-out.c
@@ -62,9 +62,8 @@ static void mi_field_fmt (struct ui_out *uiout, int fldno,
va_list args) ATTRIBUTE_PRINTF (6, 0);
static void mi_spaces (struct ui_out *uiout, int numspaces);
static void mi_text (struct ui_out *uiout, const char *string);
-static void mi_message (struct ui_out *uiout, int verbosity,
- const char *format, va_list args)
- ATTRIBUTE_PRINTF (3, 0);
+static void mi_message (struct ui_out *uiout, const char *format, va_list args)
+ ATTRIBUTE_PRINTF (2, 0);
static void mi_wrap_hint (struct ui_out *uiout, const char *identstring);
static void mi_flush (struct ui_out *uiout);
static int mi_redirect (struct ui_out *uiout, struct ui_file *outstream);
@@ -267,8 +266,7 @@ mi_text (struct ui_out *uiout, const char *string)
}

void
-mi_message (struct ui_out *uiout, int verbosity,
- const char *format, va_list args)
+mi_message (struct ui_out *uiout, const char *format, va_list args)
{
}

diff --git a/gdb/probe.c b/gdb/probe.c
index 285f4e1..611a752 100644
--- a/gdb/probe.c
+++ b/gdb/probe.c
@@ -717,7 +717,7 @@ info_probes_for_ops (const char *arg, int from_tty,
do_cleanups (cleanup);

if (!any_found)
- ui_out_message (current_uiout, 0, _("No probes matched.\n"));
+ ui_out_message (current_uiout, _("No probes matched.\n"));
}

/* Implementation of the `info probes' command. */
@@ -747,7 +747,7 @@ enable_probes_command (char *arg, int from_tty)
probes = collect_probes (objname, provider, probe_name, NULL);
if (VEC_empty (bound_probe_s, probes))
{
- ui_out_message (current_uiout, 0, _("No probes matched.\n"));
+ ui_out_message (current_uiout, _("No probes matched.\n"));
do_cleanups (cleanup);
return;
}
@@ -761,12 +761,12 @@ enable_probes_command (char *arg, int from_tty)
if (pops->enable_probe != NULL)
{
pops->enable_probe (probe->probe);
- ui_out_message (current_uiout, 0,
+ ui_out_message (current_uiout,
_("Probe %s:%s enabled.\n"),
probe->probe->provider, probe->probe->name);
}
else
- ui_out_message (current_uiout, 0,
+ ui_out_message (current_uiout,
_("Probe %s:%s cannot be enabled.\n"),
probe->probe->provider, probe->probe->name);
}
@@ -793,7 +793,7 @@ disable_probes_command (char *arg, int from_tty)
probes = collect_probes (objname, provider, probe_name, NULL /* pops */);
if (VEC_empty (bound_probe_s, probes))
{
- ui_out_message (current_uiout, 0, _("No probes matched.\n"));
+ ui_out_message (current_uiout, _("No probes matched.\n"));
do_cleanups (cleanup);
return;
}
@@ -807,12 +807,12 @@ disable_probes_command (char *arg, int from_tty)
if (pops->disable_probe != NULL)
{
pops->disable_probe (probe->probe);
- ui_out_message (current_uiout, 0,
+ ui_out_message (current_uiout,
_("Probe %s:%s disabled.\n"),
probe->probe->provider, probe->probe->name);
}
else
- ui_out_message (current_uiout, 0,
+ ui_out_message (current_uiout,
_("Probe %s:%s cannot be disabled.\n"),
probe->probe->provider, probe->probe->name);
}
diff --git a/gdb/skip.c b/gdb/skip.c
index 15681cc..fa0f0c9 100644
--- a/gdb/skip.c
+++ b/gdb/skip.c
@@ -373,10 +373,10 @@ skip_info (char *arg, int from_tty)
if (num_printable_entries == 0)
{
if (arg == NULL)
- ui_out_message (current_uiout, 0, _("\
+ ui_out_message (current_uiout, _("\
Not skipping any files or functions.\n"));
else
- ui_out_message (current_uiout, 0,
+ ui_out_message (current_uiout,
_("No skiplist entries found with number %s.\n"), arg);

return;
diff --git a/gdb/solib.c b/gdb/solib.c
index 29b25d5..db370e9 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -1163,16 +1163,16 @@ info_sharedlibrary_command (char *pattern, int from_tty)
if (nr_libs == 0)
{
if (pattern)
- ui_out_message (uiout, 0,
+ ui_out_message (uiout,
_("No shared libraries matched.\n"));
else
- ui_out_message (uiout, 0,
+ ui_out_message (uiout,
_("No shared libraries loaded at this time.\n"));
}
else
{
if (so_missing_debug_info)
- ui_out_message (uiout, 0,
+ ui_out_message (uiout,
_("(*): Shared library is missing "
"debugging information.\n"));
}
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 517c277..52f99bf 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -1962,7 +1962,7 @@ load_progress (ULONGEST bytes, void *untyped_arg)
{
/* The write is just starting. Let the user know we've started
this section. */
- ui_out_message (current_uiout, 0, "Loading section %s, size %s lma %s\n",
+ ui_out_message (current_uiout, "Loading section %s, size %s lma %s\n",
args->section_name, hex_string (args->section_size),
paddress (target_gdbarch (), args->lma));
return;
diff --git a/gdb/thread.c b/gdb/thread.c
index 57b20ff..e5d6c5f 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -1231,9 +1231,9 @@ print_thread_info_1 (struct ui_out *uiout, char *requested_threads,
if (n_threads == 0)
{
if (requested_threads == NULL || *requested_threads == '\0')
- ui_out_message (uiout, 0, _("No threads.\n"));
+ ui_out_message (uiout, _("No threads.\n"));
else
- ui_out_message (uiout, 0, _("No threads match '%s'.\n"),
+ ui_out_message (uiout, _("No threads match '%s'.\n"),
requested_threads);
do_cleanups (old_chain);
return;
@@ -1372,12 +1372,12 @@ print_thread_info_1 (struct ui_out *uiout, char *requested_threads,
}

if (!ptid_equal (inferior_ptid, null_ptid) && is_exited (inferior_ptid))
- ui_out_message (uiout, 0, "\n\
+ ui_out_message (uiout, "\n\
The current thread <Thread ID %s> has terminated. See `help thread'.\n",
print_thread_id (inferior_thread ()));
else if (thread_list != NULL
&& ptid_equal (inferior_ptid, null_ptid))
- ui_out_message (uiout, 0, "\n\
+ ui_out_message (uiout, "\n\
No selected thread. See `help thread'.\n");
}
}
diff --git a/gdb/ui-out.c b/gdb/ui-out.c
index 840254d..da979af 100644
--- a/gdb/ui-out.c
+++ b/gdb/ui-out.c
@@ -171,9 +171,9 @@ static void uo_field_fmt (struct ui_out *uiout, int fldno, int width,
ATTRIBUTE_PRINTF (6, 0);
static void uo_spaces (struct ui_out *uiout, int numspaces);
static void uo_text (struct ui_out *uiout, const char *string);
-static void uo_message (struct ui_out *uiout, int verbosity,
+static void uo_message (struct ui_out *uiout,
const char *format, va_list args)
- ATTRIBUTE_PRINTF (3, 0);
+ ATTRIBUTE_PRINTF (2, 0);
static void uo_wrap_hint (struct ui_out *uiout, const char *identstring);
static void uo_flush (struct ui_out *uiout);
static int uo_redirect (struct ui_out *uiout, struct ui_file *outstream);
@@ -496,13 +496,12 @@ ui_out_text (struct ui_out *uiout,
}

void
-ui_out_message (struct ui_out *uiout, int verbosity,
- const char *format,...)
+ui_out_message (struct ui_out *uiout, const char *format, ...)
{
va_list args;

va_start (args, format);
- uo_message (uiout, verbosity, format, args);
+ uo_message (uiout, format, args);
va_end (args);
}

@@ -531,16 +530,6 @@ ui_out_test_flags (struct ui_out *uiout, int mask)
return (uiout->flags & mask);
}

-/* Obtain the current verbosity level (as stablished by the
- 'set verbositylevel' command. */
-
-int
-ui_out_get_verblvl (struct ui_out *uiout)
-{
- /* FIXME: not implemented yet. */
- return 0;
-}
-
int
ui_out_is_mi_like_p (struct ui_out *uiout)
{
@@ -675,13 +664,13 @@ uo_text (struct ui_out *uiout,
}

void
-uo_message (struct ui_out *uiout, int verbosity,
+uo_message (struct ui_out *uiout,
const char *format,
va_list args)
{
if (!uiout->impl->message)
return;
- uiout->impl->message (uiout, verbosity, format, args);
+ uiout->impl->message (uiout, format, args);
}

void
diff --git a/gdb/ui-out.h b/gdb/ui-out.h
index 1865765..baf4e44 100644
--- a/gdb/ui-out.h
+++ b/gdb/ui-out.h
@@ -119,16 +119,13 @@ extern void ui_out_spaces (struct ui_out *uiout, int numspaces);

extern void ui_out_text (struct ui_out *uiout, const char *string);

-extern void ui_out_message (struct ui_out *uiout, int verbosity,
- const char *format, ...)
- ATTRIBUTE_PRINTF (3, 4);
+extern void ui_out_message (struct ui_out *uiout, const char *format, ...)
+ ATTRIBUTE_PRINTF (2, 3);

extern void ui_out_wrap_hint (struct ui_out *uiout, const char *identstring);

extern void ui_out_flush (struct ui_out *uiout);

-extern int ui_out_get_verblvl (struct ui_out *uiout);
-
extern int ui_out_test_flags (struct ui_out *uiout, int mask);

extern int ui_out_query_field (struct ui_out *uiout, int colno,
@@ -183,9 +180,9 @@ typedef void (field_fmt_ftype) (struct ui_out * uiout, int fldno, int width,
typedef void (spaces_ftype) (struct ui_out * uiout, int numspaces);
typedef void (text_ftype) (struct ui_out * uiout,
const char *string);
-typedef void (message_ftype) (struct ui_out * uiout, int verbosity,
+typedef void (message_ftype) (struct ui_out * uiout,
const char *format, va_list args)
- ATTRIBUTE_FPTR_PRINTF(3,0);
+ ATTRIBUTE_FPTR_PRINTF(2,0);
typedef void (wrap_hint_ftype) (struct ui_out * uiout, const char *identstring);
typedef void (flush_ftype) (struct ui_out * uiout);
typedef int (redirect_ftype) (struct ui_out * uiout,
--
2.10.0