From fdf2e0eb86d4ee07af98ea5c54c25c8d1ddd0d87 Mon Sep 17 00:00:00 2001 From: Ryan Lortie Date: Thu, 7 Feb 2008 07:13:39 +0000 Subject: [PATCH] add for(;;); after the g_log call so that GCC stops issuing false warnings 2008-02-07 Ryan Lortie * glib/gmessages.h (g_error): add for(;;); after the g_log call so that GCC stops issuing false warnings about reachability Bug #514920 svn path=/trunk/; revision=6476 --- ChangeLog | 5 +++++ glib/gmessages.h | 19 +++++++++++++++---- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9ec3cc7..499915d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-02-07 Ryan Lortie + + * glib/gmessages.h (g_error): add for(;;); after the g_log call so + that GCC stops issuing false warnings about reachability Bug #514920 + 2008-02-06 Matthias Clasen * glib/pcre/*: Update the internal copy of PCRE to 7.6 diff --git a/glib/gmessages.h b/glib/gmessages.h index 5535833..eb2ca8f 100644 --- a/glib/gmessages.h +++ b/glib/gmessages.h @@ -130,9 +130,14 @@ void g_assert_warning (const char *log_domain, #define G_LOG_DOMAIN ((gchar*) 0) #endif /* G_LOG_DOMAIN */ #ifdef G_HAVE_ISO_VARARGS -#define g_error(...) g_log (G_LOG_DOMAIN, \ +/* for(;;); so that GCC knows that control doesn't go past g_error() */ +#define g_error(...) G_STMT_START { \ + g_log (G_LOG_DOMAIN, \ G_LOG_LEVEL_ERROR, \ - __VA_ARGS__) + __VA_ARGS__); \ + for (;;); \ + } G_STMT_END + #define g_message(...) g_log (G_LOG_DOMAIN, \ G_LOG_LEVEL_MESSAGE, \ __VA_ARGS__) @@ -146,9 +151,13 @@ void g_assert_warning (const char *log_domain, G_LOG_LEVEL_DEBUG, \ __VA_ARGS__) #elif defined(G_HAVE_GNUC_VARARGS) -#define g_error(format...) g_log (G_LOG_DOMAIN, \ +#define g_error(format...) G_STMT_START { \ + g_log (G_LOG_DOMAIN, \ G_LOG_LEVEL_ERROR, \ - format) + format); \ + for (;;); \ + } G_STMT_END + #define g_message(format...) g_log (G_LOG_DOMAIN, \ G_LOG_LEVEL_MESSAGE, \ format) @@ -170,6 +179,8 @@ g_error (const gchar *format, va_start (args, format); g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, format, args); va_end (args); + + for(;;); } static void g_message (const gchar *format, -- 2.7.4