add new GDebugFlag for fatal_criticals handle G_DEBUG=fatal_criticals, to

2005-11-04  Matthias Clasen  <mclasen@redhat.com>

        * 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)
This commit is contained in:
Matthias Clasen
2005-11-04 19:07:38 +00:00
committed by Matthias Clasen
parent 8cf4ab38f1
commit ae33c0ab86
7 changed files with 48 additions and 3 deletions

View File

@@ -1,3 +1,10 @@
2005-11-04 Matthias Clasen <mclasen@redhat.com>
* 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-10-29 Matthias Clasen <mclasen@redhat.com> 2005-10-29 Matthias Clasen <mclasen@redhat.com>
* tests/convert-test.c: Add some tests for conversions between * tests/convert-test.c: Add some tests for conversions between

View File

@@ -1,3 +1,10 @@
2005-11-04 Matthias Clasen <mclasen@redhat.com>
* 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-10-29 Matthias Clasen <mclasen@redhat.com> 2005-10-29 Matthias Clasen <mclasen@redhat.com>
* tests/convert-test.c: Add some tests for conversions between * tests/convert-test.c: Add some tests for conversions between

View File

@@ -1,3 +1,10 @@
2005-11-04 Matthias Clasen <mclasen@redhat.com>
* 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-10-29 Matthias Clasen <mclasen@redhat.com> 2005-10-29 Matthias Clasen <mclasen@redhat.com>
* tests/convert-test.c: Add some tests for conversions between * tests/convert-test.c: Add some tests for conversions between

View File

@@ -1,3 +1,7 @@
2005-11-04 Matthias Clasen <mclasen@redhat.com>
* glib/running.sgml: Document fatal_criticals.
2005-10-03 Matthias Clasen <mclasen@redhat.com> 2005-10-03 Matthias Clasen <mclasen@redhat.com>
* === Released 2.8.3 === * === Released 2.8.3 ===

View File

@@ -65,7 +65,16 @@ variables like <envar>LANG</envar>, <envar>PATH</envar> or <envar>HOME</envar>.
<varlistentry> <varlistentry>
<term>fatal_warnings</term> <term>fatal_warnings</term>
<listitem><para>Causes GLib to abort the program at the first call <listitem><para>Causes GLib to abort the program at the first call
to <link linkend="g-warning">g_warning</link>(). This option is to <link linkend="g-warning">g_warning</link>() or
<link linkend="g-critical">g_critical</link>(). This option is
special in that it doesn't require GLib to be configured with
debugging support.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>fatal_criticals</term>
<listitem><para>Causes GLib to abort the program at the first call
to <link linkend="g-critical">g_critical</link>(). This option is
special in that it doesn't require GLib to be configured with special in that it doesn't require GLib to be configured with
debugging support.</para> debugging support.</para>
</listitem> </listitem>

View File

@@ -30,7 +30,8 @@
G_BEGIN_DECLS G_BEGIN_DECLS
typedef enum { typedef enum {
G_DEBUG_FATAL_WARNINGS = 1 << 0 G_DEBUG_FATAL_WARNINGS = 1 << 0,
G_DEBUG_FATAL_CRITICALS = 1 << 1
} GDebugFlag; } GDebugFlag;

View File

@@ -1069,7 +1069,8 @@ _g_debug_init (void)
if (val != NULL) if (val != NULL)
{ {
static const GDebugKey keys[] = { 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)); _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; fatal_mask |= G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL;
g_log_set_always_fatal (fatal_mask); 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__ #define __G_MESSAGES_C__