Remove trailing newlines from help text

Message ID 20190604122329.28127-1-tromey@adacore.com
State New
Headers show
Series
  • Remove trailing newlines from help text
Related show

Commit Message

Tom Tromey June 4, 2019, 12:23 p.m.
I noticed recently that some command had a trailing newline in its
"help" output.  So, I temporarily hacked cli-decode.c to print
something when a new command was installed that had a trailing newline
in its help message, and wrote this patch, which removes all the ones
I could find this way.  (There could still be a few more in *-nat
files.)

Tested on x86-64 Fedora 29.

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

	* infcall.c (_initialize_infcall): Remove trailing newline from
	help.
	* user-regs.c (_initialize_user_regs): Remove trailing newline
	from help.
	* typeprint.c (_initialize_typeprint): Remove trailing newline
	from help.
	* reverse.c (_initialize_reverse): Remove trailing newlines from
	help.
	* tracepoint.c (_initialize_tracepoint): Remove trailing newlines
	from help.
	* language.c (add_set_language_command): Remove trailing newline
	from help.
	* infcmd.c (_initialize_infcmd): Remove trailing newlines from
	help.
	* disasm.c (_initialize_disasm): Remove trailing newline from
	help.
	* top.c (init_main): Remove trailing newline from help.
	* interps.c (_initialize_interpreter): Remove trailing newline
	from help.
	* btrace.c (_initialize_btrace): Remove trailing newlines from
	help.
	* breakpoint.c (_initialize_breakpoint): Remove trailing newline
	from help.
	* python/python.c (_initialize_python): Remove trailing newline
	from help.
	* spu-tdep.c (_initialize_spu_tdep): Remove trailing newlines from
	help.
	* tui/tui-win.c (_initialize_tui_win): Remove trailing newlines
	from help.  Reformat some text.
	* tui/tui-stack.c (_initialize_tui_stack): Remove trailing newline
	from help.
	* tui/tui-layout.c (_initialize_tui_layout): Remove trailing
	newline from help.
---
 gdb/ChangeLog        | 36 +++++++++++++++++++++++++
 gdb/breakpoint.c     | 10 +++----
 gdb/btrace.c         |  8 +++---
 gdb/disasm.c         |  2 +-
 gdb/infcall.c        |  2 +-
 gdb/infcmd.c         |  4 +--
 gdb/interps.c        |  5 ++--
 gdb/language.c       |  6 +++--
 gdb/python/python.c  |  3 +--
 gdb/reverse.c        |  4 +--
 gdb/spu-tdep.c       | 10 +++----
 gdb/top.c            |  2 +-
 gdb/tracepoint.c     |  6 ++---
 gdb/tui/tui-layout.c |  2 +-
 gdb/tui/tui-stack.c  |  2 +-
 gdb/tui/tui-win.c    | 64 ++++++++++++++++++++++----------------------
 gdb/typeprint.c      |  2 +-
 gdb/user-regs.c      |  2 +-
 18 files changed, 102 insertions(+), 68 deletions(-)

-- 
2.20.1

Comments

Tom Tromey June 11, 2019, 1:06 p.m. | #1
>>>>> "Tom" == Tom Tromey <tromey@adacore.com> writes:


Tom> I noticed recently that some command had a trailing newline in its
Tom> "help" output.  So, I temporarily hacked cli-decode.c to print
Tom> something when a new command was installed that had a trailing newline
Tom> in its help message, and wrote this patch, which removes all the ones
Tom> I could find this way.  (There could still be a few more in *-nat
Tom> files.)

I'm checking this in.

Tom

Patch

diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 054bb1b13da..320b8a7d773 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -15117,7 +15117,7 @@  functions in all scopes.  For C++, this means in all namespaces and\n\
 classes.  For Ada, this means in all packages.  E.g., in C++,\n\
 \"func()\" matches \"A::func()\", \"A::B::func()\", etc.  The\n\
 \"-qualified\" flag overrides this behavior, making GDB interpret the\n\
-specified name as a complete fully-qualified name instead.\n"
+specified name as a complete fully-qualified name instead."
 
 /* This help string is used for the break, hbreak, tbreak and thbreak
    commands.  It is defined as a macro to prevent duplication.
@@ -15138,7 +15138,7 @@  stack frame.  This is useful for breaking on return to a stack frame.\n\
 \n\
 THREADNUM is the number from \"info threads\".\n\
 CONDITION is a boolean expression.\n\
-\n" LOCATION_HELP_STRING "\n\
+\n" LOCATION_HELP_STRING "\n\n\
 Multiple breakpoints at one place are permitted, and useful if their\n\
 conditions are different.\n\
 \n\
@@ -15510,7 +15510,7 @@  With a subcommand you can enable temporarily."),
 Enable some breakpoints.\n\
 Give breakpoint numbers (separated by spaces) as arguments.\n\
 This is used to cancel the effect of the \"disable\" command.\n\
-May be abbreviated to simply \"enable\".\n"),
+May be abbreviated to simply \"enable\"."),
 		   &enablebreaklist, "enable breakpoints ", 1, &enablelist);
 
   add_cmd ("once", no_class, enable_once_command, _("\
@@ -15586,7 +15586,7 @@  Argument may be a linespec, explicit, or address location as described below.\n\
 \n\
 With no argument, clears all breakpoints in the line that the selected frame\n\
 is executing in.\n"
-"\n" LOCATION_HELP_STRING "\n\
+"\n" LOCATION_HELP_STRING "\n\n\
 See also the \"delete\" command which clears breakpoints by number."));
   add_com_alias ("cl", "clear", class_breakpoint, 1);
 
@@ -15786,7 +15786,7 @@  tracing library.  You can inspect it when analyzing the trace buffer,\n\
 by printing the $_sdata variable like any other convenience variable.\n\
 \n\
 CONDITION is a boolean expression.\n\
-\n" LOCATION_HELP_STRING "\n\
+\n" LOCATION_HELP_STRING "\n\n\
 Multiple tracepoints at one place are permitted, and useful if their\n\
 conditions are different.\n\
 \n\
diff --git a/gdb/btrace.c b/gdb/btrace.c
index c6d564e7062..2806b8c69d5 100644
--- a/gdb/btrace.c
+++ b/gdb/btrace.c
@@ -3528,21 +3528,19 @@  One argument specifies the starting packet of a ten-line print.\n\
 Two arguments with comma between specify starting and ending packets to \
 print.\n\
 Preceded with '+'/'-' the second argument specifies the distance from the \
-first.\n"),
+first."),
 	   &maint_btrace_cmdlist);
 
   add_cmd ("clear-packet-history", class_maintenance,
 	   maint_btrace_clear_packet_history_cmd,
 	   _("Clears the branch tracing packet history.\n\
-Discards the raw branch tracing data but not the execution history data.\n\
-"),
+Discards the raw branch tracing data but not the execution history data."),
 	   &maint_btrace_cmdlist);
 
   add_cmd ("clear", class_maintenance, maint_btrace_clear_cmd,
 	   _("Clears the branch tracing data.\n\
 Discards the raw branch tracing data and the execution history data.\n\
-The next 'record' command will fetch the branch tracing data anew.\n\
-"),
+The next 'record' command will fetch the branch tracing data anew."),
 	   &maint_btrace_cmdlist);
 
 }
diff --git a/gdb/disasm.c b/gdb/disasm.c
index ed740c26e0f..4e58cb67f93 100644
--- a/gdb/disasm.c
+++ b/gdb/disasm.c
@@ -1136,7 +1136,7 @@  _initialize_disasm (void)
 					 &prospective_options, _("\
 Set the disassembler options.\n\
 Usage: set disassembler-options OPTION [,OPTION]...\n\n\
-See: 'show disassembler-options' for valid option values.\n"), _("\
+See: 'show disassembler-options' for valid option values."), _("\
 Show the disassembler options."), NULL,
 					 set_disassembler_options_sfunc,
 					 show_disassembler_options_sfunc,
diff --git a/gdb/infcall.c b/gdb/infcall.c
index f99206c4582..84092d37e64 100644
--- a/gdb/infcall.c
+++ b/gdb/infcall.c
@@ -1395,7 +1395,7 @@  function.  However, some older debug info formats do not provide enough\n\
 information to determine that a function is prototyped.  If this flag is\n\
 set, GDB will perform the conversion for a function it considers\n\
 unprototyped.\n\
-The default is to perform the conversion.\n"),
+The default is to perform the conversion."),
 			   NULL,
 			   show_coerce_float_to_double_p,
 			   &setlist, &showlist);
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 1dfbe2329b7..afdb276dcb0 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -3394,10 +3394,10 @@  in the named register groups."));
 	    _("Execution status of the program."));
 
   add_info ("float", info_float_command,
-	    _("Print the status of the floating point unit\n"));
+	    _("Print the status of the floating point unit"));
 
   add_info ("vector", info_vector_command,
-	    _("Print the status of the vector unit\n"));
+	    _("Print the status of the vector unit"));
 
   add_prefix_cmd ("proc", class_info, info_proc_cmd,
 		  _("\
diff --git a/gdb/interps.c b/gdb/interps.c
index 372bd73bf80..363502e7677 100644
--- a/gdb/interps.c
+++ b/gdb/interps.c
@@ -447,8 +447,9 @@  _initialize_interpreter (void)
 
   c = add_cmd ("interpreter-exec", class_support,
 	       interpreter_exec_cmd, _("\
-Execute a command in an interpreter.  It takes two arguments:\n\
+Execute a command in an interpreter.\n\
+It takes two arguments:\n\
 The first argument is the name of the interpreter to use.\n\
-The second argument is the command to execute.\n"), &cmdlist);
+The second argument is the command to execute."), &cmdlist);
   set_cmd_completer (c, interpreter_completer);
 }
diff --git a/gdb/language.c b/gdb/language.c
index 2f561c456ef..a7c09ccd6db 100644
--- a/gdb/language.c
+++ b/gdb/language.c
@@ -559,7 +559,7 @@  add_set_language_command ()
 
   doc.printf (_("Set the current source language.\n"
 		"The currently understood settings are:\n\nlocal or "
-		"auto    Automatic setting based on source file\n"));
+		"auto    Automatic setting based on source file"));
 
   for (const auto &lang : languages)
     {
@@ -570,7 +570,9 @@  add_set_language_command ()
 
       /* FIXME: i18n: for now assume that the human-readable name is
 	 just a capitalization of the internal name.  */
