From: Tom de Vries Date: Wed, 13 Nov 2024 20:06:58 +0000 (+0100) Subject: [gdb/contrib] Handle parentheses in spellcheck.sh X-Git-Tag: gdb-16-branchpoint~438 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=0d1f7e2765040975e4e2de9502b5d5e2f2547095;p=thirdparty%2Fbinutils-gdb.git [gdb/contrib] Handle parentheses in spellcheck.sh 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 --- diff --git a/gdb/contrib/spellcheck.sh b/gdb/contrib/spellcheck.sh index 1b3e88e259b..3399e41ea7f 100755 --- a/gdb/contrib/spellcheck.sh +++ b/gdb/contrib/spellcheck.sh @@ -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" diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c index fa2befd1a35..58aca298dbc 100644 --- a/gdb/objc-lang.c +++ b/gdb/objc-lang.c @@ -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. */ diff --git a/gdb/testsuite/gdb.reverse/step-precsave.exp b/gdb/testsuite/gdb.reverse/step-precsave.exp index 27b417ec262..04880085cb8 100644 --- a/gdb/testsuite/gdb.reverse/step-precsave.exp +++ b/gdb/testsuite/gdb.reverse/step-precsave.exp @@ -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" { diff --git a/gdb/testsuite/gdb.reverse/step-reverse.exp b/gdb/testsuite/gdb.reverse/step-reverse.exp index a3c3b5a5cd1..4bfe289ea73 100644 --- a/gdb/testsuite/gdb.reverse/step-reverse.exp +++ b/gdb/testsuite/gdb.reverse/step-reverse.exp @@ -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" {