All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -perfbook v2 0/3] punctcheck.pl updates
@ 2022-04-04  0:17 Akira Yokosawa
  2022-04-04  0:18 ` [PATCH -perfbook v2 1/3] punctcheck.pl: Add pattern to catch reverse use of period markers Akira Yokosawa
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Akira Yokosawa @ 2022-04-04  0:17 UTC (permalink / raw)
  To: Paul E. McKenney; +Cc: perfbook, Akira Yokosawa

Hi Paul,

Trying again.

So, this series adds patterns in punctcheck.pl to detect misuses
of punctuation markers "\@.", ".\@", and its friends.

Patch 1/3 adds the new pattern.
Patch 2/3 adds hint messages to help you and other contributors
see what is wrong.  Hopefully the added messages are clear enough.
Patch 3/3 fixes existing misuses detected by the added pattern.

        Thanks, Akira
--
Akira Yokosawa (3):
  punctcheck.pl: Add pattern to catch reverse use of period markers
  punctcheck.pl: Add hints in complaint messages
  Fix period markers

 glossary.tex            |  2 +-
 memorder/memorder.tex   |  2 +-
 together/applyrcu.tex   |  2 +-
 utilities/punctcheck.pl | 15 +++++++++++++++
 4 files changed, 18 insertions(+), 3 deletions(-)


base-commit: 5f28b7cb0d4c447c9d6397770906c7cb4c96832c
-- 
2.25.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH -perfbook v2 1/3] punctcheck.pl: Add pattern to catch reverse use of period markers
  2022-04-04  0:17 [PATCH -perfbook v2 0/3] punctcheck.pl updates Akira Yokosawa
@ 2022-04-04  0:18 ` Akira Yokosawa
  2022-04-04  0:20 ` [PATCH -perfbook v2 2/3] punctcheck.pl: Add hints in complaint messages Akira Yokosawa
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Akira Yokosawa @ 2022-04-04  0:18 UTC (permalink / raw)
  To: Paul E. McKenney; +Cc: perfbook, Akira Yokosawa

End-of-sentence markers ("\@.") make sense when they follow
uppercase letters.
Mid-sentence markers (".\@") make sense when they follow
lowercase letters.

Add patterns to cache reverse uses.

Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
---
 utilities/punctcheck.pl | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/utilities/punctcheck.pl b/utilities/punctcheck.pl
index 7d23cc57..8820bf9c 100755
--- a/utilities/punctcheck.pl
+++ b/utilities/punctcheck.pl
@@ -91,6 +91,12 @@ sub check_line {
 	if ($line =~ /^(?=[\s]*+[^%])[^%]*\\\@[\.\?\!\:][\)\}\']*\s+[^%]/){
 	    $ng += 1;
 	}
+	if ($line =~ /[a-z][\)\}\']*\\\@[\.\?\!\:][\)\}\']*\s/) {
+	    $ng += 1;
+	}
+	if ($line =~ /[A-Z][\)\}\']*[\.\?\!\:]\\\@[\)\}\']*\s/) {
+	    $ng += 1;
+	}
 	if ($ng) {
 	    print $ARGV[0], ':', $line_num, ':', $line_raw;
 	}
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH -perfbook v2 2/3] punctcheck.pl: Add hints in complaint messages
  2022-04-04  0:17 [PATCH -perfbook v2 0/3] punctcheck.pl updates Akira Yokosawa
  2022-04-04  0:18 ` [PATCH -perfbook v2 1/3] punctcheck.pl: Add pattern to catch reverse use of period markers Akira Yokosawa
@ 2022-04-04  0:20 ` Akira Yokosawa
  2022-04-04  0:21 ` [PATCH -perfbook v2 3/3] Fix period markers Akira Yokosawa
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Akira Yokosawa @ 2022-04-04  0:20 UTC (permalink / raw)
  To: Paul E. McKenney; +Cc: perfbook, Akira Yokosawa

To help Paul (and other contributors), print a hint in front of
the violating line.

Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
---
 utilities/punctcheck.pl | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/utilities/punctcheck.pl b/utilities/punctcheck.pl
index 8820bf9c..94cbafc9 100755
--- a/utilities/punctcheck.pl
+++ b/utilities/punctcheck.pl
@@ -71,6 +71,8 @@ sub check_line {
 		$next_line =~ /\\E?QuickQuizEnd[BEM]?/ ||
 		$next_line =~ /\\end\{(quot|enum|item|sequ)/ ) {
 		$ng -= 1;
+	    } else {
+		print "vvv Hint: sentence ending with an uppercase needs \"\\\@.\" vvv\n";
 	    }
 	}
 	if ($line =~ /^(?=[\s]*+[^%])[^%]*[a-z][\)\}\']*[\.\?\!][\)\}\']*\s+[^%]/ ||
