[glib] Make G_STRFUNC consistent across platforms
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] Make G_STRFUNC consistent across platforms
- Date: Sun, 30 Jun 2013 03:26:28 +0000 (UTC)
commit b7b38384010be4385ba9a1872dc3eb7a0134cbe0
Author: Dan Winship <danw gnome org>
Date: Fri Jun 14 11:19:31 2013 -0300
Make G_STRFUNC consistent across platforms
Recent versions of clang have changed __PRETTY_FUNCTION__ to always
include the function signature (rather than including the function
signature in C++ but not in C like gcc does). This causes G_STRFUNC to
give different results under clang and gcc, causing some tests with
g_test_expect_messages() to fail.
Fix this by only using __PRETTY_FUNCTION__ in C++, and using
__FUNCTION__ in C. (Under gcc this change has no effect.)
https://bugzilla.gnome.org/show_bug.cgi?id=702147
glib/gmacros.h | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/glib/gmacros.h b/glib/gmacros.h
index 6149067..9526cbd 100644
--- a/glib/gmacros.h
+++ b/glib/gmacros.h
@@ -174,11 +174,11 @@
#endif
/* Provide a string identifying the current function, non-concatenatable */
-#if defined (__GNUC__)
+#if defined (__GNUC__) && defined (__cplusplus)
# define G_STRFUNC ((const char*) (__PRETTY_FUNCTION__))
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 19901L
# define G_STRFUNC ((const char*) (__func__))
-#elif defined(_MSC_VER) && (_MSC_VER > 1300)
+#elif defined (__GNUC__) || (defined(_MSC_VER) && (_MSC_VER > 1300))
# define G_STRFUNC ((const char*) (__FUNCTION__))
#else
# define G_STRFUNC ((const char*) ("???"))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]