]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/contrib] Handle parentheses in spellcheck.sh
authorTom de Vries <tdevries@suse.de>
Wed, 13 Nov 2024 20:06:58 +0000 (21:06 +0100)
committerTom de Vries <tdevries@suse.de>
Wed, 13 Nov 2024 20:06:58 +0000 (21:06 +0100)
Currently, text adjacent to parentheses is not spell-checked:
...
$ cat tmp.txt
(upto)
$ ./gdb/contrib/spellcheck.sh tmp.txt
$
...

Add handling of parentheses, such that we get:
...
$ ./gdb/contrib/spellcheck.sh tmp.txt
upto -> up to
$
...

Rerun spellcheck.sh, resulting in a few "thru->through" replacements.

Tested on x86_64-linux.

Approved-by: Kevin Buettner <kevinb@redhat.com>
gdb/contrib/spellcheck.sh
gdb/objc-lang.c
gdb/testsuite/gdb.reverse/step-precsave.exp
gdb/testsuite/gdb.reverse/step-reverse.exp

index 1b3e88e259b7b4ae8f9448187fd971acf9af5cdd..3399e41ea7fad1c4f22c5feec8f558dbaca98e26 100755 (executable)
@@ -47,6 +47,32 @@ sed_separators=(
     ","
 )
 
+# Pre: start of line, left parenthesis.
+declare -a grep_pre
+grep_pre=(
+    "^"
+    "\("
+)
+declare -a sed_pre
+sed_pre=(
+    "^"
+    "("
+)
+
+# Post: dot, right parenthesis, end of line.
+declare -a grep_post
+grep_post=(
+    "\."
+    "\)"
+    "$"
+)
+declare -a sed_post
+sed_post=(
+    "\."
+    ")"
+    "$"
+)
+
 join ()
 {
     local or
@@ -223,12 +249,11 @@ find_files_matching_words ()
 
        local before after
        before=$(grep_join \
-                    "^" \
+                    "${grep_pre[@]}" \
                     "${grep_separators[@]}")
        after=$(grep_join \
                    "${grep_separators[@]}" \
-                   "\." \
-                   "$")
+                   "${grep_post[@]}")
 
        pat="$before$pat$after"
 
@@ -250,12 +275,11 @@ find_files_matching_word ()
 
     local before after
     before=$(grep_join \
-                "^" \
+                "${grep_pre[@]}" \
                 "${grep_separators[@]}")
     after=$(grep_join \
                "${grep_separators[@]}" \
-               "\." \
-               "$")
+               "${grep_post[@]}")
 
     pat="$before$pat$after"
 
@@ -278,12 +302,11 @@ replace_word_in_file ()
 
     local before after
     before=$(sed_join \
-                "^" \
+                "${sed_pre[@]}" \
                 "${sed_separators[@]}")
     after=$(sed_join \
                "${sed_separators[@]}" \
-               "\." \
-               "$")
+               "${sed_post[@]}")
 
     local repl
     repl="s%$before$word$after%\1$replacement\2%g"
index fa2befd1a358f9c57f59a7261ca8dfe59206a56e..58aca298dbc8367230d0b8f684f0725912821a0e 100644 (file)
@@ -1203,7 +1203,7 @@ print_object_command (const char *args, int from_tty)
   gdb_printf ("\n");
 }
 
-/* The data structure 'methcalls' is used to detect method calls (thru
+/* The data structure 'methcalls' is used to detect method calls (through
  * ObjC runtime lib functions objc_msgSend, objc_msgSendSuper, etc.),
  * and ultimately find the method being called.
  */
index 27b417ec262ed29372c550f802a9e2b835e93ea5..04880085cb8e7529ee906e2e0423f1fa39cf9cc8 100644 (file)
@@ -268,12 +268,12 @@ gdb_test_multiple "stepi" "$test_message" {
     }
 }
 
-# step backward into function (thru return)
+# step backward into function (through return)
 
 gdb_test "step" "(RETURN FROM CALLEE|ARRIVED IN CALLEE).*" \
     "reverse step into fn call"
 
-# step backward out of called function (thru call)
+# step backward out of called function (through call)
 
 set test_message "reverse step out of called fn"
 gdb_test_multiple "step" "$test_message" {
index a3c3b5a5cd143fb8fd4c07bd22457cacbef8f2e6..4bfe289ea739aefcaaccda943b5f3dce062ba10c 100644 (file)
@@ -230,12 +230,12 @@ gdb_test_multiple "stepi" "$test_message" {
     }
 }
 
-# step backward into function (thru return)
+# step backward into function (through return)
 
 gdb_test "step" "(RETURN FROM CALLEE|ARRIVED IN CALLEE).*" \
     "reverse step into fn call"
 
-# step backward out of called function (thru call)
+# step backward out of called function (through call)
 
 set test_message "reverse step out of called fn"
 gdb_test_multiple "step" "$test_message" {