summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2019-04-25 12:21:30 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2019-04-25 12:21:30 +0000
commit7231a4fddd79fb547e0c2a3d57691bc25de593d9 (patch)
tree0af3ee4942588cb2f1863db8164e954d18644ce7
parent7e408afc43bc53101409ebfc94d1f00fe0723f77 (diff)
downloadmpfr-7231a4fddd79fb547e0c2a3d57691bc25de593d9.tar.gz
[tools/mpfrlint] Check that the lists of rounding modes in
src/print_rnd_mode.c and doc/mpfr.texi are identical. [doc/mpfr.texi] Updated the list of rounding modes in the description of the mpfr_print_rnd_mode function. Choose the same order as in the "Rounding Modes" section in "MPFR Basics". (merged changesets r13472,13474-13475 from the trunk) git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/4.0@13476 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r--doc/mpfr.texi6
-rwxr-xr-xtools/mpfrlint11
2 files changed, 14 insertions, 3 deletions
diff --git a/doc/mpfr.texi b/doc/mpfr.texi
index 9c0a95669..3c9d17219 100644
--- a/doc/mpfr.texi
+++ b/doc/mpfr.texi
@@ -3081,9 +3081,9 @@ Return the minimal number of bits required to store the significand of
@end deftypefun
@deftypefun {const char *} mpfr_print_rnd_mode (mpfr_rnd_t @var{rnd})
-Return a string ("MPFR_RNDD", "MPFR_RNDU", "MPFR_RNDN", "MPFR_RNDZ",
-"MPFR_RNDA") corresponding to the rounding mode @var{rnd}, or a null pointer
-if @var{rnd} is an invalid rounding mode.
+Return a string ("MPFR_RNDN", "MPFR_RNDZ", "MPFR_RNDU", "MPFR_RNDD",
+"MPFR_RNDA", "MPFR_RNDF") corresponding to the rounding mode @var{rnd},
+or a null pointer if @var{rnd} is an invalid rounding mode.
@end deftypefun
@deftypefn Macro int mpfr_round_nearest_away (int (@var{foo})(mpfr_t, type1_t, ..., mpfr_rnd_t), mpfr_t @var{rop}, type1_t @var{op}, ...)
diff --git a/tools/mpfrlint b/tools/mpfrlint
index 810799b2a..2020e7fa6 100755
--- a/tools/mpfrlint
+++ b/tools/mpfrlint
@@ -386,6 +386,17 @@ grep -E '[^a-z_](m|re)alloc *\(' tests/*.c | \
err-if-output --dir=doc "check-typography" ./check-typography
+rndmodes1=(${(o)$(perl -ne '/return\s*"(MPFR_\S+)"/ and print "$1\n"' src/print_rnd_mode.c)})
+rndmodes2=(${(o)$(sed -n '/deftypefun.*mpfr_print_rnd_mode/,/end deftypefun/{s/[^"]*"\(MPFR_[^"]*\)"[^"]*/\1\n/gp}' doc/mpfr.texi)})
+rndmodes3=(${(o)$(sed -n '/The following rounding modes are supported:/,/end itemize/{s/.*@item @code{\(MPFR_[^}]*\)}.*/\1/p}' doc/mpfr.texi)})
+[[ "$rndmodes1" == "$rndmodes2" && "$rndmodes2" == "$rndmodes3" ]] ||
+ { cat <<EOF && err=1 }
+The lists of rounding modes in src/print_rnd_mode.c and doc/mpfr.texi differ:
+ $rndmodes1
+ $rndmodes2
+ $rndmodes3
+EOF
+
fdlv1="`sed -n '/Version / {
s/.*Version //
s/,.*//