summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2018-08-20 06:47:44 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2018-08-20 06:47:44 +0000
commit166fb30fdc48d55d0de10456c9d2e50b5ce7aecf (patch)
tree433cf929bc122d0dfbf9211bbcbffa019c4d0b70
parentd417419d1e652edcd77ea1e40b02d823429be2d4 (diff)
downloadmpfr-166fb30fdc48d55d0de10456c9d2e50b5ce7aecf.tar.gz
[tools/mpfrlint] Check that __GMP_DECLSPEC is not used by MPFR.
[src/mpfr-longlong.h] Replaced __GMP_DECLSPEC by __MPFR_DECLSPEC. Otherwise, with Windows DLL, __GMP_DECLSPEC is replaced by __declspec(dllimport), which is wrong when building MPFR and yields warning LNK4217 such as: eint.obj : warning LNK4217: locally defined symbol mpfr_clz_tab imported in function mpfr_eint due to extern const unsigned char __GMP_DECLSPEC __clz_tab[129]; (note that mpfr_clz_tab is defined with "#define __clz_tab mpfr_clz_tab" only without the GMP build). See: https://sympa.inria.fr/sympa/arc/mpfr/2018-08/msg00000.html https://sympa.inria.fr/sympa/arc/mpfr/2018-08/msg00001.html (merged changesets r12975-12977 from the trunk) git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/4.0@12992 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r--src/mpfr-longlong.h4
-rwxr-xr-xtools/mpfrlint10
2 files changed, 12 insertions, 2 deletions
diff --git a/src/mpfr-longlong.h b/src/mpfr-longlong.h
index 64cd9c31c..446b23130 100644
--- a/src/mpfr-longlong.h
+++ b/src/mpfr-longlong.h
@@ -2103,7 +2103,7 @@ extern __longlong_h_C UWtype mpn_udiv_qrnnd_r (UWtype, UWtype, UWtype, UWtype *)
(q) = __MPN(udiv_w_sdiv) (&__r, nh, nl, d); \
(r) = __r; \
} while (0)
-__GMP_DECLSPEC UWtype __MPN(udiv_w_sdiv) (UWtype *, UWtype, UWtype, UWtype);
+__MPFR_DECLSPEC UWtype __MPN(udiv_w_sdiv) (UWtype *, UWtype, UWtype, UWtype);
#endif
/* If udiv_qrnnd was not defined for this processor, use __udiv_qrnnd_c. */
@@ -2147,7 +2147,7 @@ __GMP_DECLSPEC UWtype __MPN(udiv_w_sdiv) (UWtype *, UWtype, UWtype, UWtype);
#endif
#ifdef COUNT_LEADING_ZEROS_NEED_CLZ_TAB
-extern const unsigned char __GMP_DECLSPEC __clz_tab[129];
+extern const unsigned char __MPFR_DECLSPEC __clz_tab[129];
#endif
#if !defined (count_trailing_zeros)
diff --git a/tools/mpfrlint b/tools/mpfrlint
index 89dc6a855..04fc8a9f2 100755
--- a/tools/mpfrlint
+++ b/tools/mpfrlint
@@ -178,6 +178,16 @@ grep '__gmp[nz]_' $srctests | \
grep -v __gmpn_rsblsh_n | \
err-if-output "GMP internals" cat
+# __MPFR_DECLSPEC (based on the __MPFR_WITHIN_MPFR status) must be used
+# instead of __GMP_DECLSPEC (based on the __GMP_WITHIN_GMP status, always
+# undefined in MPFR); in particular, the __GMP_DECLSPEC occurrences from
+# GMP's longlong.h file must be changed to __MPFR_DECLSPEC when porting
+# this file to MPFR. See:
+# https://sympa.inria.fr/sympa/arc/mpfr/2018-08/msg00000.html
+# https://sympa.inria.fr/sympa/arc/mpfr/2018-08/msg00001.html
+err-if-output --msg="Use __MPFR_DECLSPEC instead." -t "__GMP_DECLSPEC" \
+ grep --exclude=src/mpfr.h __GMP_DECLSPEC $srctests
+
err-if-output --msg="Use mpfr_limb_ptr and mpfr_limb_srcptr instead." \
-t "mp_ptr and mp_srcptr" grep -E 'mp_(src)?ptr' $srctests