public inbox for gdb-testers@sourceware.org
help / color / mirror / Atom feed
From: gdb-buildbot@sergiodj.net
To: gdb-testers@sourceware.org
Subject: [binutils-gdb] [gdb/contrib] Add -c option to words.sh script
Date: Mon, 25 Nov 2019 22:44:00 -0000	[thread overview]
Message-ID: <3cf2f2377e460608b94a8ba5c3f23c7e4b2dc232@gdb-build> (raw)

*** TEST RESULTS FOR COMMIT 3cf2f2377e460608b94a8ba5c3f23c7e4b2dc232 ***

commit 3cf2f2377e460608b94a8ba5c3f23c7e4b2dc232
Author:     Tom de Vries <tdevries@suse.de>
AuthorDate: Mon Nov 25 23:00:03 2019 +0100
Commit:     Tom de Vries <tdevries@suse.de>
CommitDate: Mon Nov 25 23:00:03 2019 +0100

    [gdb/contrib] Add -c option to words.sh script
    
    The words.sh script in its current form extracts c comments from files, which
    it then transforms into a list of words.
    
    To use the script on the documentation (as I did for commit 6b92c0d3533
    "[gdb/doc] Fix typos"), I needed to disable the "extract c comments" part.
    
    Add an option -c that enables extracting c comments, and is off by default.
    
    gdb/ChangeLog:
    
    2019-11-25  Tom de Vries  <tdevries@suse.de>
    
            * contrib/words.sh: Add -c option.
    
    Change-Id: Ifa34d435b3c41b3ff845dc07ae4b0d9f02d92a2d

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 440edfff2f..fdba64eb2f 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,7 @@
+2019-11-25  Tom de Vries  <tdevries@suse.de>
+
+	* contrib/words.sh: Add -c option.
+
 2019-11-25  Christian Biesinger  <cbiesinger@google.com>
 
 	* solib.c (solib_find_1): Change int to bool.
diff --git a/gdb/contrib/words.sh b/gdb/contrib/words.sh
index ec8bcd06cb..d4c436d608 100755
--- a/gdb/contrib/words.sh
+++ b/gdb/contrib/words.sh
@@ -14,17 +14,20 @@
 # 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 script intends to facilitate spell checking of comments in C sources.
+# This script intends to facilitate spell checking of source/doc files.
 # It:
-# - extracts comments from C files
-# - transforms the comments into a list of lowercase words
+# - transforms the files into a list of lowercase words
 # - prefixes each word with the frequency
 # - filters out words within a frequency range
 # - sorts the words, longest first
 #
+# If '-c' is passed as option, it operates on the C comments only, rather than
+# on the entire file.
+#
 # For:
 # ...
-# $ ./gdb/contrib/words.sh $(find gdb -type f -name "*.c" -o -name "*.h")
+# $ files=$(find gdb -type f -name "*.c" -o -name "*.h")
+# $ ./gdb/contrib/words.sh -c $files
 # ...
 # it generates a list of ~15000 words prefixed with frequency.
 #
@@ -36,7 +39,8 @@
 #
 # And for:
 # ...
-# $ ./gdb/contrib/words.sh -f 1 $(find gdb -type f -name "*.c" -o -name "*.h")
+# $ files=$(find gdb -type f -name "*.c" -o -name "*.h")
+# $ ./gdb/contrib/words.sh -c -f 1 $files
 # ...
 # it generates a list of ~5000 words with frequency 1.
 #
@@ -45,8 +49,13 @@
 
 minfreq=
 maxfreq=
+c=false
 while [ $# -gt 0 ]; do
     case "$1" in
+	-c)
+	    c=true
+	    shift
+	    ;;
 	--freq|-f)
 	    minfreq=$2
 	    maxfreq=$2
@@ -111,9 +120,13 @@ EOF
 # Stabilize sort.
 export LC_ALL=C
 
-awk \
-    -f "$awkfile" \
-    -- "$@" \
+if $c; then
+    awk \
+	-f "$awkfile" \
+	-- "$@"
+else
+    cat "$@"
+fi \
     | sed \
 	  -e 's/[!"?;:%^$~#{}`&=@,. \t\/_()|<>\+\*-]/\n/g' \
 	  -e 's/\[/\n/g' \


             reply	other threads:[~2019-11-25 22:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-25 22:44 gdb-buildbot [this message]
2019-11-25 22:44 ` Failures on Ubuntu-Aarch64-native-gdbserver-m64, branch master gdb-buildbot
2019-11-28 23:39 ` Failures on Fedora-x86_64-m32, " gdb-buildbot
2019-11-28 23:41 ` Failures on Fedora-x86_64-cc-with-index, " gdb-buildbot
2019-11-28 23:42 ` Failures on Fedora-x86_64-m64, " gdb-buildbot
2019-11-28 23:44 ` Failures on Fedora-i686, " gdb-buildbot
2019-11-29  0:20 ` Failures on Fedora-x86_64-native-extended-gdbserver-m32, " gdb-buildbot
2019-11-29  0:22 ` Failures on Fedora-x86_64-native-gdbserver-m64, " gdb-buildbot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3cf2f2377e460608b94a8ba5c3f23c7e4b2dc232@gdb-build \
    --to=gdb-buildbot@sergiodj.net \
    --cc=gdb-testers@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).