Subject: Re: bug#9960: Compiling Emacs trunk with MSVC

From: Christoph Scholtes <[email-masked]>
Date: Sat, 05 Nov 2011 16:23:40 -0600

Eli Zaretskii <[email-masked]> writes:

> That comes from Fabrice, assuming that removing `static' doesn't help.

No, it does not.

> Does it fail even if you take (1 << 3) in one more level of
> parentheses?

Yes.

> What about an intermediate macro, as in
>
>  #define FOO (1 << GCTYPEBITS)
>  static int __declspec(align(FOO)) test = 1;
>
> ?

Not working. I tried all of these cases in my simple example. It does
seem to like the shift operator.

>> Other errors are due to missing definitions in stdint.h. The following
>> patch fixes this (64bit support added for completeness):
>
> Thanks, please install this.

I will. Thanks.

> Does this go away if you add "#define snprintf _snprintf" to
> src/s/ms-w32.h, for MSVC only?

Yes.

> These are because xdisp.c defines window_box_right `inline'.  (This is
> an optimized build, right? if not, does it mean that MSVC inlines
> functions even for a non-optimized builds?)  I would suggest to make
> that `inline' conditional on _MSC_VER being undefined.

That worked.

> Add "#define strtoimax _strtoi64" to src/s/ms-w32.h, conditioned on
> _MSC_VER.

Worked.

> Make this (from src/s/ms-w32.h):
>
>   #if !defined (_MSC_VER) || (_MSC_VER < 1400)
>   #define tzname    _tzname
>
> be defined unconditionally.  (But leave the "utime" part under the
> same condition it is today.)

This is a problem. The ensuing error is:

C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\time.h(281) : erro
r C2090: function returns array

>From time.h:
_CRT_INSECURE_DEPRECATE_GLOBALS(_get_tzname) _CRTIMP extern char * tzname[2];