Hi,
Made (hopefully) final patch for 'MPIR/tests/misc/t-locale.c' and 'MPIR/tests/cxx/clocale.c' from MPIR 2.7.2 zipfile (patches added below) and provided a short description. What was changed and why: - using '__MINGW32__' macro allow builds for: -- 't-locale.c' using MinGW (i686) (currently builds succeed only using MinGW-W64 (i686,x86_64), more info added as comments into 't-locale.c'), -- 'clocale.c' using MinGW (i686) and MinGW-W64 (i686) (currently builds succeed only using MinGW-W64 (x86_64)), - removed obsolete preprocessor conditions in 't-locale.c' for: -- shared builds using Microsoft C/C++ Compiler (currently 'MPIR/build.vc*' tests are for static builds only), -- builds using Microsoft C/C++ Compiler version 9.0 (_MSC_VER=15.0) and before (currently oldest Visual Studio solution is 'MPIR/build.vc10', e.g. for Microsoft C/C++ Compiler version 10.0 (_MSC_VER=16.0)), - skipped 'localeconv' redefinition for Microsoft C/C++ Compiler, which fixes Microsoft linker warning: =============================================================== 2>libucrt.lib(localeconv.obj) : warning LNK4006: localeconv already defined in t-locale.obj; second definition ignored 2>C:\libMPIR-2.7.2\src\build.vc14\x64\Release\misc.locale.exe : warning LNK4088: image being generated due to /FORCE option; image may not run =============================================================== and allow correct run of 'misc.locale' test for builds using Microsoft C/C++ Compiler: =============================================================== cxx.locale : success misc.locale : success Test skipped, replacing localeconv/nl_langinfo doesn't work =============================================================== For some reason 'cxx.locale' test passes successfully with none usable 'localeconv'. It is inherent for builds using MinGW-W64 (i686,x86_64) too, thus it could be a flaw in 'MPIR/tests/cxx/t-locale.cc' test. Regards, Alexander =============================================================== --- mpir-2.7.2/tests/cxx/clocale.c 2015-11-19 06:10:15.132085700 -0800 +++ mpir-2.7.2_patched/tests/cxx/clocale.c 2016-01-09 13:19:03.733538900 -0800 @@ -43,8 +43,7 @@ extern char point_string[]; -#ifndef __MINGW64__ -#if HAVE_LOCALECONV +#if HAVE_LOCALECONV && ! (defined(__MINGW32__) || defined(_MSC_VER)) struct lconv * localeconv (void) { @@ -53,7 +52,6 @@ return &l; } #endif -#endif #if HAVE_NL_LANGINFO char * =============================================================== --- mpir-2.7.2/tests/misc/t-locale.c 2015-11-19 06:10:15.300235400 -0800 +++ mpir-2.7.2_patched/tests/misc/t-locale.c 2016-01-09 13:38:00.424828600 -0800 @@ -50,36 +50,19 @@ /* Replace the libc localeconv with one we can manipulate. */ /* -The t-local test fails on -mingw64 ie defined(_WIN64) && !defined(_MSC_VER) - - to detect a non-msvc 64bit windows the above is the best solution , - but as we are using it to exclude a test , - it would be better to only limit it to mingw64 only and not some - other future 64bit windows gcc , so it's best in this case to use the - defined(__MINGW64__) macro - -msvc with version<=1500 ie defined(_MSC_VER) && _MSC_VER <= 1500 + The 't-local' test build fails on MinGW, MinGW-W64 and Microsoft C/C++ + Compilers because of their own 'localeconv' implementation. + The goal is to detect that compilers and skip 'localeconv' redefinition, + so 't-local' test end up in "printf ("Test skipped...", which show that + replacing 'localeconv' is disabled (on Windows platform). + + It's best in this case to use '__MINGW32__' macro, which is common for all + MinGW (i686), MinGW-W64 (i686) and MinGW-W64 (x86_64), and '_MSC_VER' for + Microsoft C/C++ Compiler, details at http://sourceforge.net/p/predef/wiki/Home/ */ -#if _MSC_VER && __GMP_LIBGMP_DLL - -int -main (void) -{ - printf ("Test suppressed for windows DLL\n"); - exit (0); -} - - -#else /* ! DLL_EXPORT */ - -#if ! (defined(__MINGW64_VERSION_MAJOR) || (defined(_MSC_VER) && _MSC_VER <= 1500)) -#if HAVE_LOCALECONV -#ifdef _MSC_VER -__GMP_DECLSPEC -#endif +#if HAVE_LOCALECONV && ! (defined(__MINGW32__) || defined(_MSC_VER)) struct lconv * localeconv (void) { @@ -88,7 +71,6 @@ return &l; } #endif -#endif /* Replace the libc nl_langinfo with one we can manipulate. */ #if HAVE_NL_LANGINFO @@ -227,4 +209,3 @@ exit (0); } -#endif =============================================================== -- You received this message because you are subscribed to the Google Groups "mpir-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to mpir-devel+unsubscr...@googlegroups.com. To post to this group, send email to mpir-devel@googlegroups.com. Visit this group at https://groups.google.com/group/mpir-devel. For more options, visit https://groups.google.com/d/optout.