Remove newlines from warnings
authorTom Tromey <tromey@adacore.com>
Mon, 3 Jun 2019 14:07:29 +0000 (08:07 -0600)
committerTom Tromey <tromey@adacore.com>
Mon, 10 Jun 2019 13:55:18 +0000 (07:55 -0600)
ARI pointed out that a recent patch introduced a call to "warning"
with a string that ended in a newline:

    https://sourceware.org/ml/gdb-patches/2019-06/msg00000.html

This is generally forbidden, I believe, because warning adds its own
newline.

This patch removes all of the trailing newlines I was able to find.  I
searched for 'warning (.*\\n"' and then fixed the ones where the
newline appeared at the end of the string (some had internal
newlines).

Tested on x86-64 Fedora 29.

gdb/ChangeLog
2019-06-10  Tom Tromey  <tromey@adacore.com>

* m32c-tdep.c (m32c_m16c_address_to_pointer): Don't end warning
with a newline.
* guile/guile.c (handle_boot_error): Don't end warning with a
newline.
* cli/cli-cmds.c (exit_status_set_internal_vars): Don't end
warning with a newline.
* s12z-tdep.c (s12z_skip_prologue): Don't end warning with a
newline.
(s12z_frame_cache): Likewise.
* dwarf-index-cache.c (index_cache::store): Don't end warning with
a newline.
* solib-svr4.c (disable_probes_interface): Don't end warning with
a newline.
* nat/fork-inferior.c (fork_inferior): Don't end warning with a
newline.
* python/python.c (do_finish_initialization): Don't end warning
with a newline.

gdb/gdbserver/ChangeLog
2019-06-10  Tom Tromey  <tromey@adacore.com>

* remote-utils.c (look_up_one_symbol, relocate_instruction): Don't
end warning with a newline.
* linux-s390-low.c (s390_get_wordsize): Don't end warning with a
newline.
* thread-db.c (attach_thread): Don't end warning with a newline.
(thread_db_notice_clone): Likewise.
* tracepoint.c (gdb_agent_helper_thread): Don't end warning with a
newline.
* linux-x86-low.c (x86_get_min_fast_tracepoint_insn_len): Don't
end warning with a newline.

15 files changed:
gdb/ChangeLog
gdb/cli/cli-cmds.c
gdb/dwarf-index-cache.c
gdb/gdbserver/ChangeLog
gdb/gdbserver/linux-s390-low.c
gdb/gdbserver/linux-x86-low.c
gdb/gdbserver/remote-utils.c
gdb/gdbserver/thread-db.c
gdb/gdbserver/tracepoint.c
gdb/guile/guile.c
gdb/m32c-tdep.c
gdb/nat/fork-inferior.c
gdb/python/python.c
gdb/s12z-tdep.c
gdb/solib-svr4.c

index 88680732a855de836b711ea9eea1f0dbf5e2acdd..59dde119b70b6cb5b8cd8d6130da293aea16113b 100644 (file)
@@ -1,3 +1,23 @@
+2019-06-10  Tom Tromey  <tromey@adacore.com>
+
+       * m32c-tdep.c (m32c_m16c_address_to_pointer): Don't end warning
+       with a newline.
+       * guile/guile.c (handle_boot_error): Don't end warning with a
+       newline.
+       * cli/cli-cmds.c (exit_status_set_internal_vars): Don't end
+       warning with a newline.
+       * s12z-tdep.c (s12z_skip_prologue): Don't end warning with a
+       newline.
+       (s12z_frame_cache): Likewise.
+       * dwarf-index-cache.c (index_cache::store): Don't end warning with
+       a newline.
+       * solib-svr4.c (disable_probes_interface): Don't end warning with
+       a newline.
+       * nat/fork-inferior.c (fork_inferior): Don't end warning with a
+       newline.
+       * python/python.c (do_finish_initialization): Don't end warning
+       with a newline.
+
 2019-06-10  Tom Tromey  <tom@tromey.com>
 
        * python/py-breakpoint.c (gdbpy_breakpoint_created)
index 09f932c2d218b2535b1a23fa91b7267393d2a79d..5c44ba91287a1b79aa2d38d2b26bffab701231c5 100644 (file)
@@ -686,7 +686,7 @@ exit_status_set_internal_vars (int exit_status)
   else if (WIFSIGNALED (exit_status))
     set_internalvar_integer (var_signal, WTERMSIG (exit_status));
   else
-    warning (_("unexpected shell command exit status %d\n"), exit_status);
+    warning (_("unexpected shell command exit status %d"), exit_status);
 }
 
 static void
