Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2021-09-06 11:57:25 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-09-06 11:58:46 +0300
commit49f1695ed06792ea1f4d1a43d30170c407f227f8 (patch)
treef022e9269ce206957903a73113c6891c9c40d997 /source/blender/blenlib
parent81978594a89a2e53c3d6626f51dfa85e94d6811d (diff)
BLI_utildefines: add UNUSED_FUNCTION_WITH_RETURN_TYPE
Unfortunately the UNUSED_FUNCTION macro doesn't work for pointer types. Add UNUSED_FUNCTION_WITH_RETURN_TYPE to workaround this limitation.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/BLI_utildefines.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h
index 5b84e050f82..dec8acd7549 100644
--- a/source/blender/blenlib/BLI_utildefines.h
+++ b/source/blender/blenlib/BLI_utildefines.h
@@ -683,12 +683,22 @@ extern bool BLI_memory_is_zero(const void *arr, const size_t arr_size);
# define UNUSED(x) UNUSED_##x
#endif
+/**
+ * WARNING: this doesn't warn when returning pointer types (because of the placement of `*`).
+ * Use #UNUSED_FUNCTION_WITH_RETURN_TYPE instead in this case.
+ */
#if defined(__GNUC__) || defined(__clang__)
# define UNUSED_FUNCTION(x) __attribute__((__unused__)) UNUSED_##x
#else
# define UNUSED_FUNCTION(x) UNUSED_##x
#endif
+#if defined(__GNUC__) || defined(__clang__)
+# define UNUSED_FUNCTION_WITH_RETURN_TYPE(rtype, x) __attribute__((__unused__)) rtype UNUSED_##x
+#else
+# define UNUSED_FUNCTION_WITH_RETURN_TYPE(rtype, x) rtype UNUSED_##x
+#endif
+
/**
* UNUSED_VARS#(a, ...): quiet unused warnings
*