emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r106533: Fix MS-Windows build with MS


From: Eli Zaretskii
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r106533: Fix MS-Windows build with MSVC compiler.
Date: Sun, 27 Nov 2011 20:52:53 +0200
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 106533
fixes bug(s): http://debbugs.gnu.org/9960
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Sun 2011-11-27 20:52:53 +0200
message:
  Fix MS-Windows build with MSVC compiler.
  
  Parts of the changes by Fabrice Popineau  <address@hidden>.
  
   lib-src/makefile.w32-in (LOCAL_FLAGS): Add $(EMACS_EXTRA_C_FLAGS).
   lib-src/emacsclient.c (main) <environ>: Remove declaration, already
   pulled in by unistd.h on Posix hosts and stdlib.h on MS-Windows.
   nt/inc/stdint.h (uint32_t, uint64_t) [_WIN64]: New typedefs.
   (UINT64_MAX) [_WIN64]: Fix definition.
   (uintmax_t, intmax_t): Fix definitions.
   nt/inc/inttypes.h (strtoumax, strtoimax) [!__MINGW32__]: Provide
   correct definitions.
   nt/config.nt (HAVE_DECL_STRTOLL): Define.
   (va_copy) [_WIN64]: Provide a better definition.
   src/s/ms-w32.h (utimbuf) [_MSC_VER]: Don't define.
   (snprintf) [_MSC_VER]: Redirect to _snprintf.
   (strtoll) [_MSC_VER]: Redirect to _strtoi64.
   (malloc, free, realloc, calloc): Redirect to e_* only when
   compiling Emacs.
   src/lisp.h (GCTYPEBITS): Move before first use.
   (ALIGN_GCTYPEBITS) [_MSC_VER]: Define.
   (DECL_ALIGN) [_MSC_VER]: Use it, as MSVC doesn't like bit ops in
   this macro definition.
   (tzname): Redirect to _tzname for all values of _MSC_VER.
modified:
  lib-src/ChangeLog
  lib-src/emacsclient.c
  lib-src/makefile.w32-in
  nt/ChangeLog
  nt/config.nt
  nt/inc/inttypes.h
  nt/inc/stdint.h
  src/ChangeLog
  src/lisp.h
  src/s/ms-w32.h
=== modified file 'lib-src/ChangeLog'
--- a/lib-src/ChangeLog 2011-11-26 08:26:37 +0000
+++ b/lib-src/ChangeLog 2011-11-27 18:52:53 +0000
@@ -1,3 +1,10 @@
+2011-11-27  Eli Zaretskii  <address@hidden>
+
+       * makefile.w32-in (LOCAL_FLAGS): Add $(EMACS_EXTRA_C_FLAGS).
+
+       * emacsclient.c (main) <environ>: Remove declaration, already
+       pulled in by unistd.h on Posix hosts and stdlib.h on MS-Windows.
+
 2011-11-24  Glenn Morris  <address@hidden>
 
        * make-docfile.c (scan_lisp_file): Treat defcustom like defvar.

