# define DebugBreak() _exit(-1) /* there is no abort() in WinCE */
# endif
# ifdef SMALL_CONFIG
-# if (defined(MSWIN32) && !defined(LINT2)) || defined(MSWINCE)
-# define ABORT(msg) DebugBreak()
-# else
-# define ABORT(msg) abort()
-# endif
+# define GC_on_abort(msg) (void)0 /* be silent on abort */
# else
- GC_API_PRIV void GC_abort(const char * msg);
-# define ABORT(msg) GC_abort(msg)
-# endif
-# endif
+ GC_API_PRIV void GC_on_abort(const char * msg);
+# endif /* !SMALL_CONFIG */
+# if defined(MSWIN32) && (defined(NO_DEBUGGING) || defined(LINT2))
+ /* A more user-friendly abort after showing fatal message. */
+# define ABORT(msg) (GC_on_abort(msg), _exit(-1))
+ /* Exit on error without running "at-exit" callbacks. */
+# elif defined(MSWINCE) && defined(NO_DEBUGGING)
+# define ABORT(msg) (GC_on_abort(msg), ExitProcess(-1))
+# elif defined(MSWIN32) || defined(MSWINCE)
+# define ABORT(msg) (GC_on_abort(msg), DebugBreak())
+ /* Note that on a WinCE box, this could be silently */
+ /* ignored (i.e., the program is not aborted). */
+# else
+# define ABORT(msg) (GC_on_abort(msg), abort())
+# endif /* !MSWIN32 */
+# endif /* !PCR */
/* Same as ABORT but does not have 'no-return' attribute. */
/* ABORT on dummy condition (which is always true). */
}
#if !defined(PCR) && !defined(SMALL_CONFIG)
- /* Abort the program with a message. msg must not be NULL. */
- void GC_abort(const char *msg)
+ /* Print (or display) a message before abort. msg must not be NULL. */
+ void GC_on_abort(const char *msg)
{
# if defined(MSWIN32)
# ifndef DONT_USE_USER32_DLL
# endif
/* Also duplicate msg to GC log file. */
# endif
- /* Avoid calling GC_err_printf() here, as GC_abort() could be */
+ /* Avoid calling GC_err_printf() here, as GC_on_abort() could be */
/* called from it. Note 1: this is not an atomic output. */
/* Note 2: possible write errors are ignored. */
if (WRITE(GC_stderr, (void *)msg, strlen(msg)) >= 0)
/* It's arguably nicer to sleep, but that makes it harder */
/* to look at the thread if the debugger doesn't know much */
/* about threads. */
- for(;;) {}
+ for(;;) {
+ /* Empty */
+ }
}
-# ifndef LINT2
- if (!msg) return; /* to suppress compiler warnings in ABORT callers. */
-# endif
-# if defined(MSWIN32) && (defined(NO_DEBUGGING) || defined(LINT2))
- /* A more user-friendly abort after showing fatal message. */
- _exit(-1); /* exit on error without running "at-exit" callbacks */
-# elif defined(MSWINCE) && defined(NO_DEBUGGING)
- ExitProcess(-1);
-# elif defined(MSWIN32) || defined(MSWINCE)
- DebugBreak();
- /* Note that on a WinCE box, this could be silently */
- /* ignored (i.e., the program is not aborted). */
-# else
- (void) abort();
-# endif
}
#endif /* !SMALL_CONFIG */