GNU bug report logs - #9960
Compiling Emacs trunk with MSVC

Previous Next

Packages: w32, emacs;

Reported by: Eli Zaretskii <eliz <at> gnu.org>

Date: Sat, 5 Nov 2011 11:24:02 UTC

Severity: normal

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #95 received at 9960 <at> debbugs.gnu.org (full text, mbox):

From: Fabrice Popineau <fabrice.popineau <at> supelec.fr>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Christoph Scholtes <cschol2112 <at> googlemail.com>, 9960 <at> debbugs.gnu.org
Subject: Re: bug#9960: Compiling Emacs trunk with MSVC
Date: Mon, 7 Nov 2011 17:13:09 +0100
[Message part 1 (text/plain, inline)]
>
> > Christoph Scholtes <cschol2112 <at> googlemail.com> writes:
> >
> > > Then we get to emacs.c:
> > > emacs.c(537) : error C2059: syntax error : '<<'
> > > emacs.c(537) : error C2059: syntax error : 'constant'
> > > emacs.c(537) : error C2059: syntax error : ')'
> >
> > cl.exe does not like the shift operator in this statement:
> >
> > static int __declspec(align(1 << 3)) test = 1;
>
> That comes from Fabrice, assuming that removing `static' doesn't help.
>
> Does it fail even if you take (1 << 3) in one more level of
> parentheses?
>
> What about an intermediate macro, as in
>
>  #define FOO (1 << GCTYPEBITS)
>  static int __declspec(align(FOO)) test = 1;


Ok. I have to admit that it does not work this way with msvc. Actually, I
can't find a way to make
cl.exe compute the (1<< GCTYPEBITS) before giving it to the align
declaration. At least not with the current release of cl.exe
(16.00.40219.01). I can't check about the previous ones I may have used.

Our best bet is to use a construction like :

#define GCTYPEBITS 4
#if (1<<GCTYPEBITS) == 2
#define ALIGN_GCTYPEBITS 2
#elif (1<<GCTYPEBITS) == 4
#define ALIGN_GCTYPEBITS 4
#elif (1<<GCTYPEBITS) == 8
#define ALIGN_GCTYPEBITS 8
#else
#error Define ALIGN_GCTYPEBITS
#endif

static int __declspec(align(ALIGN_GCTYPEBITS)) test = 1;

void main (int argc, char *argv[]) { }

Sorry but I don't see a shorter answer for the moment.

(Looking into other issues ... and yes I compiled it, I'm using my own
version every day :-) )

Fabrice
[Message part 2 (text/html, inline)]

This bug report was last modified 13 years and 61 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.