-      doc.printf ("%-16s Use the %c%s language\n",
+      /* Note that we add the newline at the front, so we don't wind
+	 up with a trailing newline.  */
+      doc.printf ("\n%-16s Use the %c%s language",
 		  lang->la_name,
 		  /* Capitalize first letter of language name.  */
 		  toupper (lang->la_name[0]),
diff --git a/gdb/python/python.c b/gdb/python/python.c
index 4dad8ec10d1..7629c689456 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -1759,8 +1759,7 @@  argument, and if the command is an expression, the result will be\n\
 printed.  For example:\n\
 \n\
     (gdb) python-interactive 2 + 3\n\
-    5\n\
-")
+    5")
 #else /* HAVE_PYTHON */
 	   _("\
 Start a Python interactive prompt.\n\
diff --git a/gdb/reverse.c b/gdb/reverse.c
index 7add7d6815f..f2d2bf029b8 100644
--- a/gdb/reverse.c
+++ b/gdb/reverse.c
@@ -373,12 +373,12 @@  session."));
   add_cmd ("bookmark", class_bookmark, delete_bookmark_command, _("\
 Delete a bookmark from the bookmark list.\n\
 Argument is a bookmark number or numbers,\n\
- or no argument to delete all bookmarks.\n"),
+ or no argument to delete all bookmarks."),
 	   &deletelist);
   add_com ("goto-bookmark", class_bookmark, goto_bookmark_command, _("\
 Go to an earlier-bookmarked point in the program's execution history.\n\
 Argument is the bookmark number of a bookmark saved earlier by using \n\
 the 'bookmark' command, or the special arguments:\n\
   start (beginning of recording)\n\
-  end   (end of recording)\n"));
+  end   (end of recording)"));
 }
diff --git a/gdb/spu-tdep.c b/gdb/spu-tdep.c
index c3f5d4e6a78..a2ac3149d4d 100644
--- a/gdb/spu-tdep.c
+++ b/gdb/spu-tdep.c
@@ -2818,18 +2818,18 @@  Use \"off\" to never automatically flush the software-managed cache."),
 
   /* Add various "info spu" commands.  */
   add_cmd ("event", class_info, info_spu_event_command,
-	   _("Display SPU event facility status.\n"),
+	   _("Display SPU event facility status."),
 	   &infospucmdlist);
   add_cmd ("signal", class_info, info_spu_signal_command,
-	   _("Display SPU signal notification facility status.\n"),
+	   _("Display SPU signal notification facility status."),
 	   &infospucmdlist);
   add_cmd ("mailbox", class_info, info_spu_mailbox_command,
-	   _("Display SPU mailbox facility status.\n"),
+	   _("Display SPU mailbox facility status."),
 	   &infospucmdlist);
   add_cmd ("dma", class_info, info_spu_dma_command,
-	   _("Display MFC DMA status.\n"),
+	   _("Display MFC DMA status."),
 	   &infospucmdlist);
   add_cmd ("proxydma", class_info, info_spu_proxydma_command,
-	   _("Display MFC Proxy-DMA status.\n"),
+	   _("Display MFC Proxy-DMA status."),
 	   &infospucmdlist);
 }
