public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Andrew Burgess <aburgess@redhat.com>
To: gdb-patches@sourceware.org
Cc: Andrew Burgess <aburgess@redhat.com>
Subject: [PATCH 2/5] gdb: remove some trailing newlines from warning messages
Date: Fri, 31 Mar 2023 21:20:55 +0100	[thread overview]
Message-ID: <665671fabbb2fe3ce05578c0ce26ce7fe3d7f513.1680293848.git.aburgess@redhat.com> (raw)
In-Reply-To: <cover.1680293848.git.aburgess@redhat.com>

While working on a later patch in this series, which tightens up some
of our pattern matching when using gdb_test, I ran into some failures
caused by some warnings having a trailing newline character.

The warning function already adds a trailing newline, and it is my
understanding that we should not be adding a second by including a
newline at the end of any warning message.

The problem cases I found were in language.c and remote.c, in this
patch I fix these cases, and also audited all the warning() calls in
these two files and fixed any additional problems I found.

In remote.c the warning actually had a newline character in the middle
of the warning message (in addition to the trailing newline), which
I've removed.  I don't think it's helpful to forcibly split a warning
as was done here -- in the middle of a sentence.  Additionally, the
message isn't even that long (71 characters), so I think removing this
newline is an improvement.

None of the expected test result need updating with this commit,
currently the patterns in gdb_test will match one or more newline
sequences, so the tests are as happy with one newline (after this
commit) as they are with two newlines (before this commit).  A later
commit will change gdb_test so that it is not so forgiving, and these
warnings would have caused some failures.
---
 gdb/language.c | 8 ++++----
 gdb/remote.c   | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/gdb/language.c b/gdb/language.c
index 50a53c647f5..b7beb112702 100644
--- a/gdb/language.c
+++ b/gdb/language.c
@@ -229,7 +229,7 @@ show_range_command (struct ui_file *file, int from_tty,
       || ((range_check == range_check_on)
 	  != current_language->range_checking_on_by_default ()))
     warning (_("the current range check setting "
-	       "does not match the language.\n"));
+	       "does not match the language."));
 }
 
 /* Set command.  Change the setting for range checking.  */
@@ -266,7 +266,7 @@ set_range_command (const char *ignore,
       || ((range_check == range_check_on)
 	  != current_language->range_checking_on_by_default ()))
     warning (_("the current range check setting "
-	       "does not match the language.\n"));
+	       "does not match the language."));
 }
 
 /* Show command.  Display a warning if the case sensitivity setting does
@@ -303,7 +303,7 @@ show_case_command (struct ui_file *file, int from_tty,
 
   if (case_sensitivity != current_language->case_sensitivity ())
     warning (_("the current case sensitivity setting does not match "
-	       "the language.\n"));
+	       "the language."));
 }
 
 /* Set command.  Change the setting for case sensitivity.  */
@@ -335,7 +335,7 @@ set_case_command (const char *ignore, int from_tty, struct cmd_list_element *c)
 
    if (case_sensitivity != current_language->case_sensitivity ())
      warning (_("the current case sensitivity setting does not match "
-		"the language.\n"));
+		"the language."));
 }
 
 /* Set the status of range and type checking and case sensitivity based on
diff --git a/gdb/remote.c b/gdb/remote.c
index 526df313ea7..f436b8714cf 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -11250,8 +11250,8 @@ compare_sections_command (const char *args, int from_tty)
 	}
     }
   if (mismatched > 0)
-    warning (_("One or more sections of the target image does not match\n\
-the loaded file\n"));
+    warning (_("One or more sections of the target image does "
+	       "not match the loaded file"));
   if (args && !matched)
     gdb_printf (_("No loaded section named '%s'.\n"), args);
 }
-- 
2.25.4


  parent reply	other threads:[~2023-03-31 20:21 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-31 20:20 [PATCH 0/5] gdb/testsuite: stricter matching for gdb_test Andrew Burgess
2023-03-31 20:20 ` [PATCH 1/5] gdb/testsuite: fix occasional failure in gdb.base/clear_non_user_bp.exp Andrew Burgess
2023-03-31 20:20 ` Andrew Burgess [this message]
2023-03-31 20:20 ` [PATCH 3/5] gdb/testsuite: use 'return' in gdb_test_no_output Andrew Burgess
2023-03-31 20:20 ` [PATCH 4/5] gdb/testsuite: change newline patterns used in gdb_test Andrew Burgess
2023-04-27 19:39   ` Simon Marchi
2023-04-28 14:05     ` Andrew Burgess
2023-04-28 15:51     ` Andrew Burgess
2023-04-28 15:57       ` Simon Marchi
2023-04-28 18:37         ` Simon Marchi
2023-04-28 21:50           ` Andrew Burgess
2023-05-02 19:16             ` Simon Marchi
2023-04-29 15:20   ` Tom de Vries
2023-05-01 14:33     ` Andrew Burgess
2023-05-01 15:10       ` Tom de Vries
2023-05-02 11:13         ` Andrew Burgess
2023-05-02 14:48           ` Tom de Vries
2023-05-05 17:01             ` Andrew Burgess
2023-05-09  9:54               ` Andrew Burgess
2023-05-10  7:22                 ` Tom de Vries
2023-05-12 12:54                   ` Andrew Burgess
2023-03-31 20:20 ` [PATCH 5/5] gdb/testsuite: special case '^' in gdb_test pattern Andrew Burgess
2023-04-17 16:12 ` [PATCH 0/5] gdb/testsuite: stricter matching for gdb_test Tom Tromey
2023-04-27 12:58   ` Andrew Burgess

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=665671fabbb2fe3ce05578c0ce26ce7fe3d7f513.1680293848.git.aburgess@redhat.com \
    --to=aburgess@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).