Commit 5b4ff53a authored by Paul Eggert's avatar Paul Eggert

Simplify by assuming !_MSC_VER.

Emacs has not been portable to MSVC for some time (Bug#29040#57).
* admin/CPP-DEFINES (_MSC_VER): Remove.
* src/lisp.h (ENUM_BF, DEFUN):
* src/regex.c (re_char):
Simplify by assuming _MSC_VER is not defined.
* src/regex.c (const_re_char): Remove.
All uses replaced by re_char.
parent e9fb9691
......@@ -19,7 +19,6 @@ __DJGPP_MINOR__ Minor version number of the DJGPP library; used only in msdos.c
DOS_NT Compiling for either the MS-DOS or native MS-Windows port.
WINDOWSNT Compiling the native MS-Windows (W32) port.
__MINGW32__ Compiling the W32 port with the MinGW or MinGW-w64 ports of GCC.
_MSC_VER Compiling the W32 port with the Microsoft C compiler.
MINGW_W64 Compiling the W32 port with the MinGW-w64 port of GCC.
DARWIN_OS Compiling on macOS or pure Darwin (and using s/darwin.h).
......@@ -49,9 +49,6 @@ char my_edata[] = "End of Emacs initialized data";
isn't always a separate section in NT executables). */
char my_endbss[1];
/* The Alpha MSVC linker globally segregates all static and public bss
data, so we must take both into account to determine the true extent
of the bss area used by Emacs. */
static char _my_endbss[1];
char * my_endbss_static = _my_endbss;
......@@ -418,9 +418,8 @@ error !;
#define case_Lisp_Int case Lisp_Int0: case Lisp_Int1
/* Idea stolen from GDB. Pedantic GCC complains about enum bitfields,
MSVC doesn't support them, and xlc and Oracle Studio c99 complain
vociferously about them. */
#if (defined __STRICT_ANSI__ || defined _MSC_VER || defined __IBMC__ \
and xlc and Oracle Studio c99 complain vociferously about them. */
#if (defined __STRICT_ANSI__ || defined __IBMC__ \
|| (defined __SUNPRO_C && __STDC__))
#define ENUM_BF(TYPE) unsigned int
......@@ -2935,23 +2934,12 @@ CHECK_NUMBER_CDR (Lisp_Object x)
/* This version of DEFUN declares a function prototype with the right
arguments, so we can catch errors with maxargs at compile-time. */
#ifdef _MSC_VER
#define DEFUN(lname, fnname, sname, minargs, maxargs, intspec, doc) \
Lisp_Object fnname DEFUN_ARGS_ ## maxargs ; \
static struct Lisp_Subr GCALIGNED sname = \
| (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) \
static struct Lisp_Subr GCALIGNED sname = \
{ .a ## maxargs = fnname }, \
minargs, maxargs, lname, intspec, 0}; \
Lisp_Object fnname
/* defsubr (Sname);
is how we define the symbol for function `name' at start-up time. */
......@@ -519,13 +519,7 @@ ptrdiff_t emacs_re_safe_alloca = MAX_ALLOCA;
/* Type of source-pattern and string chars. */
#ifdef _MSC_VER
typedef unsigned char re_char;
typedef const re_char const_re_char;
typedef const unsigned char re_char;
typedef re_char const_re_char;
typedef char boolean;
......@@ -2403,7 +2397,7 @@ do { \
} while (0)
static reg_errcode_t
regex_compile (const_re_char *pattern, size_t size,
regex_compile (re_char *pattern, size_t size,
#ifdef emacs
# define syntax RE_SYNTAX_EMACS
bool posix_backtracking,
......@@ -3728,7 +3722,7 @@ insert_op2 (re_opcode_t op, unsigned char *loc, int arg1, int arg2, unsigned cha
least one character before the ^. */
static boolean
at_begline_loc_p (const_re_char *pattern, const_re_char *p, reg_syntax_t syntax)
at_begline_loc_p (re_char *pattern, re_char *p, reg_syntax_t syntax)
re_char *prev = p - 2;
boolean odd_backslashes;
......@@ -3769,7 +3763,7 @@ at_begline_loc_p (const_re_char *pattern, const_re_char *p, reg_syntax_t syntax)
at least one character after the $, i.e., `P < PEND'. */
static boolean
at_endline_loc_p (const_re_char *p, const_re_char *pend, reg_syntax_t syntax)
at_endline_loc_p (re_char *p, re_char *pend, reg_syntax_t syntax)
re_char *next = p;
boolean next_backslash = *next == '\\';
......@@ -3813,7 +3807,7 @@ group_in_compile_stack (compile_stack_type compile_stack, regnum_t regnum)
Return -1 if fastmap was not updated accurately. */
static int
analyze_first (const_re_char *p, const_re_char *pend, char *fastmap,
analyze_first (re_char *p, re_char *pend, char *fastmap,
const int multibyte)
int j, k;
......@@ -4555,7 +4549,7 @@ static int bcmp_translate (re_char *s1, re_char *s2,
/* If the operation is a match against one or more chars,
return a pointer to the next operation, else return NULL. */
static re_char *
skip_one_char (const_re_char *p)
skip_one_char (re_char *p)
switch (*p++)
......@@ -4597,7 +4591,7 @@ skip_one_char (const_re_char *p)
/* Jump over non-matching operations. */
static re_char *
skip_noops (const_re_char *p, const_re_char *pend)
skip_noops (re_char *p, re_char *pend)
int mcnt;
while (p < pend)
......@@ -4628,7 +4622,7 @@ skip_noops (const_re_char *p, const_re_char *pend)
character (i.e. without any translations). UNIBYTE denotes whether c is
unibyte or multibyte character. */
static bool
execute_charset (const_re_char **pp, unsigned c, unsigned corig, bool unibyte)
execute_charset (re_char **pp, unsigned c, unsigned corig, bool unibyte)
re_char *p = *pp, *rtp = NULL;
bool not = (re_opcode_t) *p == charset_not;
......@@ -4692,8 +4686,8 @@ execute_charset (const_re_char **pp, unsigned c, unsigned corig, bool unibyte)
/* Non-zero if "p1 matches something" implies "p2 fails". */
static int
mutually_exclusive_p (struct re_pattern_buffer *bufp, const_re_char *p1,
const_re_char *p2)
mutually_exclusive_p (struct re_pattern_buffer *bufp, re_char *p1,
re_char *p2)
re_opcode_t op2;
const boolean multibyte = RE_MULTIBYTE_P (bufp);
......@@ -4931,8 +4925,8 @@ WEAK_ALIAS (__re_match_2, re_match_2)
/* This is a separate function so that we can force an alloca cleanup
afterwards. */
static regoff_t
re_match_2_internal (struct re_pattern_buffer *bufp, const_re_char *string1,
size_t size1, const_re_char *string2, size_t size2,
re_match_2_internal (struct re_pattern_buffer *bufp, re_char *string1,
size_t size1, re_char *string2, size_t size2,
ssize_t pos, struct re_registers *regs, ssize_t stop)
/* General temporaries. */
......@@ -6222,10 +6216,10 @@ re_match_2_internal (struct re_pattern_buffer *bufp, const_re_char *string1,
bytes; nonzero otherwise. */
static int
bcmp_translate (const_re_char *s1, const_re_char *s2, register ssize_t len,
bcmp_translate (re_char *s1, re_char *s2, ssize_t len,
RE_TRANSLATE_TYPE translate, const int target_multibyte)
register re_char *p1 = s1, *p2 = s2;
re_char *p1 = s1, *p2 = s2;
re_char *p1_end = s1 + len;
re_char *p2_end = s2 + len;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment