Skip to content

Commit a106d8e

Browse files
authored
[alg.partitions] Add missing \pnum. (#3549)
Also extend the check script to flag missing \pnum in library descriptions. Limit the checking to library clauses other than [library].
1 parent 52fbbf7 commit a106d8e

File tree

3 files changed

+23
-23
lines changed

3 files changed

+23
-23
lines changed

source/algorithms.tex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6746,6 +6746,7 @@
67466746
for the overloads with no parameter named \tcode{proj}
67476747
and let $E(x)$ be \tcode{bool(invoke(\brk{}pred, invoke(proj, $x$)))}.
67486748

6749+
\pnum
67496750
\expects
67506751
For the overloads in namespace \tcode{std},
67516752
\tcode{BidirectionalIterator} meets

source/lib-intro.tex

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3002,15 +3002,13 @@
30023002

30033003
\pnum
30043004
\indextext{restriction}%
3005-
Violation of any preconditions specified in a function's
3006-
\requires
3007-
element results in undefined behavior unless the function's
3008-
\throws
3009-
element specifies throwing an exception when the precondition is violated.
3005+
Violation of any preconditions specified in a function's \requires element
3006+
results in undefined behavior
3007+
unless the function's \throws element
3008+
specifies throwing an exception when the precondition is violated.
30103009

30113010
\pnum
3012-
Violation of any preconditions specified
3013-
in a function's \expects element
3011+
Violation of any preconditions specified in a function's \expects element
30143012
results in undefined behavior.
30153013

30163014
\rSec3[res.on.requirements]{Semantic requirements}
@@ -3304,15 +3302,10 @@
33043302
\pnum
33053303
Any of the functions defined in the \Cpp{} standard library
33063304
\indextext{library!C++ standard}%
3307-
can report a failure by throwing an exception of a type described in its
3308-
\throws
3309-
paragraph,
3310-
or of a type derived from a type named in the
3311-
\throws
3312-
paragraph
3313-
that would be caught by
3314-
an exception handler
3315-
for the base type.
3305+
can report a failure by throwing an exception of a type
3306+
described in its \throws paragraph,
3307+
or of a type derived from a type named in the \throws paragraph
3308+
that would be caught by an exception handler for the base type.
33163309

33173310
\pnum
33183311
Functions from the C standard library shall not throw exceptions%
@@ -3337,11 +3330,8 @@
33373330
Functions defined in the
33383331
\Cpp{} standard library
33393332
\indextext{specifications!C++}%
3340-
that do not have a
3341-
\throws
3342-
paragraph
3343-
but do have a potentially-throwing
3344-
exception specification
3333+
that do not have a \throws paragraph
3334+
but do have a potentially-throwing exception specification
33453335
may throw \impldef{exceptions thrown by standard library functions that have a
33463336
potentially-throwing exception specification} exceptions.%
33473337
\footnote{In particular, they

tools/check.sh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
# Ignore files where rules may be violated within macro definitions.
44
texfiles=$(ls *.tex | grep -v macros.tex | grep -v layout.tex | grep -v tables.tex)
5-
texlib="lib-intro.tex support.tex concepts.tex diagnostics.tex utilities.tex strings.tex containers.tex iterators.tex ranges.tex algorithms.tex numerics.tex time.tex locales.tex iostreams.tex regex.tex atomics.tex threads.tex"
5+
texlibdesc="support.tex concepts.tex diagnostics.tex utilities.tex strings.tex containers.tex iterators.tex ranges.tex algorithms.tex numerics.tex time.tex locales.tex iostreams.tex regex.tex atomics.tex threads.tex"
6+
texlib="lib-intro.tex $texlibdesc"
67

78
# Discover "Overfull \hbox" and "Reference ... undefined" messages from LaTeX.
89
sed -n '/\.tex/{s/^.*\/\([-a-z0-9]\+\.tex\).*$/\1/;h};
@@ -28,7 +29,7 @@ grep -n 'opt{}' *.tex && exit 1
2829
grep -n "// not defined" $texfiles | sed 's/$/ <--- use \\notdef instead/' | grep . && exit 1
2930

3031
# Library element introducer followed by stuff.
31-
grep -ne '^\\\(constraints\|mandates\|expects\|effects\|sync\|ensures\|returns\|throws\|complexity\|remarks\|errors\).\+$' $texfiles && exit 1
32+
grep -ne '^\\\(constraints\|mandates\|expects\|effects\|sync\|ensures\|returns\|throws\|complexity\|remarks\|errors\).\+$' $texlibdesc && exit 1
3233
# Fixup: sed 's/^\\\(constraints\|mandates\|expects\|effects\|sync\|ensures\|returns\|throws\|complexity\|remarks\|errors\)\s*\(.\)/\\\1\n\2/'
3334
# Fixup: sed 's/^\\ //'
3435

@@ -78,6 +79,14 @@ for f in $texfiles; do
7879
sed 's/$/ <--- "shall" inside a note/'
7980
done | grep . && exit 1
8081

82+
# Library descriptive macros not immediately preceded by \pnum.
83+
for f in $texlibdesc; do
84+
sed -n '/^\\pnum/{h;:x;n;/^\\index/b x;/^\\\(constraints\|mandates\|expects\|effects\|sync\|ensures\|returns\|throws\|complexity\|remarks\|errors\)/{x;/\n/{x;=;p};d};/^\\pnum/D;H;b x}' $f |
85+
# prefix output with filename and line
86+
sed '/^[0-9]\+$/{N;s/\n/:/}' | sed "s/.*/$f:&/" |
87+
sed 's/$/ <--- \\pnum missing/'
88+
done | grep . && exit 1
89+
8190
# \placeholder before (
8291
#egrep 'placeholder{[-A-Za-z]*}@?\(' *.tex
8392
# to fix: sed -i 's/placeholder\({[-A-Za-z]*}@\?(\)/placeholdernc\1/g' *.tex

0 commit comments

Comments
 (0)