From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Fabrice Popineau Newsgroups: gmane.emacs.bugs Subject: bug#9960: Compiling Emacs trunk with MSVC Date: Mon, 7 Nov 2011 17:13:09 +0100 Message-ID: References: <83sjy5279e.fsf@gnu.org> <8339e2lsu7.fsf@gnu.org> <83zkgakdby.fsf@gnu.org> <4EB5320F.5090800@gmail.com> <83vcqyk8k3.fsf@gnu.org> <4EB540F4.7080106@gmail.com> <83r51mk62f.fsf@gnu.org> <86wrbeo7p5.fsf@googlemail.com> <83k47ejyyt.fsf@gnu.org> <86sjm2o559.fsf@googlemail.com> <86obwqo2hl.fsf@googlemail.com> <86ipmynwds.fsf@googlemail.com> <838vnujm3z.fsf@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=bcaec554d32ceb94fb04b12755c1 X-Trace: dough.gmane.org 1320682471 11756 80.91.229.12 (7 Nov 2011 16:14:31 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 7 Nov 2011 16:14:31 +0000 (UTC) Cc: Christoph Scholtes , 9960@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Nov 07 17:14:23 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RNRq3-0004Kh-5W for geb-bug-gnu-emacs@m.gmane.org; Mon, 07 Nov 2011 17:14:23 +0100 Original-Received: from localhost ([::1]:46267 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RNRq2-0000GU-EL for geb-bug-gnu-emacs@m.gmane.org; Mon, 07 Nov 2011 11:14:22 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:35706) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RNRpw-0000G7-4H for bug-gnu-emacs@gnu.org; Mon, 07 Nov 2011 11:14:20 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RNRpq-0006VT-23 for bug-gnu-emacs@gnu.org; Mon, 07 Nov 2011 11:14:16 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:36444) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RNRpq-0006VI-0Z for bug-gnu-emacs@gnu.org; Mon, 07 Nov 2011 11:14:10 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1RNRsb-0001Gf-TQ for bug-gnu-emacs@gnu.org; Mon, 07 Nov 2011 11:17:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Fabrice Popineau Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 07 Nov 2011 16:17:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9960 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 9960-submit@debbugs.gnu.org id=B9960.13206825874831 (code B ref 9960); Mon, 07 Nov 2011 16:17:01 +0000 Original-Received: (at 9960) by debbugs.gnu.org; 7 Nov 2011 16:16:27 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RNRs2-0001Fs-Vd for submit@debbugs.gnu.org; Mon, 07 Nov 2011 11:16:27 -0500 Original-Received: from mail-bw0-f44.google.com ([209.85.214.44]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RNRrz-0001Fg-CG for 9960@debbugs.gnu.org; Mon, 07 Nov 2011 11:16:25 -0500 Original-Received: by bkbzv15 with SMTP id zv15so3311200bkb.3 for <9960@debbugs.gnu.org>; Mon, 07 Nov 2011 08:13:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; bh=mvzWNVwunun52Odl7wpfcnRpQeiNrXZAVcOxCJrpvlQ=; b=OLvG3PccgT0N/4wyOG7MkuVWOrLQoddFDX+oHK1F9R3SSZTj8+LGSK1IH0cEdF1dN9 lnaAMweoEu2iTzdrPSM9Trb3hAhAhdCci5gOG/62TvO0LuAsU2/KxY2z0UgIg70IMC3c jl2Gy5Oc12tSTy+R16B9p1ZhhVBQvOv6Tqp4E= Original-Received: by 10.204.37.79 with SMTP id w15mr20103469bkd.4.1320682410185; Mon, 07 Nov 2011 08:13:30 -0800 (PST) Original-Received: by 10.204.120.6 with HTTP; Mon, 7 Nov 2011 08:13:09 -0800 (PST) In-Reply-To: <838vnujm3z.fsf@gnu.org> X-Google-Sender-Auth: MzHTlR8o7cDJwKa8cfTotMLkasI X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Mon, 07 Nov 2011 11:17:01 -0500 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:53663 Archived-At: --bcaec554d32ceb94fb04b12755c1 Content-Type: text/plain; charset=ISO-8859-1 > > > Christoph Scholtes 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<
> Christoph Scholtes <= cschol2112@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 =3D 1;

That comes from Fabrice, assuming that removing `static' doesn= 9;t help.

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

What about an intermediate macro, as in

=A0#define FOO (1 << GCTYPEBITS)
=A0static int __declspec(align(FOO)) test =3D 1;

Ok. I have to admit that it does not work this way with msvc. Actuall= y, I can't find a way to make
cl.exe compute the (1<< G= CTYPEBITS) before giving it to the align declaration. At least not with the= current release of cl.exe (16.00.40219.01).=A0I 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= ) =3D=3D 2
#define ALIGN_GCTYPEBITS 2
#elif (1<<G= CTYPEBITS) =3D=3D 4
#define ALIGN_GCTYPEBITS 4
#elif (1<<GCTYPEBITS) =3D= =3D 8
#define ALIGN_GCTYPEBITS 8
#else
#error= Define ALIGN_GCTYPEBITS
#endif

static i= nt __declspec(align(ALIGN_GCTYPEBITS)) test =3D 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 i= t, I'm using my own version every day :-) )

Fabrice
--bcaec554d32ceb94fb04b12755c1--