@@ -80,21 +82,28 @@ sub check_line {
 	    if ($line =~ /^(?=[\s]*+[^%])[^%]*[a-z][\)\}\']*[\.\?\!][\)\}\']*\s+\\\\/ ||
 		$line =~ /^(?=[\s]*+[^%])[^%]*.*[\.:][\)\}\']*\s+\\\\/ ) {
 		$ng -= 1;
+	    } else {
+		print "vvv Hint: end of sentence needs new line vvv\n";
 	    }
 	}
 	if ($line =~ /^(?=[\s]*+[^%])[^%]*[^~]\\cite/) {
 	    $ng += 1;
 	    if ($line =~ /^(?=[\s]*+[^%])[^%]*~\(\\cite/) {
 		$ng -= 1;
+	    } else {
+		print "vvv Hint: \\cite{} needs a \"~\" in front vvv\n";
 	    }
 	}
 	if ($line =~ /^(?=[\s]*+[^%])[^%]*\\\@[\.\?\!\:][\)\}\']*\s+[^%]/){
 	    $ng += 1;
+	    print "vvv Hint: end of sentence needs new line vvv\n";
 	}
 	if ($line =~ /[a-z][\)\}\']*\\\@[\.\?\!\:][\)\}\']*\s/) {
+	    print "vvv Hint: should be \"xxx.\\\@\" vvv\n";
 	    $ng += 1;
 	}
 	if ($line =~ /[A-Z][\)\}\']*[\.\?\!\:]\\\@[\)\}\']*\s/) {
+	    print "vvv Hint: should be \"XXX\\\@.\" vvv\n";
 	    $ng += 1;
 	}
 	if ($ng) {
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH -perfbook v2 3/3] Fix period markers
  2022-04-04  0:17 [PATCH -perfbook v2 0/3] punctcheck.pl updates Akira Yokosawa
  2022-04-04  0:18 ` [PATCH -perfbook v2 1/3] punctcheck.pl: Add pattern to catch reverse use of period markers Akira Yokosawa
  2022-04-04  0:20 ` [PATCH -perfbook v2 2/3] punctcheck.pl: Add hints in complaint messages Akira Yokosawa
@ 2022-04-04  0:21 ` Akira Yokosawa
  2022-04-04  0:29 ` [PATCH -perfbook v2 4/3] together/applyrcu: Fix typo Akira Yokosawa
  2022-04-04  3:43 ` [PATCH -perfbook v2 0/3] punctcheck.pl updates Paul E. McKenney
  4 siblings, 0 replies; 6+ messages in thread
From: Akira Yokosawa @ 2022-04-04  0:21 UTC (permalink / raw)
  To: Paul E. McKenney; +Cc: perfbook, Akira Yokosawa

These are caught by patterns added in punctcheck.pl.

Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
---
 glossary.tex          | 2 +-
 memorder/memorder.tex | 2 +-
 together/applyrcu.tex | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/glossary.tex b/glossary.tex
index 46c68bbe..6038c9ed 100644
--- a/glossary.tex
+++ b/glossary.tex
@@ -143,7 +143,7 @@
 	takes a pointer, and old value, and a new value.
 	If the pointed-to value is equal to the old value, it is atomically
 	replaced with the new value.
-	There is some variety in CAS API.\@
+	There is some variety in CAS API\@.
 	One variation returns the actual pointed-to value, so that the
 	caller compares the CAS return value to the specified old value,
 	with equality indicating a successful CAS operation.
diff --git a/memorder/memorder.tex b/memorder/memorder.tex
index 9792099f..cb91de93 100644
--- a/memorder/memorder.tex
+++ b/memorder/memorder.tex
@@ -3303,7 +3303,7 @@ As it turns out, quite a bit:
 	same lock, and vice versa?
 \item	Suppose that a given CPU or thread executes one access
 	(call it ``A''), releases a lock, reacquires that same lock,
-	then executes another access (call it ``B'').\@
+	then executes another access (call it ``B'')\@.
 	Is some other CPU or thread not holding that lock guaranteed to
 	see A and B in order?
 \item	As above, but with the lock reacquisition carried out by some
diff --git a/together/applyrcu.tex b/together/applyrcu.tex
index 934fbed5..a3ee559e 100644
--- a/together/applyrcu.tex
+++ b/together/applyrcu.tex
@@ -816,7 +816,7 @@ For example, in Linux kernel v5.16, the \co{khugepaged_scan_file()}
 function checks to see if some other task needs the current CPU
 using \co{need_resched()}, and if so invokes \co{xas_pause()} to
 adjust the traveral's iterator appropriately, and then invokes
-\co{cond_resched_rcu()} to yield the CPU.\@
+\co{cond_resched_rcu()} to yield the CPU\@.
 In turn, the \co{cond_resched_rcu()} function invokes \co{rcu_read_unlock()},
 \co{cond_resched()}, and finally \co{rcu_read_lock()} to drop out of
 the RCU read-side critical section in order to yield the CPU.
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH -perfbook v2 4/3] together/applyrcu: Fix typo
  2022-04-04  0:17 [PATCH -perfbook v2 0/3] punctcheck.pl updates Akira Yokosawa
                   ` (2 preceding siblings ...)
  2022-04-04  0:21 ` [PATCH -perfbook v2 3/3] Fix period markers Akira Yokosawa
@ 2022-04-04  0:29 ` Akira Yokosawa
  2022-04-04  3:43 ` [PATCH -perfbook v2 0/3] punctcheck.pl updates Paul E. McKenney
  4 siblings, 0 replies; 6+ messages in thread
From: Akira Yokosawa @ 2022-04-04  0:29 UTC (permalink / raw)
  To: Paul E. McKenney; +Cc: perfbook, Akira Yokosawa

Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
---
And I noticed this in one of the hunks in Patch 3/3.
Sending as a follow up.

        Thanks, Akira
--
 together/applyrcu.tex | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/together/applyrcu.tex b/together/applyrcu.tex
index a3ee559e..2a5a3c12 100644
--- a/together/applyrcu.tex
+++ b/together/applyrcu.tex
@@ -815,7 +815,7 @@ way of stopping in the middle and resuming later.
 For example, in Linux kernel v5.16, the \co{khugepaged_scan_file()}
 function checks to see if some other task needs the current CPU
 using \co{need_resched()}, and if so invokes \co{xas_pause()} to
-adjust the traveral's iterator appropriately, and then invokes
+adjust the travesal's iterator appropriately, and then invokes
 \co{cond_resched_rcu()} to yield the CPU\@.
 In turn, the \co{cond_resched_rcu()} function invokes \co{rcu_read_unlock()},
 \co{cond_resched()}, and finally \co{rcu_read_lock()} to drop out of
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH -perfbook v2 0/3] punctcheck.pl updates
  2022-04-04  0:17 [PATCH -perfbook v2 0/3] punctcheck.pl updates Akira Yokosawa
                   ` (3 preceding siblings ...)
  2022-04-04  0:29 ` [PATCH -perfbook v2 4/3] together/applyrcu: Fix typo Akira Yokosawa
@ 2022-04-04  3:43 ` Paul E. McKenney
  4 siblings, 0 replies; 6+ messages in thread
