aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2017-11-02 21:54:23 -0700
committerPaul Eggert2017-11-02 21:56:01 -0700
commit5b4ff53ab4579532b1b9eba233c135fee274d674 (patch)
tree0217d798f3648a8d3e118ab3946533cf87d522f3
parente9fb9691ac3b2a1f60ba84a3350a3e65a853bbc0 (diff)
downloademacs-5b4ff53ab4579532b1b9eba233c135fee274d674.tar.gz
emacs-5b4ff53ab4579532b1b9eba233c135fee274d674.zip
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.
-rw-r--r--admin/CPP-DEFINES1
-rw-r--r--src/lastfile.c3
-rw-r--r--src/lisp.h16
-rw-r--r--src/regex.c32
4 files changed, 15 insertions, 37 deletions
diff --git a/admin/CPP-DEFINES b/admin/CPP-DEFINES
index 10b558d1ada..eb3eadf2da8 100644
--- a/admin/CPP-DEFINES
+++ b/admin/CPP-DEFINES
@@ -19,7 +19,6 @@ __DJGPP_MINOR__ Minor version number of the DJGPP library; used only in msdos.c
19DOS_NT Compiling for either the MS-DOS or native MS-Windows port. 19DOS_NT Compiling for either the MS-DOS or native MS-Windows port.
20WINDOWSNT Compiling the native MS-Windows (W32) port. 20WINDOWSNT Compiling the native MS-Windows (W32) port.
21__MINGW32__ Compiling the W32 port with the MinGW or MinGW-w64 ports of GCC. 21__MINGW32__ Compiling the W32 port with the MinGW or MinGW-w64 ports of GCC.
22_MSC_VER Compiling the W32 port with the Microsoft C compiler.
23MINGW_W64 Compiling the W32 port with the MinGW-w64 port of GCC. 22MINGW_W64 Compiling the W32 port with the MinGW-w64 port of GCC.
24DARWIN_OS Compiling on macOS or pure Darwin (and using s/darwin.h). 23DARWIN_OS Compiling on macOS or pure Darwin (and using s/darwin.h).
25SOLARIS2 24SOLARIS2
diff --git a/src/lastfile.c b/src/lastfile.c
index 2901f148e17..13022792f25 100644
--- a/src/lastfile.c
+++ b/src/lastfile.c
@@ -49,9 +49,6 @@ char my_edata[] = "End of Emacs initialized data";
49 isn't always a separate section in NT executables). */ 49 isn't always a separate section in NT executables). */
50char my_endbss[1]; 50char my_endbss[1];
51 51
52/* The Alpha MSVC linker globally segregates all static and public bss
53 data, so we must take both into account to determine the true extent
54 of the bss area used by Emacs. */
55static char _my_endbss[1]; 52static char _my_endbss[1];
56char * my_endbss_static = _my_endbss; 53char * my_endbss_static = _my_endbss;
57 54
diff --git a/src/lisp.h b/src/lisp.h
index a71ba22618e..1a8c3a0fe49 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -418,9 +418,8 @@ error !;
418#define case_Lisp_Int case Lisp_Int0: case Lisp_Int1 418#define case_Lisp_Int case Lisp_Int0: case Lisp_Int1
419 419
420/* Idea stolen from GDB. Pedantic GCC complains about enum bitfields, 420/* Idea stolen from GDB. Pedantic GCC complains about enum bitfields,
421 MSVC doesn't support them, and xlc and Oracle Studio c99 complain 421 and xlc and Oracle Studio c99 complain vociferously about them. */
422 vociferously about them. */ 422#if (defined __STRICT_ANSI__ || defined __IBMC__ \
423#if (defined __STRICT_ANSI__ || defined _MSC_VER || defined __IBMC__ \
424 || (defined __SUNPRO_C && __STDC__)) 423 || (defined __SUNPRO_C && __STDC__))
425#define ENUM_BF(TYPE) unsigned int 424#define ENUM_BF(TYPE) unsigned int
426#else 425#else
@@ -2935,23 +2934,12 @@ CHECK_NUMBER_CDR (Lisp_Object x)
2935 2934
2936/* This version of DEFUN declares a function prototype with the right 2935/* This version of DEFUN declares a function prototype with the right
2937 arguments, so we can catch errors with maxargs at compile-time. */ 2936 arguments, so we can catch errors with maxargs at compile-time. */
2938#ifdef _MSC_VER
2939#define DEFUN(lname, fnname, sname, minargs, maxargs, intspec, doc) \
2940 Lisp_Object fnname DEFUN_ARGS_ ## maxargs ; \
2941 static struct Lisp_Subr GCALIGNED sname = \
2942 { { (PVEC_SUBR << PSEUDOVECTOR_AREA_BITS) \
2943 | (sizeof (struct Lisp_Subr) / sizeof (EMACS_INT)) }, \
2944 { (Lisp_Object (__cdecl *)(void))fnname }, \
2945 minargs, maxargs, lname, intspec, 0}; \
2946 Lisp_Object fnname
2947#else /* not _MSC_VER */
2948#define DEFUN(lname, fnname, sname, minargs, maxargs, intspec, doc) \ 2937#define DEFUN(lname, fnname, sname, minargs, maxargs, intspec, doc) \
2949 static struct Lisp_Subr GCALIGNED sname = \ 2938 static struct Lisp_Subr GCALIGNED sname = \
2950 { { PVEC_SUBR << PSEUDOVECTOR_AREA_BITS }, \ 2939 { { PVEC_SUBR << PSEUDOVECTOR_AREA_BITS }, \
2951 { .a ## maxargs = fnname }, \ 2940 { .a ## maxargs = fnname }, \
2952 minargs, maxargs, lname, intspec, 0}; \ 2941 minargs, maxargs, lname, intspec, 0}; \
2953 Lisp_Object fnname 2942 Lisp_Object fnname
2954#endif
2955 2943
2956/* defsubr (Sname); 2944/* defsubr (Sname);
2957 is how we define the symbol for function `name' at start-up time. */ 2945 is how we define the symbol for function `name' at start-up time. */
diff --git a/src/regex.c b/src/regex.c
index 330f2f78a84..d3d910daaa3 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -519,13 +519,7 @@ ptrdiff_t emacs_re_safe_alloca = MAX_ALLOCA;
519#endif 519#endif
520 520
521/* Type of source-pattern and string chars. */ 521/* Type of source-pattern and string chars. */
522#ifdef _MSC_VER
523typedef unsigned char re_char;
524typedef const re_char const_re_char;
525#else
526typedef const unsigned char re_char; 522typedef const unsigned char re_char;
527typedef re_char const_re_char;
528#endif
529 523
530typedef char boolean; 524typedef char boolean;
531 525
@@ -2403,7 +2397,7 @@ do { \
2403 } while (0) 2397 } while (0)
2404 2398
2405static reg_errcode_t 2399static reg_errcode_t
2406regex_compile (const_re_char *pattern, size_t size, 2400regex_compile (re_char *pattern, size_t size,
2407#ifdef emacs 2401#ifdef emacs
2408# define syntax RE_SYNTAX_EMACS 2402# define syntax RE_SYNTAX_EMACS
2409 bool posix_backtracking, 2403 bool posix_backtracking,
@@ -3728,7 +3722,7 @@ insert_op2 (re_opcode_t op, unsigned char *loc, int arg1, int arg2, unsigned cha
3728 least one character before the ^. */ 3722 least one character before the ^. */
3729 3723
3730static boolean 3724static boolean
3731at_begline_loc_p (const_re_char *pattern, const_re_char *p, reg_syntax_t syntax) 3725at_begline_loc_p (re_char *pattern, re_char *p, reg_syntax_t syntax)
3732{ 3726{
3733 re_char *prev = p - 2; 3727 re_char *prev = p - 2;
3734 boolean odd_backslashes; 3728 boolean odd_backslashes;
@@ -3769,7 +3763,7 @@ at_begline_loc_p (const_re_char *pattern, const_re_char *p, reg_syntax_t syntax)
3769 at least one character after the $, i.e., `P < PEND'. */ 3763 at least one character after the $, i.e., `P < PEND'. */
3770 3764
3771static boolean 3765static boolean
3772at_endline_loc_p (const_re_char *p, const_re_char *pend, reg_syntax_t syntax) 3766at_endline_loc_p (re_char *p, re_char *pend, reg_syntax_t syntax)
3773{ 3767{
3774 re_char *next = p; 3768 re_char *next = p;
3775 boolean next_backslash = *next == '\\'; 3769 boolean next_backslash = *next == '\\';
@@ -3813,7 +3807,7 @@ group_in_compile_stack (compile_stack_type compile_stack, regnum_t regnum)
3813 Return -1 if fastmap was not updated accurately. */ 3807 Return -1 if fastmap was not updated accurately. */
3814 3808
3815static int 3809static int
3816analyze_first (const_re_char *p, const_re_char *pend, char *fastmap, 3810analyze_first (re_char *p, re_char *pend, char *fastmap,
3817 const int multibyte) 3811 const int multibyte)
3818{ 3812{
3819 int j, k; 3813 int j, k;
@@ -4555,7 +4549,7 @@ static int bcmp_translate (re_char *s1, re_char *s2,
4555/* If the operation is a match against one or more chars, 4549/* If the operation is a match against one or more chars,
4556 return a pointer to the next operation, else return NULL. */ 4550 return a pointer to the next operation, else return NULL. */
4557static re_char * 4551static re_char *
4558skip_one_char (const_re_char *p) 4552skip_one_char (re_char *p)
4559{ 4553{
4560 switch (*p++) 4554 switch (*p++)
4561 { 4555 {
@@ -4597,7 +4591,7 @@ skip_one_char (const_re_char *p)
4597 4591
4598/* Jump over non-matching operations. */ 4592/* Jump over non-matching operations. */
4599static re_char * 4593static re_char *
4600skip_noops (const_re_char *p, const_re_char *pend) 4594skip_noops (re_char *p, re_char *pend)
4601{ 4595{
4602 int mcnt; 4596 int mcnt;
4603 while (p < pend) 4597 while (p < pend)
@@ -4628,7 +4622,7 @@ skip_noops (const_re_char *p, const_re_char *pend)
4628 character (i.e. without any translations). UNIBYTE denotes whether c is 4622 character (i.e. without any translations). UNIBYTE denotes whether c is
4629 unibyte or multibyte character. */ 4623 unibyte or multibyte character. */
4630static bool 4624static bool
4631execute_charset (const_re_char **pp, unsigned c, unsigned corig, bool unibyte) 4625execute_charset (re_char **pp, unsigned c, unsigned corig, bool unibyte)
4632{ 4626{
4633 re_char *p = *pp, *rtp = NULL; 4627 re_char *p = *pp, *rtp = NULL;
4634 bool not = (re_opcode_t) *p == charset_not; 4628 bool not = (re_opcode_t) *p == charset_not;
@@ -4692,8 +4686,8 @@ execute_charset (const_re_char **pp, unsigned c, unsigned corig, bool unibyte)
4692 4686
4693/* Non-zero if "p1 matches something" implies "p2 fails". */ 4687/* Non-zero if "p1 matches something" implies "p2 fails". */
4694static int 4688static int
4695mutually_exclusive_p (struct re_pattern_buffer *bufp, const_re_char *p1, 4689mutually_exclusive_p (struct re_pattern_buffer *bufp, re_char *p1,
4696 const_re_char *p2) 4690 re_char *p2)
4697{ 4691{
4698 re_opcode_t op2; 4692 re_opcode_t op2;
4699 const boolean multibyte = RE_MULTIBYTE_P (bufp); 4693 const boolean multibyte = RE_MULTIBYTE_P (bufp);
@@ -4931,8 +4925,8 @@ WEAK_ALIAS (__re_match_2, re_match_2)
4931/* This is a separate function so that we can force an alloca cleanup 4925/* This is a separate function so that we can force an alloca cleanup
4932 afterwards. */ 4926 afterwards. */
4933static regoff_t 4927static regoff_t
4934re_match_2_internal (struct re_pattern_buffer *bufp, const_re_char *string1, 4928re_match_2_internal (struct re_pattern_buffer *bufp, re_char *string1,
4935 size_t size1, const_re_char *string2, size_t size2, 4929 size_t size1, re_char *string2, size_t size2,
4936 ssize_t pos, struct re_registers *regs, ssize_t stop) 4930 ssize_t pos, struct re_registers *regs, ssize_t stop)
4937{ 4931{
4938 /* General temporaries. */ 4932 /* General temporaries. */
@@ -6222,10 +6216,10 @@ re_match_2_internal (struct re_pattern_buffer *bufp, const_re_char *string1,
6222 bytes; nonzero otherwise. */ 6216 bytes; nonzero otherwise. */
6223 6217
6224static int 6218static int
6225bcmp_translate (const_re_char *s1, const_re_char *s2, register ssize_t len, 6219bcmp_translate (re_char *s1, re_char *s2, ssize_t len,
6226 RE_TRANSLATE_TYPE translate, const int target_multibyte) 6220 RE_TRANSLATE_TYPE translate, const int target_multibyte)
6227{ 6221{
6228 register re_char *p1 = s1, *p2 = s2; 6222 re_char *p1 = s1, *p2 = s2;
6229 re_char *p1_end = s1 + len; 6223 re_char *p1_end = s1 + len;
6230 re_char *p2_end = s2 + len; 6224 re_char *p2_end = s2 + len;
6231 6225