From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Christoph Scholtes Newsgroups: gmane.emacs.bugs Subject: bug#9960: Compiling Emacs trunk with MSVC Date: Sat, 05 Nov 2011 14:32:15 -0600 Message-ID: <86ipmynwds.fsf@googlemail.com> 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> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1320525211 16903 80.91.229.12 (5 Nov 2011 20:33:31 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 5 Nov 2011 20:33:31 +0000 (UTC) Cc: fabrice.popineau@supelec.fr, 9960@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Nov 05 21:33:27 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 1RMmvc-0006LP-VG for geb-bug-gnu-emacs@m.gmane.org; Sat, 05 Nov 2011 21:33:25 +0100 Original-Received: from localhost ([::1]:34486 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RMmvc-0004Kk-IK for geb-bug-gnu-emacs@m.gmane.org; Sat, 05 Nov 2011 16:33:24 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:36680) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RMmvZ-0004Kf-Di for bug-gnu-emacs@gnu.org; Sat, 05 Nov 2011 16:33:22 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RMmvY-0003DG-9O for bug-gnu-emacs@gnu.org; Sat, 05 Nov 2011 16:33:21 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:58011) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RMmvY-0003DC-6Y for bug-gnu-emacs@gnu.org; Sat, 05 Nov 2011 16:33:20 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1RMmy9-0006bs-Mk for bug-gnu-emacs@gnu.org; Sat, 05 Nov 2011 16:36:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Christoph Scholtes Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 05 Nov 2011 20:36: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.132052531525354 (code B ref 9960); Sat, 05 Nov 2011 20:36:01 +0000 Original-Received: (at 9960) by debbugs.gnu.org; 5 Nov 2011 20:35:15 +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 1RMmxO-0006at-WE for submit@debbugs.gnu.org; Sat, 05 Nov 2011 16:35:15 -0400 Original-Received: from mail-gx0-f172.google.com ([209.85.161.172]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RMmxM-0006aj-Fy for 9960@debbugs.gnu.org; Sat, 05 Nov 2011 16:35:13 -0400 Original-Received: by ggnv1 with SMTP id v1so3637871ggn.3 for <9960@debbugs.gnu.org>; Sat, 05 Nov 2011 13:32:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version:content-type; bh=npxPxZSePYluUaH/V9zdZAqYqalH+u8nBIPZU0PrurI=; b=hziTxdf4i7cExXDJFWqRsYSaH88yr/wOWikpZ0FsfLJ+t7+dsK+upOmP8si2HvfZKx s+yV1/bxUHgd0FMiEhFkUibQFtFk77CLEEkrrCIdzL4ibIFB+jkRNVI4E5TIedze8zo3 QaHM48qyyVw8H4uN5JLSCvSM+TMW+ih//qlQo= Original-Received: by 10.236.173.131 with SMTP id v3mr27962490yhl.112.1320525149994; Sat, 05 Nov 2011 13:32:29 -0700 (PDT) Original-Received: from MARVIN (71-212-156-190.hlrn.qwest.net. [71.212.156.190]) by mx.google.com with ESMTPS id y71sm21085028yhh.6.2011.11.05.13.32.28 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 05 Nov 2011 13:32:29 -0700 (PDT) In-Reply-To: <86obwqo2hl.fsf@googlemail.com> (Christoph Scholtes's message of "Sat, 05 Nov 2011 12:20:22 -0600") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.91 (windows-nt) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Sat, 05 Nov 2011 16:36:01 -0400 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:53565 Archived-At: 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; whereas static int __declspec(align(8)) test = 1; works. The above is a simple test case to confirm the fault is in this code in lisp.h, l.172: # elif defined(_MSC_VER) # define DECL_ALIGN(type, var) \ type __declspec(align(1 << GCTYPEBITS)) var Other errors are due to missing definitions in stdint.h. The following patch fixes this (64bit support added for completeness): === modified file 'nt/inc/stdint.h' --- nt/inc/stdint.h 2011-06-07 12:34:09 +0000 +++ nt/inc/stdint.h 2011-11-05 20:03:50 +0000 @@ -27,21 +27,37 @@ /* Minimum definitions to allow compilation with tool chains where stdint.h is not available, e.g. Microsoft Visual Studio. */ -typedef unsigned int uint32_t; -#define INT32_MAX 2147483647 -/* "i64" is the non-standard suffix used by MSVC for 64-bit constants. */ -#define INT64_MAX 9223372036854775807i64 - #ifdef _WIN64 typedef __int64 intptr_t; +#define UINT64_MAX 18446744073709551616 +#define UINT64_MIN 0 +/* "i64" is the non-standard suffix used by MSVC for 64-bit constants. */ +#define INT64_MAX 9223372036854775807i64 +#define INT64_MIN (~INT64_MAX) #define INTPTR_MAX INT64_MAX +#define UINTMAX_MAX UINT64_MAX +#define UINTMAX_MIN UINT64_MIN +#define INTMAX_MAX INT64_MAX +#define INTMAX_MIN INT64_MIN #else typedef int intptr_t; +typedef unsigned int uint32_t; +#define UINT32_MAX 4294967296 +#define UINT32_MIN 0 +#define INT32_MAX 2147483647 +#define INT32_MIN (~INT32_MAX) #define INTPTR_MAX INT32_MAX +#define UINTMAX_MAX UINT32_MAX +#define UINTMAX_MIN UINT32_MIN +#define INTMAX_MAX INT32_MAX +#define INTMAX_MIN INT32_MIN #endif #define uintmax_t unsigned __int64 +#define intmax_t __int64 #define PTRDIFF_MAX INTPTR_MAX + + #endif /* !__GNUC__ */ There are tons of warnings, but everything compiles from then on. Creating temacs.lib fails when linking with the following errors: temacs2.lib(font.obj) : error LNK2019: unresolved external symbol _snprintf refe renced in function _font_unparse_xlfd temacs2.lib(fringe.obj) : error LNK2019: unresolved external symbol _window_box_ right referenced in function _draw_fringe_bitmap_1 temacs2.lib(w32term.obj) : error LNK2001: unresolved external symbol _window_box _right temacs2.lib(xdisp.obj) : error LNK2019: unresolved external symbol _strtoimax re ferenced in function _message_log_check_duplicate libgnu.lib(strftime.obj) : error LNK2001: unresolved external symbol _tzname obj/i386/temacs.bin : fatal error LNK1120: 4 unresolved externals