]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Simplify warning_pre_print
authorTom Tromey <tromey@adacore.com>
Fri, 31 Jan 2025 21:17:08 +0000 (14:17 -0700)
committerTom Tromey <tromey@adacore.com>
Fri, 21 Mar 2025 15:26:48 +0000 (09:26 -0600)
This changes warning_pre_print to not include the text "warning",
which is now unconditional.  I think this is a bit clearer, and anyway
it is convenient to support the next patch.

Reviewed-By: Keith Seitz <keiths@redhat.com>
gdb/main.c
gdb/utils.c

index d126e98e16f231afbdc0944940fad8c2d3787179..b173eb6b4cbed645a32c462cb464e7247a80e46c 100644 (file)
@@ -705,7 +705,7 @@ captured_main_1 (struct captured_main_args *context)
 
   /* Prefix warning messages with the command name.  */
   gdb::unique_xmalloc_ptr<char> tmp_warn_preprint
-    = xstrprintf ("%s: warning: ", gdb_program_name);
+    = xstrprintf ("%s: ", gdb_program_name);
   warning_pre_print = tmp_warn_preprint.get ();
 
   current_directory = getcwd (NULL, 0);
@@ -1169,7 +1169,7 @@ captured_main_1 (struct captured_main_args *context)
 
   /* Set off error and warning messages with a blank line.  */
   tmp_warn_preprint.reset ();
-  warning_pre_print = _("\nwarning: ");
+  warning_pre_print = "\n";
 
   /* Read and execute the system-wide gdbinit file, if it exists.
      This is done *before* all the command line arguments are
@@ -1274,7 +1274,7 @@ captured_main_1 (struct captured_main_args *context)
     current_inferior ()->set_tty (ttyarg);
 
   /* Error messages should no longer be distinguished with extra output.  */
-  warning_pre_print = _("warning: ");
+  warning_pre_print = "";
 
   /* Read the .gdbinit file in the current directory, *if* it isn't
      the same as the $HOME/.gdbinit file (it should exist, also).  */
index 3d216e1ba13a28859d8b6ff81102f2a3c07da580..ee7cf4d2901072ee81a4ae191d41b4598fbb3aef 100644 (file)
@@ -119,7 +119,7 @@ show_sevenbit_strings (struct ui_file *file, int from_tty,
 
 /* String to be printed before warning messages, if any.  */
 
-const char *warning_pre_print = "\nwarning: ";
+const char *warning_pre_print = "\n";
 
 bool pagination_enabled = true;
 static void
@@ -176,8 +176,8 @@ vwarning (const char *string, va_list args)
          term_state.emplace ();
          target_terminal::ours_for_output ();
        }
-      if (warning_pre_print)
-       gdb_puts (warning_pre_print, gdb_stderr);
+      gdb_puts (warning_pre_print, gdb_stderr);
+      gdb_puts (_("warning: "), gdb_stderr);
       gdb_vprintf (gdb_stderr, string, args);
       gdb_printf (gdb_stderr, "\n");
     }