From a2cfac89b5cf50509e55a48ed0de850cda296b7a Mon Sep 17 00:00:00 2001 From: Zoltan Varga Date: Thu, 4 Mar 2010 01:16:22 +0000 Subject: 2010-03-04 Zoltan Varga * test/test.c: Fix the build. * src/glib.h src/goutput.c: Emit asserts through a g_assertion_message () function which is decorated with G_GNUC_NORETURN, to fix many warnings when using the eglib build. svn path=/trunk/mono/; revision=152983 --- eglib/ChangeLog | 7 +++++++ eglib/src/glib.h | 6 ++++-- eglib/src/goutput.c | 10 ++++++++++ eglib/test/test.c | 2 ++ 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/eglib/ChangeLog b/eglib/ChangeLog index bfe0f46a44f..785b4315605 100644 --- a/eglib/ChangeLog +++ b/eglib/ChangeLog @@ -1,3 +1,10 @@ +2010-03-04 Zoltan Varga + + * test/test.c: Fix the build. + + * src/glib.h src/goutput.c: Emit asserts through a g_assertion_message () + function which is decorated with G_GNUC_NORETURN, to fix many warnings when using + the eglib build. Mon Mar 1 17:12:24 CET 2010 Paolo Molaro diff --git a/eglib/src/glib.h b/eglib/src/glib.h index 5a2fe2484de..75e7dc90818 100644 --- a/eglib/src/glib.h +++ b/eglib/src/glib.h @@ -204,8 +204,8 @@ guint g_int_hash (gconstpointer v1); gboolean g_str_equal (gconstpointer v1, gconstpointer v2); guint g_str_hash (gconstpointer v1); -#define g_assert(x) G_STMT_START { if (!(x)) g_error ("* Assertion at %s:%d, condition `%s' not met\n", __FILE__, __LINE__, #x); } G_STMT_END -#define g_assert_not_reached() G_STMT_START { g_error ("* Assertion: should not be reached at %s:%d\n", __FILE__, __LINE__); } G_STMT_END +#define g_assert(x) G_STMT_START { if (!(x)) g_assertion_message ("* Assertion at %s:%d, condition `%s' not met\n", __FILE__, __LINE__, #x); } G_STMT_END +#define g_assert_not_reached() G_STMT_START { g_assertion_message ("* Assertion: should not be reached at %s:%d\n", __FILE__, __LINE__); } G_STMT_END /* * Errors @@ -511,6 +511,7 @@ GLogLevelFlags g_log_set_always_fatal (GLogLevelFlags fatal_mask); GLogLevelFlags g_log_set_fatal_mask (const gchar *log_domain, GLogLevelFlags fatal_mask); void g_logv (const gchar *log_domain, GLogLevelFlags log_level, const gchar *format, va_list args); void g_log (const gchar *log_domain, GLogLevelFlags log_level, const gchar *format, ...); +void g_assertion_message (const gchar *format, ...) G_GNUC_NORETURN; #ifdef HAVE_C99_SUPPORT #define g_error(format, ...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, format, __VA_ARGS__) @@ -530,6 +531,7 @@ void g_log (const gchar *log_domain, GLogLevelFlags l #define g_printerr(...) fprintf (stderr, __VA_ARGS__) #endif #define g_log_set_handler(a,b,c,d) + /* * Conversions */ diff --git a/eglib/src/goutput.c b/eglib/src/goutput.c index cd2f87f3e51..3a12201735e 100644 --- a/eglib/src/goutput.c +++ b/eglib/src/goutput.c @@ -90,3 +90,13 @@ g_log (const gchar *log_domain, GLogLevelFlags log_level, const gchar *format, . va_end (args); } +void +g_assertion_message (const gchar *format, ...) +{ + va_list args; + + va_start (args, format); + g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, format, args); + va_end (args); +} + diff --git a/eglib/test/test.c b/eglib/test/test.c index dc97450ec56..602c2714132 100644 --- a/eglib/test/test.c +++ b/eglib/test/test.c @@ -26,6 +26,8 @@ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +#define _GNU_SOURCE + #include #include #include -- cgit v1.2.3