#include "glib.h"
#include "gdebug.h"
#include "gprintfint.h"
-#include "gthreadinit.h"
+#include "gthreadprivate.h"
#include "galias.h"
#ifdef G_OS_WIN32
if (val)
{
- static const GDebugKey keys[] = {
+ const GDebugKey keys[] = {
{ "error", G_LOG_LEVEL_ERROR },
{ "critical", G_LOG_LEVEL_CRITICAL },
{ "warning", G_LOG_LEVEL_WARNING },
MB_ICONERROR|MB_SETFOREGROUND);
if (IsDebuggerPresent () && !(test_level & G_LOG_FLAG_RECURSION))
G_BREAKPOINT ();
-
- abort ();
+ else
+ abort ();
#else
#if defined (G_ENABLE_DEBUG) && defined (SIGTRAP)
if (!(test_level & G_LOG_FLAG_RECURSION))
}
void
+g_warn_message (const char *domain,
+ const char *file,
+ int line,
+ const char *func,
+ const char *warnexpr)
+{
+ char *s, lstr[32];
+ g_snprintf (lstr, 32, "%d", line);
+ if (warnexpr)
+ s = g_strconcat ("(", file, ":", lstr, "):",
+ func, func[0] ? ":" : "",
+ " runtime check failed: (", warnexpr, ")", NULL);
+ else
+ s = g_strconcat ("(", file, ":", lstr, "):",
+ func, func[0] ? ":" : "",
+ " ", "code should not be reached", NULL);
+ g_log (domain, G_LOG_LEVEL_WARNING, "%s", s);
+ g_free (s);
+}
+
+void
g_assert_warning (const char *log_domain,
const char *file,
const int line,
}
void
-_g_messages_thread_init (void)
+_g_messages_thread_init_nomessage (void)
{
g_messages_lock = g_mutex_new ();
+ g_log_depth = g_private_new (NULL);
g_messages_prefixed_init ();
_g_debug_init ();
}
-void
-_g_messages_thread_private_init (void)
-{
- g_assert (g_log_depth == NULL);
- g_log_depth = g_private_new (NULL);
-}
-
gboolean _g_debug_initialized = FALSE;
guint _g_debug_flags = 0;
val = g_getenv ("G_DEBUG");
if (val != NULL)
{
- static const GDebugKey keys[] = {
- {"fatal_warnings", G_DEBUG_FATAL_WARNINGS}
+ const GDebugKey keys[] = {
+ {"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));
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__