From 131287d950a8cbd6e60eba2a9397a94a6d1a8697 Mon Sep 17 00:00:00 2001 From: Andrew Burgess Date: Thu, 30 Mar 2023 13:25:59 +0100 Subject: gdb: remove some trailing newlines from warning messages 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 the cases I hit, but I also checked all the other warning calls in these two files and removed any additional trailing newlines 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. Reviewed-By: Tom Tromey --- 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 a1bf4d1..0b4202f 100644 --- a/gdb/language.c +++ b/gdb/language.c @@ -235,7 +235,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. */ @@ -272,7 +272,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 @@ -309,7 +309,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. */ @@ -341,7 +341,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 73deea3..8eaa1b2 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); } -- cgit v1.1