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 <tom@tromey.com>
This commit is contained in:
Andrew Burgess 2023-03-30 13:25:59 +01:00
parent 7492eb9f54
commit 131287d950
2 changed files with 6 additions and 6 deletions

View File

@ -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

View File

@ -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);
}