util: Replace all usage of __FUNCTION__ with __func__ in src/util/*
authorYonggang Luo <luoyonggang@gmail.com>
Thu, 10 Nov 2022 08:31:11 +0000 (16:31 +0800)
committerMarge Bot <emma+marge@anholt.net>
Fri, 11 Nov 2022 06:15:42 +0000 (06:15 +0000)
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19646>

src/util/os_memory_debug.h
src/util/u_debug.c
src/util/u_debug.h
src/util/u_debug_memory.c

index 343043c..08b922b 100644 (file)
@@ -81,13 +81,13 @@ debug_memory_check(void);
 #ifndef DEBUG_MEMORY_IMPLEMENTATION
 
 #define os_malloc( _size ) \
-   debug_malloc( __FILE__, __LINE__, __FUNCTION__, _size )
+   debug_malloc( __FILE__, __LINE__, __func__, _size )
 #define os_calloc( _count, _size ) \
-   debug_calloc(__FILE__, __LINE__, __FUNCTION__, _count, _size )
+   debug_calloc(__FILE__, __LINE__, __func__, _count, _size )
 #define os_free( _ptr ) \
-   debug_free( __FILE__, __LINE__, __FUNCTION__,  _ptr )
+   debug_free( __FILE__, __LINE__, __func__,  _ptr )
 #define os_realloc( _ptr, _old_size, _new_size ) \
-   debug_realloc( __FILE__, __LINE__, __FUNCTION__,  _ptr, _old_size, _new_size )
+   debug_realloc( __FILE__, __LINE__, __func__,  _ptr, _old_size, _new_size )
 
 /* TODO: wrap os_malloc_aligned() and os_free_aligned() too */
 #include "os_memory_aligned.h"
index a89aaa6..e873f20 100644 (file)
@@ -159,7 +159,7 @@ debug_get_option(const char *name, const char *dfault)
       result = dfault;
 
    if (debug_get_option_should_print())
-      debug_printf("%s: %s = %s\n", __FUNCTION__, name,
+      debug_printf("%s: %s = %s\n", __func__, name,
                    result ? result : "(null)");
 
    return result;
@@ -177,7 +177,7 @@ debug_get_bool_option(const char *name, bool dfault)
 {
    bool result = debug_get_bool_option_direct(name, dfault);
    if (debug_get_option_should_print())
-      debug_printf("%s: %s = %s\n", __FUNCTION__, name,
+      debug_printf("%s: %s = %s\n", __func__, name,
                    result ? "TRUE" : "FALSE");
 
    return result;
@@ -204,7 +204,7 @@ debug_get_num_option(const char *name, long dfault)
    }
 
    if (debug_get_option_should_print())
-      debug_printf("%s: %s = %li\n", __FUNCTION__, name, result);
+      debug_printf("%s: %s = %li\n", __func__, name, result);
 
    return result;
 }
@@ -229,7 +229,7 @@ debug_get_version_option(const char *name, unsigned *major, unsigned *minor)
    }
 
    if (debug_get_option_should_print())
-      debug_printf("%s: %s = %u.%u\n", __FUNCTION__, name, *major, *minor);
+      debug_printf("%s: %s = %u.%u\n", __func__, name, *major, *minor);
 
    return;
 }
@@ -294,7 +294,7 @@ debug_get_flags_option(const char *name,
       result = dfault;
    else if (!strcmp(str, "help")) {
       result = dfault;
-      _debug_printf("%s: help for %s:\n", __FUNCTION__, name);
+      _debug_printf("%s: help for %s:\n", __func__, name);
       for (; flags->name; ++flags)
          namealign = MAX2(namealign, strlen(flags->name));
       for (flags = orig; flags->name; ++flags)
@@ -314,9 +314,9 @@ debug_get_flags_option(const char *name,
    if (debug_get_option_should_print()) {
       if (str) {
          debug_printf("%s: %s = 0x%"PRIx64" (%s)\n",
-                      __FUNCTION__, name, result, str);
+                      __func__, name, result, str);
       } else {
-         debug_printf("%s: %s = 0x%"PRIx64"\n", __FUNCTION__, name, result);
+         debug_printf("%s: %s = 0x%"PRIx64"\n", __func__, name, result);
       }
    }
 
index a2afd86..a3858fd 100644 (file)
@@ -199,7 +199,7 @@ debug_get_version_option(const char *name, unsigned *major, unsigned *minor);
  */
 #ifdef DEBUG
 #define debug_checkpoint() \
-   _debug_printf("%s\n", __FUNCTION__)
+   _debug_printf("%s\n", __func__)
 #else
 #define debug_checkpoint() \
    ((void)0)
@@ -211,7 +211,7 @@ debug_get_version_option(const char *name, unsigned *major, unsigned *minor);
  */
 #ifdef DEBUG
 #define debug_checkpoint_full() \
-   _debug_printf("%s:%u:%s\n", __FILE__, __LINE__, __FUNCTION__)
+   _debug_printf("%s:%u:%s\n", __FILE__, __LINE__, __func__)
 #else
 #define debug_checkpoint_full() \
    ((void)0)
@@ -223,7 +223,7 @@ debug_get_version_option(const char *name, unsigned *major, unsigned *minor);
  */
 #ifdef DEBUG
 #define debug_warning(__msg) \
-   _debug_printf("%s:%u:%s: warning: %s\n", __FILE__, __LINE__, __FUNCTION__, __msg)
+   _debug_printf("%s:%u:%s: warning: %s\n", __FILE__, __LINE__, __func__, __msg)
 #else
 #define debug_warning(__msg) \
    ((void)0)
@@ -239,7 +239,7 @@ debug_get_version_option(const char *name, unsigned *major, unsigned *minor);
       static bool warned = false; \
       if (!warned) { \
          _debug_printf("%s:%u:%s: one time warning: %s\n", \
-                       __FILE__, __LINE__, __FUNCTION__, __msg); \
+                       __FILE__, __LINE__, __func__, __msg); \
          warned = true; \
       } \
    } while (0)
@@ -254,7 +254,7 @@ debug_get_version_option(const char *name, unsigned *major, unsigned *minor);
  */
 #ifdef DEBUG
 #define debug_error(__msg) \
-   _debug_printf("%s:%u:%s: error: %s\n", __FILE__, __LINE__, __FUNCTION__, __msg)
+   _debug_printf("%s:%u:%s: error: %s\n", __FILE__, __LINE__, __func__, __msg)
 #else
 #define debug_error(__msg) \
    _debug_printf("error: %s\n", __msg)
index 9fe9f08..92a0c48 100644 (file)
@@ -365,7 +365,7 @@ debug_memory_tag(void *ptr, unsigned tag)
 
    hdr = header_from_data(ptr);
    if (hdr->magic != DEBUG_MEMORY_MAGIC) {
-      debug_printf("%s corrupted memory at %p\n", __FUNCTION__, ptr);
+      debug_printf("%s corrupted memory at %p\n", __func__, ptr);
       assert(0);
    }