aboutsummaryrefslogtreecommitdiffstats
path: root/src/w32.c
diff options
context:
space:
mode:
authorEli Zaretskii <[email protected]>2011-11-05 13:34:56 +0200
committerEli Zaretskii <[email protected]>2011-11-05 13:34:56 +0200
commita6fc3b5c539c0a35e4447a12cc395294952d7561 (patch)
tree1e04d32fc9bdb6972987c95b0f8bb96e050846a8 /src/w32.c
parent27f5a13648b2f5b2873803c9338e77e61acfd1a5 (diff)
Support MSVC build with newer versions of Visual Studio.
Small portions of the changes by Fabrice Popineau <[email protected]>. src/makefile.w32-in (TAGS-gmake): Don't use $(patsubst ...), as Nmake barfs on that. Use $(OBJ*_c) variables instead, defined on nt/gmake.defs. src/lisp.h (ENUM_BF): New macro, for enumerated types in bitfields, which are not supported by MSVC. (Lisp_Symbol, Lisp_Misc_Any, Lisp_Marker, Lisp_Misc_Overlay) (Lisp_Save_Value, Lisp_Free): Use ENUM_BF for enumerated types in bitfields. (Lisp_Object) [USE_LISP_UNION_TYPE]: Use ENUM_BF for enumerated types in bitfields. (DEFUN) [_MSC_VER]: Define in a different way for MSVC. src/w32fns.c [_MSC_VER]: DECLARE_HANDLE for any MSVC version. src/w32.c: Don't include w32api.h for MSVC. (init_environment) [_MSC_VER]: Call sys_access, not _access. src/s/ms-w32.h <sigset_t, ssize_t> [_MSC_VER]: Typedefs for MSVC. [_MSC_VER]: Include sys/timeb.h, sys/stat.h, and signal.h. (fstat, stat, utime) [_MSC_VER]: Redirect to their sys_* cousins. (malloc, free, realloc, calloc) [_MSC_VER]: Always redirect to the e_* cousins. (alloca) [_MSC_VER]: Define to _alloca. src/lisp.h (DECL_ALIGN) [_MSC_VER]: Define for MSVC. src/regex.c <re_char> [_MSC_VER]: A separate definition for MSVC. nt/makefile.w32-in (clean-other-dirs-nmake) (distclean-other-dirs-nmake, maintainer-clean-other-dirs-nmake): Update for current structure of doc/ subdirectories. nt/gmake.defs (OBJ0_c, OBJ1_c, OBJ2_c): New variables. nt/INSTALL: Update for newer versions of MSVC. lib/makefile.w32-in (FRC): New dummy target. (TAGS): Depend on FRC. Fixes: debbugs:9960
Diffstat (limited to 'src/w32.c')
-rw-r--r--src/w32.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/w32.c b/src/w32.c
index 42546fc8d4..f17e987f43 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -94,7 +94,9 @@ typedef struct _MEMORY_STATUS_EX {
#include <tlhelp32.h>
#include <psapi.h>
+#ifndef _MSC_VER
#include <w32api.h>
+#endif
#if !defined (__MINGW32__) || __W32API_MAJOR_VERSION < 3 || (__W32API_MAJOR_VERSION == 3 && __W32API_MINOR_VERSION < 15)
/* This either is not in psapi.h or guarded by higher value of
_WIN32_WINNT than what we use. w32api supplied with MinGW 3.15
@@ -1547,7 +1549,12 @@ init_environment (char ** argv)
read-only filesystem, like CD-ROM or a write-protected floppy.
The only way to be really sure is to actually create a file and
see if it succeeds. But I think that's too much to ask. */
+#ifdef _MSC_VER
+ /* MSVC's _access crashes with D_OK. */
+ if (tmp && sys_access (tmp, D_OK) == 0)
+#else
if (tmp && _access (tmp, D_OK) == 0)
+#endif
{
char * var = alloca (strlen (tmp) + 8);
sprintf (var, "TMPDIR=%s", tmp);