summaryrefslogtreecommitdiff
path: root/tools/mpfrlint
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2016-07-31 17:15:31 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2016-07-31 17:15:31 +0000
commit8a039359d3a8f42a68c4eae157b694945a112abe (patch)
treebf732a038e20a8591615a75da90df33285f379bd /tools/mpfrlint
parentafb3a43f6d97e46a5b97efad03dfaace33e4146b (diff)
downloadmpfr-8a039359d3a8f42a68c4eae157b694945a112abe.tar.gz
[tools/mpfrlint] Detect possibly wrong code with some C/GMP
implementations, related to shifts and integer types. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@10703 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tools/mpfrlint')
-rwxr-xr-xtools/mpfrlint8
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/mpfrlint b/tools/mpfrlint
index 30538fea5..f25d84389 100755
--- a/tools/mpfrlint
+++ b/tools/mpfrlint
@@ -221,6 +221,14 @@ grep '(mp_limb_t) *-\?[01]' $srctests | grep -v '#define MPFR_LIMB_' | \
err-if-output -t "Use simple mp_limb_t constants" \
grep -v MPFR_STAT_STATIC_ASSERT
+# Code possibly wrong with some C/GMP implementations. In short, if the
+# right operand of a shift depends on GMP_NUMB_BITS, then the left operand
+# should be of type mp_limb_t. There might be false positives.
+err-if-output \
+ --msg="Use a constant of type mp_limb_t instead of unsigned long?" \
+ -t "Suspicious code" \
+ grep -E '[^A_Za-z_][0-9]+[UL]* *<<.*GMP_NUMB_BITS' src/*.c
+
for file in $srctests */Makefile.am acinclude.m4 configure.ac
do
# Note: this is one less that the POSIX minimum limit in case