From: Paul E. McKenney @ 2022-04-04  3:43 UTC (permalink / raw)
  To: Akira Yokosawa; +Cc: perfbook

On Mon, Apr 04, 2022 at 09:17:34AM +0900, Akira Yokosawa wrote:
> Hi Paul,
> 
> Trying again.
> 
> So, this series adds patterns in punctcheck.pl to detect misuses
> of punctuation markers "\@.", ".\@", and its friends.
> 
> Patch 1/3 adds the new pattern.
> Patch 2/3 adds hint messages to help you and other contributors
> see what is wrong.  Hopefully the added messages are clear enough.
> Patch 3/3 fixes existing misuses detected by the added pattern.

Much nicer!  I queued and pushed all four, thank you!!!

							Thanx, Paul

>         Thanks, Akira
> --
> Akira Yokosawa (3):
>   punctcheck.pl: Add pattern to catch reverse use of period markers
>   punctcheck.pl: Add hints in complaint messages
>   Fix period markers
> 
>  glossary.tex            |  2 +-
>  memorder/memorder.tex   |  2 +-
>  together/applyrcu.tex   |  2 +-
>  utilities/punctcheck.pl | 15 +++++++++++++++
>  4 files changed, 18 insertions(+), 3 deletions(-)
> 
> 
> base-commit: 5f28b7cb0d4c447c9d6397770906c7cb4c96832c
> -- 
> 2.25.1
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-04-04  3:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-04  0:17 [PATCH -perfbook v2 0/3] punctcheck.pl updates Akira Yokosawa
2022-04-04  0:18 ` [PATCH -perfbook v2 1/3] punctcheck.pl: Add pattern to catch reverse use of period markers Akira Yokosawa
2022-04-04  0:20 ` [PATCH -perfbook v2 2/3] punctcheck.pl: Add hints in complaint messages Akira Yokosawa
2022-04-04  0:21 ` [PATCH -perfbook v2 3/3] Fix period markers Akira Yokosawa
2022-04-04  0:29 ` [PATCH -perfbook v2 4/3] together/applyrcu: Fix typo Akira Yokosawa
2022-04-04  3:43 ` [PATCH -perfbook v2 0/3] punctcheck.pl updates Paul E. McKenney

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.