gmessages.h: Use G_STRFUNC instead of __func__

We have G_STRFUNC which takes care of __func__, which may not be available
depending on compiler, so we ought to make use of it.

https://bugzilla.gnome.org/show_bug.cgi?id=744456
This commit is contained in:
Chun-wei Fan 2016-07-27 16:37:09 +08:00
parent 48317b199b
commit 7cf037ec16

View File

@ -242,7 +242,7 @@ GLogWriterOutput g_log_writer_default (GLogLevelFlags log_level,
g_log_structured (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, \ g_log_structured (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, \
"CODE_FILE", __FILE__, \ "CODE_FILE", __FILE__, \
"CODE_LINE", G_STRINGIFY (__LINE__), \ "CODE_LINE", G_STRINGIFY (__LINE__), \
"CODE_FUNC", __func__, \ "CODE_FUNC", G_STRFUNC, \
"MESSAGE", "%" G_GINT64_FORMAT ": %s", \ "MESSAGE", "%" G_GINT64_FORMAT ": %s", \
g_get_monotonic_time (), G_STRLOC) g_get_monotonic_time (), G_STRLOC)
@ -281,34 +281,34 @@ void g_assert_warning (const char *log_domain,
g_log_structured (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, \ g_log_structured (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, \
"CODE_FILE", __FILE__, \ "CODE_FILE", __FILE__, \
"CODE_LINE", G_STRINGIFY (__LINE__), \ "CODE_LINE", G_STRINGIFY (__LINE__), \
"CODE_FUNC", __func__, \ "CODE_FUNC", G_STRFUNC, \
"MESSAGE", __VA_ARGS__); \ "MESSAGE", __VA_ARGS__); \
for (;;) ; \ for (;;) ; \
} G_STMT_END } G_STMT_END
#define g_message(...) g_log_structured (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, \ #define g_message(...) g_log_structured (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, \
"CODE_FILE", __FILE__, \ "CODE_FILE", __FILE__, \
"CODE_LINE", G_STRINGIFY (__LINE__), \ "CODE_LINE", G_STRINGIFY (__LINE__), \
"CODE_FUNC", __func__, \ "CODE_FUNC", G_STRFUNC, \
"MESSAGE", __VA_ARGS__) "MESSAGE", __VA_ARGS__)
#define g_critical(...) g_log_structured (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, \ #define g_critical(...) g_log_structured (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, \
"CODE_FILE", __FILE__, \ "CODE_FILE", __FILE__, \
"CODE_LINE", G_STRINGIFY (__LINE__), \ "CODE_LINE", G_STRINGIFY (__LINE__), \
"CODE_FUNC", __func__, \ "CODE_FUNC", G_STRFUNC, \
"MESSAGE", __VA_ARGS__) "MESSAGE", __VA_ARGS__)
#define g_warning(...) g_log_structured (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, \ #define g_warning(...) g_log_structured (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, \
"CODE_FILE", __FILE__, \ "CODE_FILE", __FILE__, \
"CODE_LINE", G_STRINGIFY (__LINE__), \ "CODE_LINE", G_STRINGIFY (__LINE__), \
"CODE_FUNC", __func__, \ "CODE_FUNC", G_STRFUNC, \
"MESSAGE", __VA_ARGS__) "MESSAGE", __VA_ARGS__)
#define g_info(...) g_log_structured (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, \ #define g_info(...) g_log_structured (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, \
"CODE_FILE", __FILE__, \ "CODE_FILE", __FILE__, \
"CODE_LINE", G_STRINGIFY (__LINE__), \ "CODE_LINE", G_STRINGIFY (__LINE__), \
"CODE_FUNC", __func__, \ "CODE_FUNC", G_STRFUNC, \
"MESSAGE", __VA_ARGS__) "MESSAGE", __VA_ARGS__)
#define g_debug(...) g_log_structured (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, \ #define g_debug(...) g_log_structured (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, \
"CODE_FILE", __FILE__, \ "CODE_FILE", __FILE__, \
"CODE_LINE", G_STRINGIFY (__LINE__), \ "CODE_LINE", G_STRINGIFY (__LINE__), \
"CODE_FUNC", __func__, \ "CODE_FUNC", G_STRFUNC, \
"MESSAGE", __VA_ARGS__) "MESSAGE", __VA_ARGS__)
#else #else
/* for(;;) ; so that GCC knows that control doesn't go past g_error(). /* for(;;) ; so that GCC knows that control doesn't go past g_error().
@ -342,34 +342,34 @@ void g_assert_warning (const char *log_domain,
g_log_structured (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, \ g_log_structured (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, \
"CODE_FILE", __FILE__, \ "CODE_FILE", __FILE__, \
"CODE_LINE", G_STRINGIFY (__LINE__), \ "CODE_LINE", G_STRINGIFY (__LINE__), \
"CODE_FUNC", __func__, \ "CODE_FUNC", G_STRFUNC, \
"MESSAGE", format); \ "MESSAGE", format); \
for (;;) ; \ for (;;) ; \
} G_STMT_END } G_STMT_END
#define g_message(format...) g_log_structured (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, \ #define g_message(format...) g_log_structured (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, \
"CODE_FILE", __FILE__, \ "CODE_FILE", __FILE__, \
"CODE_LINE", G_STRINGIFY (__LINE__), \ "CODE_LINE", G_STRINGIFY (__LINE__), \
"CODE_FUNC", __func__, \ "CODE_FUNC", G_STRFUNC, \
"MESSAGE", format) "MESSAGE", format)
#define g_critical(format...) g_log_structured (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, \ #define g_critical(format...) g_log_structured (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, \
"CODE_FILE", __FILE__, \ "CODE_FILE", __FILE__, \
"CODE_LINE", G_STRINGIFY (__LINE__), \ "CODE_LINE", G_STRINGIFY (__LINE__), \
"CODE_FUNC", __func__, \ "CODE_FUNC", G_STRFUNC, \
"MESSAGE", format) "MESSAGE", format)
#define g_warning(format...) g_log_structured (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, \ #define g_warning(format...) g_log_structured (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, \
"CODE_FILE", __FILE__, \ "CODE_FILE", __FILE__, \
"CODE_LINE", G_STRINGIFY (__LINE__), \ "CODE_LINE", G_STRINGIFY (__LINE__), \
"CODE_FUNC", __func__, \ "CODE_FUNC", G_STRFUNC, \
"MESSAGE", format) "MESSAGE", format)
#define g_info(format...) g_log_structured (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, \ #define g_info(format...) g_log_structured (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, \
"CODE_FILE", __FILE__, \ "CODE_FILE", __FILE__, \
"CODE_LINE", G_STRINGIFY (__LINE__), \ "CODE_LINE", G_STRINGIFY (__LINE__), \
"CODE_FUNC", __func__, \ "CODE_FUNC", G_STRFUNC, \
"MESSAGE", format) "MESSAGE", format)
#define g_debug(format...) g_log_structured (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, \ #define g_debug(format...) g_log_structured (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, \
"CODE_FILE", __FILE__, \ "CODE_FILE", __FILE__, \
"CODE_LINE", G_STRINGIFY (__LINE__), \ "CODE_LINE", G_STRINGIFY (__LINE__), \
"CODE_FUNC", __func__, \ "CODE_FUNC", G_STRFUNC, \
"MESSAGE", format) "MESSAGE", format)
#else #else
#define g_error(format...) G_STMT_START { \ #define g_error(format...) G_STMT_START { \