babl r408 - in trunk: . babl
- From: martinn svn gnome org
- To: svn-commits-list gnome org
- Subject: babl r408 - in trunk: . babl
- Date: Tue, 31 Mar 2009 17:09:42 +0000 (UTC)
Author: martinn
Date: Tue Mar 31 17:09:42 2009
New Revision: 408
URL: http://svn.gnome.org/viewvc/babl?rev=408&view=rev
Log:
Avoid the need for define __func__ "unknown" on some vendor compilers
Patch from Gary V. Vaughan
Modified:
trunk/ChangeLog
trunk/babl/babl-internal.h
Modified: trunk/babl/babl-internal.h
==============================================================================
--- trunk/babl/babl-internal.h (original)
+++ trunk/babl/babl-internal.h Tue Mar 31 17:09:42 2009
@@ -162,6 +162,17 @@
hack_hack ();
}
+/* Provide a string identifying the current function, non-concatenatable */
+#ifndef G_STRFUNC
+#if defined (__GNUC__)
+# define G_STRFUNC ((const char*) (__PRETTY_FUNCTION__))
+#elif defined (G_HAVE_ISO_VARARGS)
+# define G_STRFUNC ((const char*) (__func__))
+#else
+# define G_STRFUNC ((const char*) ("???"))
+#endif
+#endif
+
#if defined(__cplusplus) && defined(BABL_ISO_CXX_VARIADIC_MACROS)
# define BABL_ISO_VARIADIC_MACROS 1
#endif
@@ -169,20 +180,20 @@
#if defined(BABL_ISO_VARIADIC_MACROS)
#define babl_log(...) \
- real_babl_log(__FILE__, __LINE__, __func__, __VA_ARGS__)
+ real_babl_log(__FILE__, __LINE__, G_STRFUNC, __VA_ARGS__)
#define babl_fatal(...) do{ \
- real_babl_log(__FILE__, __LINE__, __func__, __VA_ARGS__); \
+ real_babl_log(__FILE__, __LINE__, G_STRFUNC, __VA_ARGS__); \
babl_die();} \
while(0)
#elif defined(BABL_GNUC_VARIADIC_MACROS)
#define babl_log(args...) \
- real_babl_log(__FILE__, __LINE__, __func__, args)
+ real_babl_log(__FILE__, __LINE__, G_STRFUNC, args)
#define babl_fatal(args...) do{ \
- real_babl_log(__FILE__, __LINE__, __func__, args); \
+ real_babl_log(__FILE__, __LINE__, G_STRFUNC, args); \
babl_die();} \
while(0)
@@ -193,7 +204,7 @@
{
va_list args;
va_start (args, format);
- real_babl_log (__FILE__, __LINE__, __func__, format, args);
+ real_babl_log (__FILE__, __LINE__, G_STRFUNC, format, args);
va_end (args);
}
static inline void
@@ -201,7 +212,7 @@
{
va_list args;
va_start (args, format);
- real_babl_log (__FILE__, __LINE__, __func__, format, args);
+ real_babl_log (__FILE__, __LINE__, G_STRFUNC, format, args);
va_end (args);
babl_die();
}
@@ -212,7 +223,7 @@
#define babl_assert(expr) do{ \
if(!(expr)) \
{ \
- real_babl_log(__FILE__, __LINE__, __func__, "Eeeeek! Assertion failed: `" #expr "`"); \
+ real_babl_log(__FILE__, __LINE__, G_STRFUNC, "Eeeeek! Assertion failed: `" #expr "`"); \
assert(expr); \
} \
}while(0)
@@ -288,13 +299,13 @@
\
if (babl_hmpf_on_name_lookups) \
{ \
- babl_log ("%s(\"%s\"): hmpf!", __func__, name); \
+ babl_log ("%s(\"%s\"): hmpf!", G_STRFUNC, name); \
} \
babl = babl_db_exist_by_name (db, name); \
\
if (!babl) \
{ \
- babl_fatal ("%s(\"%s\"): not found", __func__, name); \
+ babl_fatal ("%s(\"%s\"): not found", G_STRFUNC, name); \
} \
return babl; \
} \
@@ -306,7 +317,7 @@
babl = babl_db_exist_by_id (db, id); \
if (!babl) \
{ \
- babl_fatal ("%s(%i): not found", __func__, id); \
+ babl_fatal ("%s(%i): not found", G_STRFUNC, id); \
} \
return babl; \
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]