=== modified file 'lib-src/emacsclient.c'
--- a/lib-src/emacsclient.c     2011-11-14 20:23:26 +0000
+++ b/lib-src/emacsclient.c     2011-11-27 18:52:53 +0000
@@ -1635,7 +1635,6 @@
   /* Send over our environment and current directory. */
   if (!current_frame)
     {
-      extern char **environ;
       int i;
       for (i = 0; environ[i]; i++)
         {

=== modified file 'lib-src/makefile.w32-in'
--- a/lib-src/makefile.w32-in   2011-07-07 01:32:56 +0000
+++ b/lib-src/makefile.w32-in   2011-11-27 18:52:53 +0000
@@ -23,7 +23,7 @@
 
 LOCAL_FLAGS    = -DWINDOWSNT -DDOS_NT -DNO_LDAV=1 \
                  -DNO_ARCHIVES=1 -DHAVE_CONFIG_H=1 -I../lib \
-                 -I../nt/inc -I../src
+                 -I../nt/inc -I../src $(EMACS_EXTRA_C_FLAGS)
 
 LIBS           = $(BASE_LIBS) $(ADVAPI32)
 

=== modified file 'nt/ChangeLog'
--- a/nt/ChangeLog      2011-11-26 08:26:37 +0000
+++ b/nt/ChangeLog      2011-11-27 18:52:53 +0000
@@ -1,3 +1,15 @@
+2011-11-27  Fabrice Popineau  <address@hidden>  (tiny change)
+
+       * inc/stdint.h (uint32_t, uint64_t) [_WIN64]: New typedefs.
+       (UINT64_MAX) [_WIN64]: Fix definition.
+       (uintmax_t, intmax_t): Fix definitions.
+
+       * inc/inttypes.h (strtoumax, strtoimax) [!__MINGW32__]: Provide
+       correct definitions.
+
+       * config.nt (HAVE_DECL_STRTOLL): Define.
+       (va_copy) [_WIN64]: Provide a better definition.
+
 2011-11-25  Juanma Barranquero  <address@hidden>
 
        * configure.bat: Fix typos.

=== modified file 'nt/config.nt'
--- a/nt/config.nt      2011-11-05 17:16:01 +0000
+++ b/nt/config.nt      2011-11-27 18:52:53 +0000
@@ -303,6 +303,10 @@
 /* Define to 1 if you have the `localtime_r' function. */
 #undef HAVE_LOCALTIME_R
 
+/* Define to 1 if you have the declaration of `strtoll', and to 0 if you
+   don't. */
+#define HAVE_DECL_STRTOLL 1
+
 /* Define to 1 if you have the declaration of `strtoull', and to 0 if you
    don't. */
 #define HAVE_DECL_STRTOULL 1
@@ -353,8 +357,8 @@
 /* A va_copy replacement for MSVC.  */
 #ifdef _MSC_VER
 # ifdef _WIN64
-#  ifndef va_copy
-#   error "va_copy is needed, but not defined!"
+#  ifndef va_copy               /* Need to be checked (?) */
+#   define va_copy(d,s) ((d) = (s))
 #  endif
 # else /* not _WIN64 */
 #  define va_copy(d,s) ((d) = (s))

=== modified file 'nt/inc/inttypes.h'
--- a/nt/inc/inttypes.h 2011-05-06 12:09:08 +0000
+++ b/nt/inc/inttypes.h 2011-11-27 18:52:53 +0000
@@ -24,7 +24,13 @@
 #include_next <inttypes.h>
 #else  /* !__MINGW32__ */
 #include "stdint.h"
+#ifdef _WIN64
 #define strtoumax _strtoui64
+#define strtoimax _strtoi64
+#else
+#define strtoumax strtoul
+#define strtoimax strtol
+#endif
 #endif /* !__MINGW32__ */
 
 #endif

=== modified file 'nt/inc/stdint.h'
--- a/nt/inc/stdint.h   2011-11-13 14:43:13 +0000
+++ b/nt/inc/stdint.h   2011-11-27 18:52:53 +0000
@@ -29,7 +29,9 @@
 
 #ifdef _WIN64
 typedef __int64 intptr_t;
-#define UINT64_MAX 18446744073709551615
+typedef unsigned int uint32_t;
+typedef unsigned __int64 uint64_t;
+#define UINT64_MAX (18446744073709551615i64)
 #define UINT64_MIN 0
 /* "i64" is the non-standard suffix used by MSVC for 64-bit constants.  */
 #define INT64_MAX 9223372036854775807i64
@@ -39,6 +41,8 @@
 #define UINTMAX_MIN UINT64_MIN
 #define INTMAX_MAX INT64_MAX
 #define INTMAX_MIN INT64_MIN
+#define uintmax_t unsigned __int64
+#define intmax_t __int64
 #else
 typedef int intptr_t;
 typedef unsigned int uint32_t;
@@ -51,10 +55,10 @@
 #define UINTMAX_MIN UINT32_MIN
 #define INTMAX_MAX INT32_MAX
 #define INTMAX_MIN INT32_MIN
+#define uintmax_t unsigned long
+#define intmax_t long
 #endif
 
-#define uintmax_t unsigned __int64
-#define intmax_t __int64
 #define PTRDIFF_MAX INTPTR_MAX
 
 #endif /* !__GNUC__ */

=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2011-11-27 18:33:17 +0000
+++ b/src/ChangeLog     2011-11-27 18:52:53 +0000
@@ -1,3 +1,19 @@
+2011-11-27  Eli Zaretskii  <address@hidden>
+
+       * s/ms-w32.h (utimbuf) [_MSC_VER]: Don't define.
+       (snprintf) [_MSC_VER]: Redirect to _snprintf.
+       (strtoll) [_MSC_VER]: Redirect to _strtoi64.
+       (malloc, free, realloc, calloc): Redirect to e_* only when
+       compiling Emacs.
+
+       * lisp.h (GCTYPEBITS): Move before first use.
+       (ALIGN_GCTYPEBITS) [_MSC_VER]: Define.
+       (DECL_ALIGN) [_MSC_VER]: Use it, as MSVC doesn't like bit ops in
+       this macro definition.
+
+       * s/ms-w32.h (tzname): Redirect to _tzname for all values of
+       _MSC_VER.
+
 2011-11-27  Jan Djärv  <address@hidden>
 
        * gtkutil.c (xg_create_frame_widgets): Call

=== modified file 'src/lisp.h'
--- a/src/lisp.h        2011-11-27 04:43:11 +0000
+++ b/src/lisp.h        2011-11-27 18:52:53 +0000
@@ -163,14 +163,23 @@
 /* First, try and define DECL_ALIGN(type,var) which declares a static
    variable VAR of type TYPE with the added requirement that it be
    TYPEBITS-aligned.  */
+
+#ifndef GCTYPEBITS
+#define GCTYPEBITS 3
+#endif
+
 #ifndef NO_DECL_ALIGN
 # ifndef DECL_ALIGN
 #  if HAVE_ATTRIBUTE_ALIGNED
 #   define DECL_ALIGN(type, var) \
      type __attribute__ ((__aligned__ (1 << GCTYPEBITS))) var
 #  elif defined(_MSC_VER)
+#   define ALIGN_GCTYPEBITS 8
+#   if (1 << GCTYPEBITS) != ALIGN_GCTYPEBITS
+#    error ALIGN_GCTYPEBITS is wrong!
+#   endif
 #   define DECL_ALIGN(type, var) \
-     type __declspec(align(1 << GCTYPEBITS)) var
+     type __declspec(align(ALIGN_GCTYPEBITS)) var
 #  else
      /* What directives do other compilers use?  */
 #  endif
@@ -300,10 +309,6 @@
     Lisp_Fwd_Kboard_Obj,       /* Fwd to a Lisp_Object field of kboards.  */
   };
 
-#ifndef GCTYPEBITS
-#define GCTYPEBITS 3
-#endif
-
 /* These values are overridden by the m- file on some machines.  */
 #ifndef VALBITS
 #define VALBITS (BITS_PER_EMACS_INT - GCTYPEBITS)

=== modified file 'src/s/ms-w32.h'
--- a/src/s/ms-w32.h    2011-11-05 16:30:13 +0000
+++ b/src/s/ms-w32.h    2011-11-27 18:52:53 +0000
@@ -267,6 +267,8 @@
 #define getpid    _getpid
 #ifdef _MSC_VER
 typedef int pid_t;
+#define snprintf  _snprintf
+#define strtoll   _strtoi64
 #endif
 #define isatty    _isatty
 #define logb      _logb
@@ -275,15 +277,17 @@
 #define popen     _popen
 #define pclose    _pclose
 #define umask    _umask
+#ifndef _MSC_VER
 #define utimbuf          _utimbuf
+#endif
 #define strdup    _strdup
 #define strupr    _strupr
 #define strnicmp  _strnicmp
 #define stricmp   _stricmp
 #define tzset     _tzset
 
+#define tzname    _tzname
 #if !defined (_MSC_VER) || (_MSC_VER < 1400)
-#define tzname    _tzname
 #undef  utime
 #define utime    _utime
 #endif
@@ -335,7 +339,7 @@
 #define _WINSOCK_H
 
 /* Defines size_t and alloca ().  */
-#if (defined(_MSC_VER) && defined(emacs)) || defined(USE_CRT_DLL)
+#ifdef emacs
 #define malloc e_malloc
 #define free   e_free
 #define realloc e_realloc


reply via email to

[Prev in Thread] Current Thread [Next in Thread]