diff options
author | Eli Zaretskii <eliz@gnu.org> | 2011-11-05 13:34:56 +0200 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2011-11-05 13:34:56 +0200 |
commit | a6fc3b5c539c0a35e4447a12cc395294952d7561 (patch) | |
tree | 1e04d32fc9bdb6972987c95b0f8bb96e050846a8 /src/lisp.h | |
parent | 27f5a13648b2f5b2873803c9338e77e61acfd1a5 (diff) | |
download | emacs-a6fc3b5c539c0a35e4447a12cc395294952d7561.tar.gz |
Support MSVC build with newer versions of Visual Studio.
Small portions of the changes by Fabrice Popineau <fabrice.popineau@supelec.fr>.
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/lisp.h')
-rw-r--r-- | src/lisp.h | 56 |
1 files changed, 39 insertions, 17 deletions
diff --git a/src/lisp.h b/src/lisp.h index df8812f73b7..f3c704bc763 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -168,6 +168,9 @@ extern int suppress_checking EXTERNALLY_VISIBLE; # if HAVE_ATTRIBUTE_ALIGNED # define DECL_ALIGN(type, var) \ type __attribute__ ((__aligned__ (1 << GCTYPEBITS))) var +# elif defined(_MSC_VER) +# define DECL_ALIGN(type, var) \ + type __declspec(align(1 << GCTYPEBITS)) var # else /* What directives do other compilers use? */ # endif @@ -225,6 +228,15 @@ extern int suppress_checking EXTERNALLY_VISIBLE; # endif #endif +/* Stolen from GDB. The only known compiler that doesn't support + enums in bitfields is MSVC. */ +#ifdef _MSC_VER +#define ENUM_BF(TYPE) unsigned int +#else +#define ENUM_BF(TYPE) enum TYPE +#endif + + enum Lisp_Type { /* Integer. XINT (obj) is the integer value. */ @@ -315,12 +327,12 @@ union Lisp_Object /* Use explict signed, the signedness of a bit-field of type int is implementation defined. */ signed EMACS_INT val : VALBITS; - enum Lisp_Type type : GCTYPEBITS; + ENUM_BF (Lisp_Type) type : GCTYPEBITS; } s; struct { EMACS_UINT val : VALBITS; - enum Lisp_Type type : GCTYPEBITS; + ENUM_BF (Lisp_Type) type : GCTYPEBITS; } u; } Lisp_Object; @@ -336,14 +348,14 @@ union Lisp_Object struct { - enum Lisp_Type type : GCTYPEBITS; + ENUM_BF (Lisp_Type) type : GCTYPEBITS; /* Use explict signed, the signedness of a bit-field of type int is implementation defined. */ signed EMACS_INT val : VALBITS; } s; struct { - enum Lisp_Type type : GCTYPEBITS; + ENUM_BF (Lisp_Type) type : GCTYPEBITS; EMACS_UINT val : VALBITS; } u; } @@ -1096,7 +1108,7 @@ struct Lisp_Symbol 1 : it's a varalias, the value is really in the `alias' symbol. 2 : it's a localized var, the value is in the `blv' object. 3 : it's a forwarding variable, the value is in `forward'. */ - enum symbol_redirect redirect : 3; + ENUM_BF (symbol_redirect) redirect : 3; /* Non-zero means symbol is constant, i.e. changing its value should signal an error. If the value is 3, then the var @@ -1309,7 +1321,7 @@ struct Lisp_Hash_Table struct Lisp_Misc_Any /* Supertype of all Misc types. */ { - enum Lisp_Misc_Type type : 16; /* = Lisp_Misc_??? */ + ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_??? */ unsigned gcmarkbit : 1; int spacer : 15; /* Make it as long as "Lisp_Free without padding". */ @@ -1318,7 +1330,7 @@ struct Lisp_Misc_Any /* Supertype of all Misc types. */ struct Lisp_Marker { - enum Lisp_Misc_Type type : 16; /* = Lisp_Misc_Marker */ + ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_Marker */ unsigned gcmarkbit : 1; int spacer : 13; /* This flag is temporarily used in the functions @@ -1468,7 +1480,7 @@ struct Lisp_Overlay I.e. 9words plus 2 bits, 3words of which are for external linked lists. */ { - enum Lisp_Misc_Type type : 16; /* = Lisp_Misc_Overlay */ + ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_Overlay */ unsigned gcmarkbit : 1; int spacer : 15; struct Lisp_Overlay *next; @@ -1487,7 +1499,7 @@ struct Lisp_Kboard_Objfwd This type of object is used in the arg to record_unwind_protect. */ struct Lisp_Save_Value { - enum Lisp_Misc_Type type : 16; /* = Lisp_Misc_Save_Value */ + ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_Save_Value */ unsigned gcmarkbit : 1; int spacer : 14; /* If DOGC is set, POINTER is the address of a memory @@ -1501,7 +1513,7 @@ struct Lisp_Save_Value /* A miscellaneous object, when it's on the free list. */ struct Lisp_Free { - enum Lisp_Misc_Type type : 16; /* = Lisp_Misc_Free */ + ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_Free */ unsigned gcmarkbit : 1; int spacer : 15; union Lisp_Misc *chain; @@ -1896,13 +1908,23 @@ typedef struct { /* This version of DEFUN declares a function prototype with the right arguments, so we can catch errors with maxargs at compile-time. */ -#define DEFUN(lname, fnname, sname, minargs, maxargs, intspec, doc) \ - Lisp_Object fnname DEFUN_ARGS_ ## maxargs ; \ - static DECL_ALIGN (struct Lisp_Subr, sname) = \ - { PVEC_SUBR, \ - { .a ## maxargs = fnname }, \ - minargs, maxargs, lname, intspec, 0}; \ - Lisp_Object fnname +#ifdef _MSC_VER +#define DEFUN(lname, fnname, sname, minargs, maxargs, intspec, doc) \ + Lisp_Object fnname DEFUN_ARGS_ ## maxargs ; \ + static DECL_ALIGN (struct Lisp_Subr, sname) = \ + { PVEC_SUBR | (sizeof (struct Lisp_Subr) / sizeof (EMACS_INT)), \ + { (Lisp_Object (__cdecl *)(void))fnname }, \ + minargs, maxargs, lname, intspec, 0}; \ + Lisp_Object fnname +#else /* not _MSC_VER */ +#define DEFUN(lname, fnname, sname, minargs, maxargs, intspec, doc) \ + Lisp_Object fnname DEFUN_ARGS_ ## maxargs ; \ + static DECL_ALIGN (struct Lisp_Subr, sname) = \ + { PVEC_SUBR, \ + { .a ## maxargs = fnname }, \ + minargs, maxargs, lname, intspec, 0}; \ + Lisp_Object fnname +#endif /* Note that the weird token-substitution semantics of ANSI C makes this work for MANY and UNEVALLED. */ |