[glib: 1/2] macros: Try to use the standard __func__ first in G_STRFUNC



commit 9f75cc9edf1d311ef4bacc3d686c7afa0c4dcbb2
Author: Javier Jardón <javier jardon codethink co uk>
Date:   Mon Jan 13 12:29:10 2014 +0000

    macros: Try to use the standard __func__ first in G_STRFUNC
    
    __func__ is part of the C99 standard.
    __FUNCTION__ is another name for __func__. Older versions of GCC
    recognize only this name. However, it is not standardized.
    For maximum portability, Its recommended to use __func__.
    __PRETTY_FUNCTION__ is yet another name for __func__. However, in C++,
    __PRETTY_FUNCTION__ contains the type signature of the function as
    well as its bare name
    
    http://gcc.gnu.org/onlinedocs/gcc/Function-Names.html
    
    https://gitlab.gnome.org/GNOME/glib/issues/535

 glib/gmacros.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/glib/gmacros.h b/glib/gmacros.h
index 1fe6e760c..b0384ccf0 100644
--- a/glib/gmacros.h
+++ b/glib/gmacros.h
@@ -304,10 +304,10 @@
 #endif
 
 /* Provide a string identifying the current function, non-concatenatable */
-#if defined (__GNUC__) && defined (__cplusplus)
-#define G_STRFUNC     ((const char*) (__PRETTY_FUNCTION__))
-#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+#if defined (__func__)
 #define G_STRFUNC     ((const char*) (__func__))
+#elif defined (__GNUC__) && defined (__cplusplus)
+#define G_STRFUNC     ((const char*) (__PRETTY_FUNCTION__))
 #elif defined (__GNUC__) || (defined(_MSC_VER) && (_MSC_VER > 1300))
 #define G_STRFUNC     ((const char*) (__FUNCTION__))
 #else


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]