From patchwork Wed Apr 17 14:06:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 88585 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D20733858424 for ; Wed, 17 Apr 2024 14:07:40 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-il1-x12a.google.com (mail-il1-x12a.google.com [IPv6:2607:f8b0:4864:20::12a]) by sourceware.org (Postfix) with ESMTPS id 473553858424 for ; Wed, 17 Apr 2024 14:07:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 473553858424 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 473553858424 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::12a ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713362832; cv=none; b=qOJeYi+YB35LtcqKXUmTaXwwEnwCDV1nbgI+v0g0EEVxh6gYJCwh+5Zt+qdVoCdYx3X1IzAzLIi0rqfCUNZMwy/8/BkZmoYyuoIG0GODg8hLLAU0XDPKXrmgorK2+YLqzatPkXzx5EWL+X21M7WIMCZ2NJWsqfa6nFDtkVMidIo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713362832; c=relaxed/simple; bh=1Vz25NFV35BM7aSQxENn5qWh+C4XcV+c3nM8/8ewhLc=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=Dy9vj+JRNpdUbrWp38j5km11Aa+fT57IstSZSTB6VY0s+jxwEPSjDoCmoxkD0l4AoegmyHZiQe7iSv94t5p7NB3x+jPZ47O7yAll+e7JdEkYGakifSL91if/WfRpTXE1x69TMAHC8xGJ/ANItSBYaHUDmDtnFtBWyamggO9Jtjc= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-il1-x12a.google.com with SMTP id e9e14a558f8ab-36b21e8c6ccso12448595ab.2 for ; Wed, 17 Apr 2024 07:07:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1713362821; x=1713967621; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=0iDsd5UcYISiqJYkGFQS8VS21XsuW7nSBjVo37fTkcU=; b=YU86tDXPlbdxyZZ7AcAPnZl1jezza+Ykjm+9u10WdM6ti504u99Orq6JPRQpqmgaPd BjUCVvm1WoYL+qkNyiCt3qaLi7HkILxyWk70HGs8rAVNzQ/ns+AZZsZ7xMbIxyi6KGOw MrzOM8TnZaD2ClnDXcJVOmkLGbcgtc4+jYfZkXJE11BkIH4EpwMGUgytvs9x+ZrYgLE/ Y1VZKE2LaTZnmrEkqVQMh7ipsz0RLVgT/e7oeUamwTUAwkPfbtyTan1S7iojwjJGLPi1 YI0/OnB/mSVS6aKsnmCiQ2HJHdXVXHN9/PzjVH/uNnq0F1E7pCAk6NVDrrkqTLmMtg7X dAaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713362821; x=1713967621; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=0iDsd5UcYISiqJYkGFQS8VS21XsuW7nSBjVo37fTkcU=; b=QkaYcD/j2uiDFt31gh5judqdnSZhcCKlVsr5KeCtp7jXykWmQxwOk/lvWRpOur2hmc A7VFLkRK9AIwfUmGWwkMHGU1CLgZp9mx4MtzwFYL2eppm3lfvObRMujTe67X72Bp8Dhh AWcrQxNDhypAtLLORcx269jC9+8vUhxTrDb39QG1w6sTu3XLyF0Z9BU+EcL4H6EmVgXN 3Qp6liM0O+Mk1SvON5nwW64I0tGi0cVQgFgMNRFK3PZIIYxG7KsDLaNcGwiJBI++Mj5M to1+GcCt3Xu1evg8wsNJrpfKMDDxyuPuAiLsMg578W+2ifp3ArqlPgdFEfX3UEZPYfc1 wOGA== X-Gm-Message-State: AOJu0YwzHi3yU+pIeomoANhiI+Gmqa59itgi8DFXC3dxNnfWI+ClJQnS T0BiM52PkJ1UXbUqwno0wjVixL3RoD1JCwYeOv9+9S7YXlH+/YFNZWdlRYqP30aTufEiGskCle4 = X-Google-Smtp-Source: AGHT+IHeqI+1yEOeiB6bPfexDk/V1KS8NwFbM3Ptwmq1VuCqLjCj7jgv/vKSSIasMewoEu69vTm2Zw== X-Received: by 2002:a05:6e02:2181:b0:36a:fa1f:b571 with SMTP id j1-20020a056e02218100b0036afa1fb571mr20250386ila.2.1713362821292; Wed, 17 Apr 2024 07:07:01 -0700 (PDT) Received: from localhost.localdomain (97-122-82-115.hlrn.qwest.net. [97.122.82.115]) by smtp.gmail.com with ESMTPSA id z9-20020a92cd09000000b00368a32108e3sm3704255iln.86.2024.04.17.07.07.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Apr 2024 07:07:01 -0700 (PDT) From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH] Disallow trailing whitespace in docstrings Date: Wed, 17 Apr 2024 08:06:51 -0600 Message-ID: <20240417140651.4007054-1-tromey@adacore.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org This patch changes the docstring self-test to verify that there is no trailing whitespace at the end of lines. A few existing docstrings had to be updated. --- gdb/breakpoint.c | 4 ++-- gdb/cris-tdep.c | 2 +- gdb/infcmd.c | 6 +++--- gdb/macrocmd.c | 2 +- gdb/reverse.c | 8 ++++---- gdb/skip.c | 2 +- gdb/typeprint.c | 2 +- gdb/unittests/command-def-selftests.c | 19 +++++++++++++++++-- 8 files changed, 30 insertions(+), 15 deletions(-) diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 6d8adc62664..880cc57037c 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -14597,7 +14597,7 @@ command" [PROBE_MODIFIER] [LOCATION] [thread THREADNUM]\n\ \t[-force-condition] [if CONDITION]\n\ PROBE_MODIFIER shall be present if the command is to be placed in a\n\ probe point. Accepted values are `-probe' (for a generic, automatically\n\ -guessed probe type), `-probe-stap' (for a SystemTap probe) or \n\ +guessed probe type), `-probe-stap' (for a SystemTap probe) or\n\ `-probe-dtrace' (for a DTrace probe).\n\ LOCATION may be a linespec, address, or explicit location as described\n\ below.\n\ @@ -15028,7 +15028,7 @@ Do \"help tracepoints\" for info on other tracepoint commands.")); Set a static tracepoint at location or marker.\n\ \n\ strace [LOCATION] [if CONDITION]\n\ -LOCATION may be a linespec, explicit, or address location (described below) \n\ +LOCATION may be a linespec, explicit, or address location (described below)\n\ or -m MARKER_ID.\n\n\ If a marker id is specified, probe the marker with that name. With\n\ no LOCATION, uses current execution address of the selected stack frame.\n\ diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c index dd013d531ab..1fc30c0b193 100644 --- a/gdb/cris-tdep.c +++ b/gdb/cris-tdep.c @@ -3828,7 +3828,7 @@ _initialize_cris_tdep () _("Show the current CRIS version."), _("\ Set to 10 for CRISv10 or 32 for CRISv32 if autodetection fails.\n\ -Defaults to 10. "), +Defaults to 10."), set_cris_version, NULL, /* FIXME: i18n: Current CRIS version is %s. */ diff --git a/gdb/infcmd.c b/gdb/infcmd.c index 10a964a90d7..a53c6c91828 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -3077,7 +3077,7 @@ shell that will start the program (specified by the \"$SHELL\" environment\n\ variable). Input and output redirection with \">\", \"<\", or \">>\"\n\ are also allowed.\n\ \n\ -With no arguments, uses arguments last specified (with \"run\" or \n\ +With no arguments, uses arguments last specified (with \"run\" or\n\ \"set args\"). To cancel previous arguments and run with no arguments,\n\ use \"set args\" without arguments.\n\ \n\ @@ -3303,7 +3303,7 @@ which means to set the ignore count of that breakpoint to N - 1 (so that\n\ the breakpoint won't break until the Nth time it is reached).\n\ \n\ If non-stop mode is enabled, continue only the current thread,\n\ -otherwise all the threads in the program are continued. To \n\ +otherwise all the threads in the program are continued. To\n\ continue all stopped threads in non-stop mode, use the -a option.\n\ Specifying -a and an ignore count simultaneously is an error.")); add_com_alias ("c", continue_cmd, class_run, 1); @@ -3329,7 +3329,7 @@ RUN_ARGS_HELP)); add_com ("interrupt", class_run, interrupt_command, _("Interrupt the execution of the debugged program.\n\ If non-stop mode is enabled, interrupt only the current thread,\n\ -otherwise all the threads in the program are stopped. To \n\ +otherwise all the threads in the program are stopped. To\n\ interrupt all running threads in non-stop mode, use the -a option.")); cmd_list_element *info_registers_cmd diff --git a/gdb/macrocmd.c b/gdb/macrocmd.c index ddabfede0f5..a84ea57a7ba 100644 --- a/gdb/macrocmd.c +++ b/gdb/macrocmd.c @@ -480,7 +480,7 @@ expression work together to yield a pre-processed expression."), add_info ("macro", info_macro_command, _("Show the definition of MACRO, and it's source location.\n\ Usage: info macro [-a|-all] [--] MACRO\n\ -Options: \n\ +Options:\n\ -a, --all Output all definitions of MACRO in the current compilation\ unit.\n\ -- Specify the end of arguments and the beginning of the MACRO.")); diff --git a/gdb/reverse.c b/gdb/reverse.c index 11c76b4b335..ca11f83119b 100644 --- a/gdb/reverse.c +++ b/gdb/reverse.c @@ -320,12 +320,12 @@ Execute backward until just before selected stack frame is called.")); add_com ("bookmark", class_bookmark, save_bookmark_command, _("\ Set a bookmark in the program's execution history.\n\ -A bookmark represents a point in the execution history \n\ +A bookmark represents a point in the execution history\n\ that can be returned to at a later point in the debug session.")); add_info ("bookmarks", info_bookmarks_command, _("\ Status of user-settable bookmarks.\n\ -Bookmarks are user-settable markers representing a point in the \n\ -execution history that can be returned to later in the same debug \n\ +Bookmarks are user-settable markers representing a point in the\n\ +execution history that can be returned to later in the same debug\n\ session.")); add_cmd ("bookmark", class_bookmark, delete_bookmark_command, _("\ Delete a bookmark from the bookmark list.\n\ @@ -334,7 +334,7 @@ Argument is a bookmark number or numbers,\n\ &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\ +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)")); diff --git a/gdb/skip.c b/gdb/skip.c index f2818eccb34..e3448700247 100644 --- a/gdb/skip.c +++ b/gdb/skip.c @@ -722,7 +722,7 @@ If you don't specify any numbers or ranges, we'll delete all skip entries."), add_info ("skip", info_skip_command, _("\ Display the status of skips.\n\ Usage: info skip [NUMBER | RANGES]...\n\ -You can specify numbers (e.g. \"info skip 1 3\"), \n\ +You can specify numbers (e.g. \"info skip 1 3\"),\n\ ranges (e.g. \"info skip 4-8\"), or both (e.g. \"info skip 1 3 4-8\").\n\n\ If you don't specify any numbers or ranges, we'll show all skips.")); set_cmd_completer (c, complete_skip_number); diff --git a/gdb/typeprint.c b/gdb/typeprint.c index 4d0e764274a..7977bd2c4ae 100644 --- a/gdb/typeprint.c +++ b/gdb/typeprint.c @@ -843,7 +843,7 @@ Available FLAGS are:\n\ /x use hexadecimal notation when displaying sizes and offsets\n\ of struct members\n\ /d use decimal notation when displaying sizes and offsets\n\ - of struct members ")); + of struct members")); set_cmd_completer (c, expression_completer); c = add_com ("whatis", class_vars, whatis_command, diff --git a/gdb/unittests/command-def-selftests.c b/gdb/unittests/command-def-selftests.c index 6936af740fc..6a9b194e680 100644 --- a/gdb/unittests/command-def-selftests.c +++ b/gdb/unittests/command-def-selftests.c @@ -73,10 +73,25 @@ check_doc (struct cmd_list_element *commandlist, const char *prefix) "first line is not terminated with a '.' character"); /* Checks the doc is not terminated with a new line. */ - if (c->doc[strlen (c->doc) - 1] == '\n') + if (isspace (c->doc[strlen (c->doc) - 1])) broken_doc_invariant (prefix, c->name, - "has a superfluous trailing end of line"); + "has superfluous trailing whitespace"); + + for (const char *nl = strchr (c->doc, '\n'); + nl != nullptr; + nl = strchr (nl + 1, '\n')) + { + if (nl == c->doc) + broken_doc_invariant (prefix, c->name, "has a leading newline"); + else + { + /* \n\n is ok, so we check that explicitly here. */ + if (isspace (nl[-1]) && nl[-1] != '\n') + broken_doc_invariant (prefix, c->name, + "has whitespace before a newline"); + } + } /* Check if this command has subcommands and is not an abbreviation. We skip checking subcommands of abbreviations