diff --git a/gdb/top.c b/gdb/top.c
index 4f55d6af1e6..b46de90f755 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -2230,7 +2230,7 @@  input settings."),
   c = add_cmd ("new-ui", class_support, new_ui_command, _("\
 Create a new UI.  It takes two arguments:\n\
 The first argument is the name of the interpreter to run.\n\
-The second argument is the terminal the UI runs on.\n"), &cmdlist);
+The second argument is the terminal the UI runs on."), &cmdlist);
   set_cmd_completer (c, interpreter_completer);
 }
 
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index c7585c67839..af5dcd1e339 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -4024,13 +4024,11 @@  If no arguments are supplied, delete all variables."), &deletelist);
   /* FIXME add a trace variable completer.  */
 
   add_info ("tvariables", info_tvariables_command, _("\
-Status of trace state variables and their values.\n\
-"));
+Status of trace state variables and their values."));
 
   add_info ("static-tracepoint-markers",
 	    info_static_tracepoint_markers_command, _("\
-List target static tracepoints markers.\n\
-"));
+List target static tracepoints markers."));
 
   add_prefix_cmd ("tfind", class_trace, tfind_command, _("\
 Select a trace frame;\n\
diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c
index f4e926e7061..da50ced607d 100644
--- a/gdb/tui/tui-layout.c
+++ b/gdb/tui/tui-layout.c
@@ -384,7 +384,7 @@  Layout names are:\n\
            register window is displayed. If the\n\
            source/assembly/command (split) is displayed, \n\
            the register window is displayed with \n\
-           the window that has current logical focus.\n"));
+           the window that has current logical focus."));
   set_cmd_completer (cmd, layout_completer);
 }
 
diff --git a/gdb/tui/tui-stack.c b/gdb/tui/tui-stack.c
index b85b7a5d437..79f1f6fbbe3 100644
--- a/gdb/tui/tui-stack.c
+++ b/gdb/tui/tui-stack.c
@@ -495,7 +495,7 @@  _initialize_tui_stack (void)
 {
   add_com ("update", class_tui, tui_update_command,
 	   _("Update the source window and locator to "
-	     "display the current execution point.\n"));
+	     "display the current execution point."));
 }
 
 /* Command to update the display with the current execution point.  */
diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c
index a24f25928e2..575620f4c89 100644
--- a/gdb/tui/tui-win.c
+++ b/gdb/tui/tui-win.c
@@ -1666,47 +1666,47 @@  _initialize_tui_win (void)
 		  0 /* allow-unknown */, &showlist);
 
   add_com ("refresh", class_tui, tui_refresh_all_command,
-           _("Refresh the terminal display.\n"));
+           _("Refresh the terminal display."));
 
   cmd = add_com ("tabset", class_tui, tui_set_tab_width_command, _("\
 Set the width (in characters) of tab stops.\n\
-Usage: tabset N\n"));
+Usage: tabset N"));
   deprecate_cmd (cmd, "set tui tab-width");
 
   cmd = add_com ("winheight", class_tui, tui_set_win_height_command, _("\
 Set or modify the height of a specified window.\n"
 WIN_HEIGHT_USAGE
 "Window names are:\n\
-src  : the source window\n\
-cmd  : the command window\n\
-asm  : the disassembly window\n\
-regs : the register display\n"));
+   src  : the source window\n\
+   cmd  : the command window\n\
+   asm  : the disassembly window\n\
+   regs : the register display"));
   add_com_alias ("wh", "winheight", class_tui, 0);
   set_cmd_completer (cmd, winheight_completer);
   add_info ("win", tui_all_windows_info,
-	    _("List of all displayed windows.\n"));
+	    _("List of all displayed windows."));
   cmd = add_com ("focus", class_tui, tui_set_focus_command, _("\
 Set focus to named window or next/prev window.\n"
 FOCUS_USAGE
 "Valid Window names are:\n\
-src  : the source window\n\
-asm  : the disassembly window\n\
-regs : the register display\n\
-cmd  : the command window\n"));
+   src  : the source window\n\
+   asm  : the disassembly window\n\
+   regs : the register display\n\
+   cmd  : the command window"));
   add_com_alias ("fs", "focus", class_tui, 0);
   set_cmd_completer (cmd, focus_completer);
   add_com ("+", class_tui, tui_scroll_forward_command, _("\
 Scroll window forward.\n\
-Usage: + [WIN] [N]\n"));
+Usage: + [WIN] [N]"));
   add_com ("-", class_tui, tui_scroll_backward_command, _("\
 Scroll window backward.\n\
-Usage: - [WIN] [N]\n"));
+Usage: - [WIN] [N]"));
   add_com ("<", class_tui, tui_scroll_left_command, _("\
 Scroll window text to the left.\n\
-Usage: < [WIN] [N]\n"));
+Usage: < [WIN] [N]"));
   add_com (">", class_tui, tui_scroll_right_command, _("\
 Scroll window text to the right.\n\
-Usage: > [WIN] [N]\n"));
+Usage: > [WIN] [N]"));
 
   /* Define the tui control variables.  */
   add_setshow_enum_cmd ("border-kind", no_class, tui_border_kind_enums,
@@ -1714,9 +1714,9 @@  Usage: > [WIN] [N]\n"));
 Set the kind of border for TUI windows."), _("\
 Show the kind of border for TUI windows."), _("\
 This variable controls the border of TUI windows:\n\
-space           use a white space\n\
-ascii           use ascii characters + - | for the border\n\
-acs             use the Alternate Character Set"),
+   space           use a white space\n\
+   ascii           use ascii characters + - | for the border\n\
+   acs             use the Alternate Character Set"),
 			tui_set_var_cmd,
 			show_tui_border_kind,
 			&tui_setlist, &tui_showlist);
