mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-27 07:56:14 +01:00
Add g_abort()
The new g_abort() macro just expands to abort() on systems where abort() behaves in a sane way. On other systems (read: Windows) it does its best to emulate a sane abort() behaviour. https://bugzilla.gnome.org/show_bug.cgi?id=665446
This commit is contained in:
parent
e4aaae4ed6
commit
5974428d25
@ -2390,3 +2390,27 @@ g_check_setuid (void)
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* g_abort:
|
||||
*
|
||||
* A wrapper for the POSIX abort() function.
|
||||
*
|
||||
* On Windows it is a function that makes extra effort (including a call
|
||||
* to abort()) to ensure that a debugger-catchable exception is thrown
|
||||
* before the program terminates.
|
||||
*
|
||||
* See your C library manual for more details about abort().
|
||||
*
|
||||
* Since: 2.50
|
||||
*/
|
||||
void
|
||||
g_abort (void)
|
||||
{
|
||||
/* One call to break the debugger */
|
||||
DebugBreak ();
|
||||
/* One call in case CRT does get saner about abort() behaviour */
|
||||
abort ();
|
||||
/* And one call to bind them all and terminate the program for sure */
|
||||
ExitProcess (127);
|
||||
}
|
||||
|
@ -299,6 +299,16 @@ g_bit_storage_impl (gulong number)
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Crashes the program. */
|
||||
#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_50
|
||||
#ifndef G_OS_WIN32
|
||||
# define g_abort() abort ()
|
||||
#else
|
||||
GLIB_AVAILABLE_IN_2_50
|
||||
void g_abort (void) G_GNUC_NORETURN G_ANALYZER_NORETURN;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef G_DISABLE_DEPRECATED
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user