From: Matthias Clasen Date: Fri, 4 Nov 2005 19:05:30 +0000 (+0000) Subject: add new GDebugFlag for fatal_criticals handle G_DEBUG=fatal_criticals, to X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=8b14175a3e7202874c877889cddeab42fbe71d66;p=dana%2Fcg-glib.git add new GDebugFlag for fatal_criticals handle G_DEBUG=fatal_criticals, to 2005-11-04 Matthias Clasen * glib/gdebug.h: add new GDebugFlag for fatal_criticals * glib/gmessages.c: (_g_debug_init): handle G_DEBUG=fatal_criticals, to help find critical warnings in applications. (#320017, Vincent Untz) --- diff --git a/ChangeLog b/ChangeLog index 53fb72cd..000c1ad1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-11-04 Matthias Clasen + + * glib/gdebug.h: add new GDebugFlag for fatal_criticals + * glib/gmessages.c: (_g_debug_init): handle G_DEBUG=fatal_criticals, + to help find critical warnings in applications. (#320017, + Vincent Untz) + 2005-11-02 Tor Lillqvist * glib/glib.symbols: Remove large amount of trailing whitespace diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 53fb72cd..000c1ad1 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,10 @@ +2005-11-04 Matthias Clasen + + * glib/gdebug.h: add new GDebugFlag for fatal_criticals + * glib/gmessages.c: (_g_debug_init): handle G_DEBUG=fatal_criticals, + to help find critical warnings in applications. (#320017, + Vincent Untz) + 2005-11-02 Tor Lillqvist * glib/glib.symbols: Remove large amount of trailing whitespace diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index 53fb72cd..000c1ad1 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,10 @@ +2005-11-04 Matthias Clasen + + * glib/gdebug.h: add new GDebugFlag for fatal_criticals + * glib/gmessages.c: (_g_debug_init): handle G_DEBUG=fatal_criticals, + to help find critical warnings in applications. (#320017, + Vincent Untz) + 2005-11-02 Tor Lillqvist * glib/glib.symbols: Remove large amount of trailing whitespace diff --git a/docs/reference/ChangeLog b/docs/reference/ChangeLog index 6a489f62..d4e5cf4a 100644 --- a/docs/reference/ChangeLog +++ b/docs/reference/ChangeLog @@ -1,3 +1,7 @@ +2005-11-04 Matthias Clasen + + * glib/running.sgml: Document fatal_criticals. + 2005-10-26 Matthias Clasen * gobject/gobject-sections.txt: diff --git a/docs/reference/glib/running.sgml b/docs/reference/glib/running.sgml index 8cd4d58e..f17d68c8 100644 --- a/docs/reference/glib/running.sgml +++ b/docs/reference/glib/running.sgml @@ -65,7 +65,16 @@ variables like LANG, PATH or HOME. fatal_warnings Causes GLib to abort the program at the first call - to g_warning(). This option is + to g_warning() or + g_critical(). This option is + special in that it doesn't require GLib to be configured with + debugging support. + + + + fatal_criticals + Causes GLib to abort the program at the first call + to g_critical(). This option is special in that it doesn't require GLib to be configured with debugging support. diff --git a/glib/gdebug.h b/glib/gdebug.h index 67a8af8e..8e172b72 100644 --- a/glib/gdebug.h +++ b/glib/gdebug.h @@ -30,7 +30,8 @@ G_BEGIN_DECLS typedef enum { - G_DEBUG_FATAL_WARNINGS = 1 << 0 + G_DEBUG_FATAL_WARNINGS = 1 << 0, + G_DEBUG_FATAL_CRITICALS = 1 << 1 } GDebugFlag; diff --git a/glib/gmessages.c b/glib/gmessages.c index 8f63b3e5..38298bfd 100644 --- a/glib/gmessages.c +++ b/glib/gmessages.c @@ -1069,7 +1069,8 @@ _g_debug_init (void) if (val != NULL) { static const GDebugKey keys[] = { - {"fatal_warnings", G_DEBUG_FATAL_WARNINGS} + {"fatal_warnings", G_DEBUG_FATAL_WARNINGS}, + {"fatal_criticals", G_DEBUG_FATAL_CRITICALS} }; _g_debug_flags = g_parse_debug_string (val, keys, G_N_ELEMENTS (keys)); @@ -1083,6 +1084,15 @@ _g_debug_init (void) fatal_mask |= G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL; g_log_set_always_fatal (fatal_mask); } + + if (_g_debug_flags & G_DEBUG_FATAL_CRITICALS) + { + GLogLevelFlags fatal_mask; + + fatal_mask = g_log_set_always_fatal (G_LOG_FATAL_MASK); + fatal_mask |= G_LOG_LEVEL_CRITICAL; + g_log_set_always_fatal (fatal_mask); + } } #define __G_MESSAGES_C__