@@ -1726,13 +1726,13 @@  acs             use the Alternate Character Set"),
 Set the attribute mode to use for the TUI window borders."), _("\
 Show the attribute mode to use for the TUI window borders."), _("\
 This variable controls the attributes to use for the window borders:\n\
-normal          normal display\n\
-standout        use highlight mode of terminal\n\
-reverse         use reverse video mode\n\
-half            use half bright\n\
-half-standout   use half bright and standout mode\n\
-bold            use extra bright or bold\n\
-bold-standout   use extra bright or bold with standout mode"),
+   normal          normal display\n\
+   standout        use highlight mode of terminal\n\
+   reverse         use reverse video mode\n\
+   half            use half bright\n\
+   half-standout   use half bright and standout mode\n\
+   bold            use extra bright or bold\n\
+   bold-standout   use extra bright or bold with standout mode"),
 			tui_set_var_cmd,
 			show_tui_border_mode,
 			&tui_setlist, &tui_showlist);
@@ -1742,13 +1742,13 @@  bold-standout   use extra bright or bold with standout mode"),
 Set the attribute mode to use for the active TUI window border."), _("\
 Show the attribute mode to use for the active TUI window border."), _("\
 This variable controls the attributes to use for the active window border:\n\
-normal          normal display\n\
-standout        use highlight mode of terminal\n\
-reverse         use reverse video mode\n\
-half            use half bright\n\
-half-standout   use half bright and standout mode\n\
-bold            use extra bright or bold\n\
-bold-standout   use extra bright or bold with standout mode"),
+   normal          normal display\n\
+   standout        use highlight mode of terminal\n\
+   reverse         use reverse video mode\n\
+   half            use half bright\n\
+   half-standout   use half bright and standout mode\n\
+   bold            use extra bright or bold\n\
+   bold-standout   use extra bright or bold with standout mode"),
 			tui_set_var_cmd,
 			show_tui_active_border_mode,
 			&tui_setlist, &tui_showlist);
diff --git a/gdb/typeprint.c b/gdb/typeprint.c
index 7a44dbdb313..6a052005d4b 100644
--- a/gdb/typeprint.c
+++ b/gdb/typeprint.c
@@ -817,7 +817,7 @@  Available FLAGS are:\n\
   /M    print methods defined in a class\n\
   /t    do not print typedefs defined in a class\n\
   /T    print typedefs defined in a class\n\
-  /o    print offsets and sizes of fields in a struct (like pahole)\n"));
+  /o    print offsets and sizes of fields in a struct (like pahole)"));
   set_cmd_completer (c, expression_completer);
 
   c = add_com ("whatis", class_vars, whatis_command,
diff --git a/gdb/user-regs.c b/gdb/user-regs.c
index 44a82ff5870..d961d1be4c1 100644
--- a/gdb/user-regs.c
+++ b/gdb/user-regs.c
@@ -240,6 +240,6 @@  _initialize_user_regs (void)
 
   add_cmd ("user-registers", class_maintenance,
 	   maintenance_print_user_registers,
-	   _("List the names of the current user registers.\n"),
+	   _("List the names of the current user registers."),
 	   &maintenanceprintlist);
 }