[m-rev.] for review: support MS VC 2015
Sebastian Godelet
sebastian.godelet at outlook.com
Fri Mar 4 14:27:59 AEDT 2016
Hi Julien,
Actually after trying to reproduce the same error message again I see that the autoconf test does not throw this expected error message:
test_vsnprintf.c(7): error C2371: 'vsnprintf': redefinition; different basic types
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\stdio.h(1426): note: see declaration of 'vsnprintf'
Which results from compiling my short minimal example
/* vsnprintf example */
/* message only appears when you include stdio.h
#include <stdio.h>
*/
/* test_vsnprintf.c */
char vsnprintf();
int main ()
{
return 0;
}
It seems I got that only when I tried to debug this message.
So I think the problem is that the way autoconf runs this test does not fit the way the MS VC compiler works.
My suspicion is that this might be true for other functions as well.
Note that somehow this test works for VC <= 2013
I tried again with the latest ROTD and I got this error message from the linker:
conftest.obj : error LNK2019: unresolved external symbol _snprintf referenced in function _main
conftest.exe : fatal error LNK1120: 1 unresolved externals
Which is very strange since it happens during the test for snprintf (and the others)
configure:7183: checking for snprintf
configure:7183: cl -o conftest.exe -O -Iruntime -Iruntime/machdeps -Itrace conftest.c >&5
I've attached a stripped config.log (--verbose), problem starts from ">>> HERE <<<<".
For the patch itself, I think it could be improved by
+mercury_check_for_stdio_functions () {
+ for mercury_cv_stdio_func in "$@"
+ do
Only check if MR_HAVE_XYZ is false, in order to minimise the impact on the autoconf script
+ mercury_cv_stdio_func_define="MR_HAVE_`echo $mercury_cv_stdio_func | \
+ tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`"
+ AC_CHECK_DECL($mercury_cv_stdio_func, [
+ AC_DEFINE_UNQUOTED($mercury_cv_stdio_func_define)
+ ], , [#include <stdio.h>])
+ done
+}
Sebastian.
> -----Original Message-----
> From: Julien Fischer [mailto:jfischer at opturion.com]
> Sent: Friday, March 04, 2016 09:26
> To: Sebastian Godelet <sebastian.godelet at outlook.com>
> Cc: Mercury Reviews <reviews at lists.mercurylang.org>
> Subject: Re: [m-rev.] for review: support MS VC 2015
>
>
> Hi Sebastian,
>
> On Tue, 1 Mar 2016, Sebastian Godelet wrote:
>
> > Support compiling Mercury with MS Visual C compiler 2015, which currently
> fails configuring.
> > This is due to the added support of the ISO C99 (v)snprintf function family
> which then fails the functional test.
> > Instead of issuing a warning in the AC_CHECK_FUNC test, `cl' exists with
> #error, thus failing the test.
>
> What exactly is the error you are seeing? (I'm not objecting to the change; I
> just want to understand what's going on.)
>
> Julien.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: config.log
Type: application/octet-stream
Size: 21133 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/reviews/attachments/20160304/96dae3b6/attachment.obj>
More information about the reviews
mailing list