]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/contrib] Add more separators in spellcheck.sh
authorTom de Vries <tdevries@suse.de>
Tue, 8 Oct 2024 06:24:13 +0000 (08:24 +0200)
committerTom de Vries <tdevries@suse.de>
Tue, 8 Oct 2024 06:24:13 +0000 (08:24 +0200)
Add two more separators in spellcheck.sh: colon and comma.

Doing so triggers the "inbetween->between" rule, which gives an incorrect
result.  Override this with "inbetween->between, in between, in-between" [1],
in a new file gdb/contrib/common-misspellings.txt.

Fix the following common misspellings:
...
everytime -> every time
sucess -> success
thru -> through
transfered -> transferred
inbetween -> between, in between, in-between
...

Verified with spellcheck.sh.  Tested on x86_64-linux.

[1] https://www.grammarly.com/blog/commonly-confused-words/in-between-or-inbetween/

gdb/cli/cli-interp.c
gdb/contrib/common-misspellings.txt [new file with mode: 0644]
gdb/contrib/spellcheck.sh
gdb/exec.h
gdb/testsuite/gdb.dwarf2/dw2-step-out-of-function-no-stmt.exp
gdb/testsuite/gdb.threads/interrupt-while-step-over.exp
gdb/tracepoint.c
gdbserver/server.cc

index fa5d70e1e89a7ddd6a362351ae507a779524fcb8..18175735c4f9870956625a57c7dcb8e00b6e4a17 100644 (file)
@@ -228,7 +228,7 @@ cli_interp::exec (const char *command_str)
      interpreter which has a new ui_file for gdb_stdout, use that one
      instead of the default.
 
-     It is important that it gets reset everytime, since the user
+     It is important that it gets reset every time, since the user
      could set gdb to use a different interpreter.  */
   ui_file *old_stream = m_cli_uiout->set_stream (gdb_stdout);
   SCOPE_EXIT { m_cli_uiout->set_stream (old_stream); };
diff --git a/gdb/contrib/common-misspellings.txt b/gdb/contrib/common-misspellings.txt
new file mode 100644 (file)
index 0000000..7281ec0
--- /dev/null
@@ -0,0 +1,17 @@
+# Copyright (C) 2024 Free Software Foundation, Inc.
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Common spelling mistakes.
+
+inbetween->between, in between, in-between
index 343a43f054c35ae870de2dee0cb1ce2ae72f90c8..4203333b846885584676bbd7d33874184ae56089 100755 (executable)
@@ -25,19 +25,24 @@ url=https://en.wikipedia.org/wiki/Wikipedia:Lists_of_common_misspellings/For_mac
 cache_dir=$scriptdir/../../.git
 cache_file=wikipedia-common-misspellings.txt
 dictionary=$cache_dir/$cache_file
+local_dictionary=$scriptdir/common-misspellings.txt
 
-# Separators: space, slash, tab.
+# Separators: space, slash, tab, colon, comma.
 declare -a grep_separators
 grep_separators=(
     " "
     "/"
     "  "
+    ":"
+    ","
 )
 declare -a sed_separators
 sed_separators=(
     " "
     "/"
     "\t"
+    ":"
+    ","
 )
 
 join ()
@@ -149,13 +154,27 @@ get_dictionary ()
     trap "" EXIT
 }
 
+output_local_dictionary ()
+{
+    # Filter out comments and empty lines.
+    grep -E -v \
+        "^#|^$" \
+        "$local_dictionary"
+}
+
+output_dictionaries ()
+{
+    output_local_dictionary
+    cat "$dictionary"
+}
+
 parse_dictionary ()
 {
     # Parse dictionary.
     mapfile -t words \
-           < <(awk -F '->' '{print $1}' "$dictionary")
+           < <(awk -F '->' '{print $1}' <(output_dictionaries))
     mapfile -t replacements \
-           < <(awk -F '->' '{print $2}' "$dictionary")
+           < <(awk -F '->' '{print $2}' <(output_dictionaries))
 }
 
 find_files_matching_words ()
@@ -310,12 +329,20 @@ main ()
        return
     fi
 
+    declare -A words_done
     local i word replacement
     i=0
     for word in "${words[@]}"; do
        replacement=${replacements[$i]}
        i=$((i + 1))
 
+       # Skip words that are already handled.  This ensures that the local
+       # dictionary overrides the wiki dictionary.
+       if [ "${words_done[$word]}" == 1 ]; then
+           continue
+       fi
+       words_done[$word]=1
+
        replace_word_in_files \
            "$word" \
            "$replacement" \
index 0c1f60495d72813694d51a47457f4d3fc36286a9..c08cb9f00ed806f4f4f18545f95a711cd18c04be 100644 (file)
@@ -62,7 +62,7 @@ extern enum target_xfer_status
    noted above.  See memory_xfer_partial_1() in target.c for an
    example.
 
-   Return the number of bytes actually transfered, or zero when no
+   Return the number of bytes actually transferred, or zero when no
    data is available for the requested range.
 
    This function is intended to be used from target_xfer_partial
index a59c6370a6a1a15ea6ab2f149214e010dd3b51b1..55f437360ab4af81417c5773ab5bffc50a5db04e 100644 (file)
@@ -19,7 +19,7 @@
 #
 # This sort of thing can occur in optimized code, f.i. here a slightly more
 # elaborate case with another is-stmt=no entry (the one with line number 12)
-# inbetween:
+# in between:
 # INDEX  LINE   ADDRESS            IS-STMT
 # 12     13     0x00000000004003ed
 # 13     12     0x00000000004003f2
index bb05754a5baee49acaf333c940c9a4a3a7798e37..89c1d06f5ba16e1c025c57e8fd9652974e7224a0 100644 (file)
@@ -67,7 +67,7 @@ proc return_if_nonzero { result } {
     }
 }
 
-# Do one iteration of "c -a& -> interrupt -a".  Return zero on sucess,
+# Do one iteration of "c -a& -> interrupt -a".  Return zero on success,
 # and non-zero if some test fails.
 
 proc test_one_iteration {} {
index d11c3f8a6be50801fc0f3a6f8d1c50a348336157..ca6f616e3b909c281d854b3f54ddf96210a901c0 100644 (file)
@@ -671,7 +671,7 @@ validate_actionline (const char *line, tracepoint *t)
                  p = strchr (p, ',');
                  continue;
                }
-             /* else fall thru, treat p as an expression and parse it!  */
+             /* else fall through, treat p as an expression and parse it!  */
            }
          tmp_p = p;
          for (bp_location &loc : t->locations ())
index 2c1e7cb15a792af21b9f4e705e9a47ee0378221b..69ffb722be75b3f19933aaf6b9e3ea8b5c21867e 100644 (file)
@@ -1786,7 +1786,7 @@ struct qxfer
      the starting point.  The ANNEX can be used to provide additional
      data-specific information to the target.
 
-     Return the number of bytes actually transfered, zero when no
+     Return the number of bytes actually transferred, zero when no
      further transfer is possible, -1 on error, -2 when the transfer
      is not supported, and -3 on a verbose error message that should
      be preserved.  Return of a positive value smaller than LEN does