index 9513891a45fc9a265fba36747589d0a77ef92c13..7222f0528d7af82bd1d67ac763e2f42b4f9de92e 100644 (file)
@@ -115,7 +115,7 @@ index_cache::store (struct dwarf2_per_objfile *dwarf2_per_objfile)
       /* Try to create the containing directory.  */
       if (!mkdir_recursive (m_dir.c_str ()))
        {
-         warning (_("index cache: could not make cache directory: %s\n"),
+         warning (_("index cache: could not make cache directory: %s"),
                   safe_strerror (errno));
          return;
        }
index bc554bd89c29830269d6a7fb337b482767fefb55..7a7895620eb7bc8e83bd1dcaa929ef3f903f9d51 100644 (file)
@@ -1,3 +1,16 @@
+2019-06-10  Tom Tromey  <tromey@adacore.com>
+
+       * remote-utils.c (look_up_one_symbol, relocate_instruction): Don't
+       end warning with a newline.
+       * linux-s390-low.c (s390_get_wordsize): Don't end warning with a
+       newline.
+       * thread-db.c (attach_thread): Don't end warning with a newline.
+       (thread_db_notice_clone): Likewise.
+       * tracepoint.c (gdb_agent_helper_thread): Don't end warning with a
+       newline.
+       * linux-x86-low.c (x86_get_min_fast_tracepoint_insn_len): Don't
+       end warning with a newline.
+
 2019-06-04  Pedro Alves  <palves@redhat.com>
 
        * server.c (captured_main): Use make_unique_xstrdup.
index f65a1ec38efd0faef3b0a5c7a52a725d54161e5c..b23e3b1af6f14c0a8cf6f474348f91ba85521286 100644 (file)
@@ -479,7 +479,7 @@ s390_get_wordsize (int pid)
                                  (PTRACE_TYPE_ARG4) 0);
   if (errno != 0)
     {
-      warning (_("Couldn't determine word size, assuming 64-bit.\n"));
+      warning (_("Couldn't determine word size, assuming 64-bit."));
       return 8;
     }
   /* Derive word size from extended addressing mode (PSW bit 31).  */
index adddfe779710abc9577a0f57fd912e9e4057866d..e84e7a1793cc2660fcf3969ab784996b4fa93901 100644 (file)
@@ -1481,7 +1481,7 @@ x86_get_min_fast_tracepoint_insn_len (void)
             mention that something has gone awry.  */
          if (!warned_about_fast_tracepoints)
            {
-             warning ("4-byte fast tracepoints not available; %s\n", errbuf);
+             warning ("4-byte fast tracepoints not available; %s", errbuf);
              warned_about_fast_tracepoints = 1;
            }
          return 5;
index 1d27ea31e2cfebf3eaf4932403a6f0f92845d9fd..7c495beb7cd9a6f6704c51190b5903a21606f652 100644 (file)
@@ -1558,7 +1558,7 @@ look_up_one_symbol (const char *name, CORE_ADDR *addrp, int may_ask_gdb)
 
   if (!startswith (cs.own_buf, "qSymbol:"))
     {
-      warning ("Malformed response to qSymbol, ignoring: %s\n", cs.own_buf);
+      warning ("Malformed response to qSymbol, ignoring: %s", cs.own_buf);
       return -1;
     }
 
