]> git.rm.cloudns.org Git - xonotic/gmqcc.git/commitdiff
Add GMQCC_FUNCTION
authorWolfgang Bumiller <wry.git@bumiller.com>
Sat, 11 Feb 2017 10:57:48 +0000 (11:57 +0100)
committerWolfgang Bumiller <wry.git@bumiller.com>
Sat, 11 Feb 2017 10:57:49 +0000 (11:57 +0100)
Fixes #160

exec.c
gmqcc.h

diff --git a/exec.c b/exec.c
index 43d1980ed1a12895b516a2c29cbf776def1ff710..d1bef7ec67dc9320f4652823a16a0a9e8cb151e9 100644 (file)
--- a/exec.c
+++ b/exec.c
@@ -621,7 +621,7 @@ static qcvm_parameter *main_params = NULL;
     if (prog->argc != (num)) {                                                 \
         prog->vmerror++;                                                       \
         fprintf(stderr, "ERROR: invalid number of arguments for %s: %i, expected %i\n", \
-        __FUNCTION__, prog->argc, (num));                                      \
+        GMQCC_FUNCTION, prog->argc, (num));                                    \
         return -1;                                                             \
     }                                                                          \
 } while (0)
diff --git a/gmqcc.h b/gmqcc.h
index bc65ec05f505e210d23ca6de1329d1cd38ddfab1..c853623d8d4185ad892b7096c997fef0a2a32f25 100644 (file)
--- a/gmqcc.h
+++ b/gmqcc.h
@@ -103,6 +103,7 @@ GMQCC_IND_STRING(GMQCC_VERSION_PATCH) \
 #if defined(__GNUC__) || defined(__CLANG__)
 #   define GMQCC_WARN __attribute__((warn_unused_result))
 #   define GMQCC_USED __attribute__((used))
+#   define GMQCC_FUNCTION __func__
 #else
 #   define GMQCC_WARN
 #   define GMQCC_USED
@@ -134,10 +135,15 @@ GMQCC_IND_STRING(GMQCC_VERSION_PATCH) \
  */
 #elif defined(_MSC_VER)
 #    define GMQCC_INLINE __forceinline
+#    define GMQCC_FUNCTION __FUNCTION__
 #else
 #    define GMQCC_INLINE
 #endif /*! __STDC_VERSION__ */
 
+#ifndef GMQCC_FUNCTION
+#    define GMQCC_FUNCTION "<unknown-function>"
+#endif
+
 /*
  * noreturn is present in GCC and clang
  * it's required for _ast_node_destory otherwise -Wmissing-noreturn