[Bf-blender-cvs] [4c512fb] master: Compile Attrs: add ATTR_RETURNS_NONNULL

Campbell Barton noreply at git.blender.org
Mon Feb 17 13:32:53 CET 2014


Commit: 4c512fb6427e7fda766ed179df2d3429cdae5117
Author: Campbell Barton
Date:   Mon Feb 17 23:29:57 2014 +1100
https://developer.blender.org/rB4c512fb6427e7fda766ed179df2d3429cdae5117

Compile Attrs: add ATTR_RETURNS_NONNULL

===================================================================

M	source/blender/blenlib/BLI_compiler_attrs.h

===================================================================

diff --git a/source/blender/blenlib/BLI_compiler_attrs.h b/source/blender/blenlib/BLI_compiler_attrs.h
index fc16e7d..0a93ae2 100644
--- a/source/blender/blenlib/BLI_compiler_attrs.h
+++ b/source/blender/blenlib/BLI_compiler_attrs.h
@@ -50,6 +50,13 @@
 #  define ATTR_NONNULL(...)
 #endif
 
+/* never returns NULL */
+#  if (__GNUC__ * 100 + __GNUC_MINOR__) >= 409  /* gcc4.9+ only */
+#  define ATTR_RETURNS_NONNULL __attribute__((returns_nonnull))
+#else
+#  define ATTR_RETURNS_NONNULL
+#endif
+
 /* hint to mark function as it wouldn't return */
 #if defined(__GNUC__) || defined(__clang__)
 #  define ATTR_NORETURN __attribute__((noreturn))




More information about the Bf-blender-cvs mailing list