aboutsummaryrefslogtreecommitdiffstats
path: root/src/w32.c
diff options
context:
space:
mode:
authorPaul Eggert2012-09-04 10:34:54 -0700
committerPaul Eggert2012-09-04 10:34:54 -0700
commit1088b9226e7dac7314dab52ef0696a5f540900cd (patch)
treebfae7d26f4b411f5c6a0ef33cfcd0c526619ee56 /src/w32.c
parent30934d334e8a67c8992d910428758d5b93e0f04f (diff)
downloademacs-1088b9226e7dac7314dab52ef0696a5f540900cd.tar.gz
emacs-1088b9226e7dac7314dab52ef0696a5f540900cd.zip
Simplify redefinition of 'abort' (Bug#12316).
Do not try to redefine the 'abort' function. Instead, redo the code so that it calls 'emacs_abort' rather than 'abort'. This removes the need for the NO_ABORT configure-time macro and makes it easier to change the abort code to do a backtrace. * configure.ac (NO_ABRT): Remove. * admin/CPP-DEFINES (NO_ABORT): Remove. * nt/inc/ms-w32.h (w32_abort) [HAVE_NTGUI]: Remove. * src/.gdbinit: Just stop at emacs_abort, not at w32_abort or abort. * src/emacs.c (abort) [!DOS_NT && !NO_ABORT]: Remove; sysdep.c's emacs_abort now takes its place. * src/lisp.h (emacs_abort): New decl. All calls from Emacs code to 'abort' changed to use 'emacs_abort'. * src/msdos.c (dos_abort) [defined abort]: Remove; not used. (abort) [!defined abort]: Rename to ... (emacs_abort): ... new name. * src/sysdep.c (emacs_abort) [!HAVE_NTGUI]: New function, taking the place of the old 'abort' in emacs.c. * src/w32.c, src/w32fns.c (abort): Do not #undef. * src/w32.c (emacs_abort): Rename from w32_abort.
Diffstat (limited to 'src/w32.c')
-rw-r--r--src/w32.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/src/w32.c b/src/w32.c
index fe612687f48..4505afc18b3 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -1273,9 +1273,9 @@ init_user_info (void)
1273 1273
1274 /* Ensure HOME and SHELL are defined. */ 1274 /* Ensure HOME and SHELL are defined. */
1275 if (getenv ("HOME") == NULL) 1275 if (getenv ("HOME") == NULL)
1276 abort (); 1276 emacs_abort ();
1277 if (getenv ("SHELL") == NULL) 1277 if (getenv ("SHELL") == NULL)
1278 abort (); 1278 emacs_abort ();
1279 1279
1280 /* Set dir and shell from environment variables. */ 1280 /* Set dir and shell from environment variables. */
1281 strcpy (dflt_passwd.pw_dir, getenv ("HOME")); 1281 strcpy (dflt_passwd.pw_dir, getenv ("HOME"));
@@ -1788,9 +1788,9 @@ init_environment (char ** argv)
1788 char modname[MAX_PATH]; 1788 char modname[MAX_PATH];
1789 1789
1790 if (!GetModuleFileName (NULL, modname, MAX_PATH)) 1790 if (!GetModuleFileName (NULL, modname, MAX_PATH))
1791 abort (); 1791 emacs_abort ();
1792 if ((p = strrchr (modname, '\\')) == NULL) 1792 if ((p = strrchr (modname, '\\')) == NULL)
1793 abort (); 1793 emacs_abort ();
1794 *p = 0; 1794 *p = 0;
1795 1795
1796 if ((p = strrchr (modname, '\\')) && xstrcasecmp (p, "\\bin") == 0) 1796 if ((p = strrchr (modname, '\\')) && xstrcasecmp (p, "\\bin") == 0)
@@ -1902,13 +1902,13 @@ init_environment (char ** argv)
1902 /* FIXME: Do we need to resolve possible symlinks in startup_dir? 1902 /* FIXME: Do we need to resolve possible symlinks in startup_dir?
1903 Does it matter anywhere in Emacs? */ 1903 Does it matter anywhere in Emacs? */
1904 if (!GetCurrentDirectory (MAXPATHLEN, startup_dir)) 1904 if (!GetCurrentDirectory (MAXPATHLEN, startup_dir))
1905 abort (); 1905 emacs_abort ();
1906 1906
1907 { 1907 {
1908 static char modname[MAX_PATH]; 1908 static char modname[MAX_PATH];
1909 1909
1910 if (!GetModuleFileName (NULL, modname, MAX_PATH)) 1910 if (!GetModuleFileName (NULL, modname, MAX_PATH))
1911 abort (); 1911 emacs_abort ();
1912 argv[0] = modname; 1912 argv[0] = modname;
1913 } 1913 }
1914 1914
@@ -1930,7 +1930,7 @@ emacs_root_dir (void)
1930 1930
1931 p = getenv ("emacs_dir"); 1931 p = getenv ("emacs_dir");
1932 if (p == NULL) 1932 if (p == NULL)
1933 abort (); 1933 emacs_abort ();
1934 strcpy (root_dir, p); 1934 strcpy (root_dir, p);
1935 root_dir[parse_root (root_dir, NULL)] = '\0'; 1935 root_dir[parse_root (root_dir, NULL)] = '\0';
1936 dostounix_filename (root_dir); 1936 dostounix_filename (root_dir);
@@ -3287,7 +3287,7 @@ generate_inode_val (const char * name)
3287 doesn't resolve aliasing due to subst commands, or recognize hard 3287 doesn't resolve aliasing due to subst commands, or recognize hard
3288 links. */ 3288 links. */
3289 if (!w32_get_long_filename ((char *)name, fullname, MAX_PATH)) 3289 if (!w32_get_long_filename ((char *)name, fullname, MAX_PATH))
3290 abort (); 3290 emacs_abort ();
3291 3291
3292 parse_root (fullname, &p); 3292 parse_root (fullname, &p);
3293 /* Normal W32 filesystems are still case insensitive. */ 3293 /* Normal W32 filesystems are still case insensitive. */
@@ -5587,7 +5587,7 @@ socket_to_fd (SOCKET s)
5587 if (fd_info[ fd ].cp != NULL) 5587 if (fd_info[ fd ].cp != NULL)
5588 { 5588 {
5589 DebPrint (("sys_socket: fd_info[%d] apparently in use!\n", fd)); 5589 DebPrint (("sys_socket: fd_info[%d] apparently in use!\n", fd));
5590 abort (); 5590 emacs_abort ();
5591 } 5591 }
5592 5592
5593 fd_info[ fd ].cp = cp; 5593 fd_info[ fd ].cp = cp;
@@ -5966,7 +5966,7 @@ sys_close (int fd)
5966 { 5966 {
5967 if (fd_info[fd].flags & FILE_SOCKET) 5967 if (fd_info[fd].flags & FILE_SOCKET)
5968 { 5968 {
5969 if (winsock_lib == NULL) abort (); 5969 if (winsock_lib == NULL) emacs_abort ();
5970 5970
5971 pfn_shutdown (SOCK_HANDLE (fd), 2); 5971 pfn_shutdown (SOCK_HANDLE (fd), 2);
5972 rc = pfn_closesocket (SOCK_HANDLE (fd)); 5972 rc = pfn_closesocket (SOCK_HANDLE (fd));
@@ -6084,7 +6084,7 @@ _sys_read_ahead (int fd)
6084 || (fd_info[fd].flags & FILE_READ) == 0) 6084 || (fd_info[fd].flags & FILE_READ) == 0)
6085 { 6085 {
6086 DebPrint (("_sys_read_ahead: internal error: fd %d is not a pipe, serial port, or socket!\n", fd)); 6086 DebPrint (("_sys_read_ahead: internal error: fd %d is not a pipe, serial port, or socket!\n", fd));
6087 abort (); 6087 emacs_abort ();
6088 } 6088 }
6089 6089
6090 cp->status = STATUS_READ_IN_PROGRESS; 6090 cp->status = STATUS_READ_IN_PROGRESS;
@@ -6220,7 +6220,7 @@ sys_read (int fd, char * buffer, unsigned int count)
6220 /* re-read CR carried over from last read */ 6220 /* re-read CR carried over from last read */
6221 if (fd_info[fd].flags & FILE_LAST_CR) 6221 if (fd_info[fd].flags & FILE_LAST_CR)
6222 { 6222 {
6223 if (fd_info[fd].flags & FILE_BINARY) abort (); 6223 if (fd_info[fd].flags & FILE_BINARY) emacs_abort ();
6224 *buffer++ = 0x0d; 6224 *buffer++ = 0x0d;
6225 count--; 6225 count--;
6226 nchars++; 6226 nchars++;
@@ -6323,7 +6323,7 @@ sys_read (int fd, char * buffer, unsigned int count)
6323 } 6323 }
6324 else /* FILE_SOCKET */ 6324 else /* FILE_SOCKET */
6325 { 6325 {
6326 if (winsock_lib == NULL) abort (); 6326 if (winsock_lib == NULL) emacs_abort ();
6327 6327
6328 /* do the equivalent of a non-blocking read */ 6328 /* do the equivalent of a non-blocking read */
6329 pfn_ioctlsocket (SOCK_HANDLE (fd), FIONREAD, &waiting); 6329 pfn_ioctlsocket (SOCK_HANDLE (fd), FIONREAD, &waiting);
@@ -6474,7 +6474,7 @@ sys_write (int fd, const void * buffer, unsigned int count)
6474 else if (fd < MAXDESC && fd_info[fd].flags & FILE_SOCKET) 6474 else if (fd < MAXDESC && fd_info[fd].flags & FILE_SOCKET)
6475 { 6475 {
6476 unsigned long nblock = 0; 6476 unsigned long nblock = 0;
6477 if (winsock_lib == NULL) abort (); 6477 if (winsock_lib == NULL) emacs_abort ();
6478 6478
6479 /* TODO: implement select() properly so non-blocking I/O works. */ 6479 /* TODO: implement select() properly so non-blocking I/O works. */
6480 /* For now, make sure the write blocks. */ 6480 /* For now, make sure the write blocks. */
@@ -6640,8 +6640,7 @@ check_windows_init_file (void)
6640 buffer, 6640 buffer,
6641 "Emacs Abort Dialog", 6641 "Emacs Abort Dialog",
6642 MB_OK | MB_ICONEXCLAMATION | MB_TASKMODAL); 6642 MB_OK | MB_ICONEXCLAMATION | MB_TASKMODAL);
6643 /* Use the low-level Emacs abort. */ 6643 /* Use the low-level system abort. */
6644#undef abort
6645 abort (); 6644 abort ();
6646 } 6645 }
6647 else 6646 else