aboutsummaryrefslogtreecommitdiffstats
path: root/src/s
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/s
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/s')
-rw-r--r--src/s/ms-w32.h27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/s/ms-w32.h b/src/s/ms-w32.h
index 813c3cef11..519f6e7bc6 100644
--- a/src/s/ms-w32.h
+++ b/src/s/ms-w32.h
@@ -86,6 +86,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#define IS_ANY_SEP(_c_) (IS_DIRECTORY_SEP (_c_) || IS_DEVICE_SEP (_c_))
#include <sys/types.h>
+
+#ifdef _MSC_VER
+typedef unsigned long sigset_t;
+typedef int ssize_t;
+#endif
+
struct sigaction {
int sa_flags;
void (*sa_handler)(int);
@@ -181,6 +187,12 @@ struct sigaction {
#ifdef emacs
+#ifdef _MSC_VER
+#include <sys/timeb.h>
+#include <sys/stat.h>
+#include <signal.h>
+#endif
+
/* Calls that are emulated or shadowed. */
#undef access
#define access sys_access
@@ -270,6 +282,15 @@ typedef int pid_t;
#define utime _utime
#endif
+#ifdef _MSC_VER
+/* MSVC gets link-time errors without these redirections. */
+#define fstat(a, b) sys_fstat(a, b)
+#define stat(a, b) sys_stat(a, b)
+#if _MSC_VER >= 1400
+#define utime sys_utime
+#endif
+#endif
+
/* This is hacky, but is necessary to avoid warnings about macro
redefinitions using the SDK compilers. */
#ifndef __STDC__
@@ -317,13 +338,17 @@ extern char *get_emacs_configuration_options (void);
#define _WINSOCK_H
/* Defines size_t and alloca (). */
-#ifdef USE_CRT_DLL
+#if (defined(_MSC_VER) && defined(emacs)) || defined(USE_CRT_DLL)
#define malloc e_malloc
#define free e_free
#define realloc e_realloc
#define calloc e_calloc
#endif
+#ifdef _MSC_VER
+#define alloca _alloca
+#else
#include <malloc.h>
+#endif
#include <sys/stat.h>