@@ -1659,14 +1659,14 @@ relocate_instruction (CORE_ADDR *to, CORE_ADDR oldloc)
 
   if (cs.own_buf[0] == 'E')
     {
-      warning ("An error occurred while relocating an instruction: %s\n",
+      warning ("An error occurred while relocating an instruction: %s",
               cs.own_buf);
       return -1;
     }
 
   if (!startswith (cs.own_buf, "qRelocInsn:"))
     {
-      warning ("Malformed response to qRelocInsn, ignoring: %s\n",
+      warning ("Malformed response to qRelocInsn, ignoring: %s",
               cs.own_buf);
       return -1;
     }
index d4d4958c73edf52e7b44ef670971fe8659ffc74a..387f22f487e9e85ce57ac8a5747e333ffd780062 100644 (file)
@@ -227,7 +227,7 @@ attach_thread (const td_thrhandle_t *th_p, td_thrinfo_t *ti_p)
     {
       std::string reason = linux_ptrace_attach_fail_reason_string (ptid, err);
 
-      warning ("Could not attach to thread %ld (LWP %d): %s\n",
+      warning ("Could not attach to thread %ld (LWP %d): %s",
               (unsigned long) ti_p->ti_tid, ti_p->ti_lid, reason.c_str ());
 
       return 0;
@@ -907,5 +907,5 @@ thread_db_notice_clone (struct thread_info *parent_thr, ptid_t child_ptid)
     = make_scoped_restore (&current_thread, parent_thr);
 
   if (!find_one_thread (child_ptid))
-    warning ("Cannot find thread after clone.\n");
+    warning ("Cannot find thread after clone.");
 }
index 9577ab7f1e95a0d5c3c3df1d5bcdd88b2f357752..98d28e9bb281ab77b4a842ca2f73be1eb1aae46a 100644 (file)
@@ -7194,7 +7194,7 @@ gdb_agent_helper_thread (void *arg)
 
       if (listen_fd == -1)
        {
-         warning ("could not create sync socket\n");
+         warning ("could not create sync socket");
          break;
        }
 
@@ -7218,7 +7218,7 @@ gdb_agent_helper_thread (void *arg)
 
          if (fd < 0)
            {
-             warning ("Accept returned %d, error: %s\n",
+             warning ("Accept returned %d, error: %s",
                       fd, strerror (errno));
              break;
            }
index 9247fd64122bdf5ec2b15f2dd22c384d84e3e638..a426c3c640b01de25dad10545651977ccf002017 100644 (file)
@@ -568,7 +568,7 @@ handle_boot_error (void *boot_scm_file, SCM key, SCM args)
   warning (_("Could not complete Guile gdb module initialization from:\n"
             "%s.\n"
             "Limited Guile support is available.\n"
-            "Suggest passing --data-directory=/path/to/gdb/data-directory.\n"),
+            "Suggest passing --data-directory=/path/to/gdb/data-directory."),
           (const char *) boot_scm_file);
 
   return SCM_UNSPECIFIED;
index a28c5d8e81fe7be13e3e132b67a286b693a7f468..657c6b7930f3018ac5274e2388d1032e6d343ecb 100644 (file)
@@ -2452,7 +2452,7 @@ m32c_m16c_address_to_pointer (struct gdbarch *gdbarch,
                   "couldn't find trampoline named '%s.plt'.\n"
                   "Returning pointer value %s instead; this may produce\n"
                   "a useful result if converted back into an address by GDB,\n"
-                  "but will most likely not be useful otherwise.\n"),
+                  "but will most likely not be useful otherwise."),
                   paddress (gdbarch, addr), func_name,
                   paddress (gdbarch, ptrval));
 
index fe9360a503961c83ebc1098dc527d57bbf6d7e54..1179d01c04fafc5e4ce9ca7c78badfc0f2ec7ad0 100644 (file)
@@ -425,7 +425,7 @@ fork_inferior (const char *exec_file_arg, const std::string &allargs,
       for (i = 1; argv[i] != NULL; i++)
        warning (" %s", argv[i]);
 
-      warning ("Error: %s\n", safe_strerror (save_errno));
+      warning ("Error: %s", safe_strerror (save_errno));
 
       _exit (0177);
     }
index 4dad8ec10d19f47b820cfc6d3ebd948a8f8ac51d..98b9467c6eb2d3451c56001a3dcefe3818efc862 100644 (file)
@@ -1876,7 +1876,7 @@ do_finish_initialization (const struct extension_language_defn *extlang)
       warning (_("\n"
                 "Could not load the Python gdb module from `%s'.\n"
                 "Limited Python support is available from the _gdb module.\n"
-                "Suggest passing --data-directory=/path/to/gdb/data-directory.\n"),
+                "Suggest passing --data-directory=/path/to/gdb/data-directory."),
               gdb_pythondir.c_str ());
       /* We return "success" here as we've already emitted the
         warning.  */
index b549862e8425969081907872d347756c791076b4..fa27b58e56efd0eef76e78bd893e91e3dafbb268 100644 (file)
@@ -90,8 +90,8 @@ s12z_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
         return prologue_end;
     }
 
-  warning (_("%s Failed to find end of prologue PC = %08x\n"),
-                      __FUNCTION__, (unsigned int) pc);
+  warning (_("%s Failed to find end of prologue PC = %08x"),
+          __FUNCTION__, (unsigned int) pc);
 
   return pc;
 }
@@ -296,7 +296,7 @@ s12z_frame_cache (struct frame_info *this_frame, void **prologue_cache)
   /* Return early if GDB couldn't find the function.  */
   if (start_addr == 0)
     {
-      warning (_("Couldn't find function including address %s SP is %s\n"),
+      warning (_("Couldn't find function including address %s SP is %s"),
                paddress (gdbarch, this_pc),
                paddress (gdbarch, this_sp));
 
index 2828c96c68355931332c1704035e9a0d8f691fad..8cd5b7d8e7031fd13ea913ac232853b8eef2e2e4 100644 (file)
@@ -1858,7 +1858,7 @@ static void
 disable_probes_interface (svr4_info *info)
 {
   warning (_("Probes-based dynamic linker interface failed.\n"
-            "Reverting to original interface.\n"));
+            "Reverting to original interface."));
 
   free_probes_table (info);
   free_solib_list (info);
This page took 0.041486 seconds and 4 git commands to generate.