aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2024-11-18 09:42:03 +0100
committerTom de Vries <tdevries@suse.de>2024-11-18 09:42:03 +0100
commit92a5cfde2f72130aa76bc35e91263c092254ee7c (patch)
tree7ac366531b0eee1c3b5f6d4b2be37a8e07fda51f
parenta2f774427e078f3da2c06bdea25f77a61979a695 (diff)
downloadbinutils-92a5cfde2f72130aa76bc35e91263c092254ee7c.zip
binutils-92a5cfde2f72130aa76bc35e91263c092254ee7c.tar.gz
binutils-92a5cfde2f72130aa76bc35e91263c092254ee7c.tar.bz2
[gdb/contrib] Allow thru in spellcheck.sh
Eli mentioned that "thru" is a widely-accepted shorthand [1]. Skip the "thru->through" rule by adding an overriding identity rule "thru->thru". Verified with shellcheck. [1] https://sourceware.org/pipermail/gdb-patches/2024-November/213380.html
-rw-r--r--gdb/contrib/common-misspellings.txt7
-rwxr-xr-xgdb/contrib/spellcheck.sh35
2 files changed, 37 insertions, 5 deletions
diff --git a/gdb/contrib/common-misspellings.txt b/gdb/contrib/common-misspellings.txt
index 23a4346..11ca8ec 100644
--- a/gdb/contrib/common-misspellings.txt
+++ b/gdb/contrib/common-misspellings.txt
@@ -12,8 +12,15 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# This file contains additions to and overrides for
+# wikipedia-common-misspellings.txt.
+
# Common spelling mistakes.
inbetween->between, in between, in-between
sofar->so far
doens't->doesn't
+
+# Identity rules.
+
+thru->thru
diff --git a/gdb/contrib/spellcheck.sh b/gdb/contrib/spellcheck.sh
index 0223885..2c34b03 100755
--- a/gdb/contrib/spellcheck.sh
+++ b/gdb/contrib/spellcheck.sh
@@ -231,6 +231,32 @@ parse_dictionary ()
< <(awk -F '->' '{print $1}' <(output_dictionaries))
mapfile -t replacements \
< <(awk -F '->' '{print $2}' <(output_dictionaries))
+
+ local words_done
+ declare -A words_done
+ local i word replacement
+ i=0
+ for word in "${words[@]}"; do
+ replacement=${replacements[$i]}
+
+ # Skip words that are already handled. This ensures that the local
+ # dictionary overrides the wiki dictionary.
+ if [ "${words_done[$word]}" == 1 ]; then
+ words[$i]=""
+ replacements[$i]=""
+ i=$((i + 1))
+ continue
+ fi
+ words_done[$word]=1
+
+ # Skip identity rules.
+ if [ "$word" = "$replacement" ]; then
+ words[$i]=""
+ replacements[$i]=""
+ fi
+
+ i=$((i + 1))
+ done
}
find_files_matching_words ()
@@ -252,6 +278,9 @@ find_files_matching_words ()
declare -a re_words
mapfile -t re_words \
< <(for f in "${words[@]}"; do
+ if [ "$f" = "" ]; then
+ continue
+ fi
echo "$f"
done \
| sed "s/^\(.\)/[\u\1\1]/")
@@ -417,19 +446,15 @@ main ()
exit 1
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
+ if [ "$word" = "" ]; then
continue
fi
- words_done[$word]=1
replace_word_in_files \
"$word" \