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:
authorSergey Sharybin <sergey.vfx@gmail.com>2013-09-01 19:01:15 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2013-09-01 19:01:15 +0400
commit35b61a7512dc1b8b1d8bc562aad2a72d254b8a69 (patch)
tree5050db48823af6cf23eee62b5a013e2f208fdded /source/blender/blenlib/BLI_mempool.h
parent901dea87a1266479d3b7aab6cfd2d5fbf6adc393 (diff)
Move GCC attributes into a centraized defines
Instead of having ifdef __GNUC__ all over the headers to use special compiler's hints use a special file where all things like this are concentrated. Makes code easier to follow and allows to manage special attributes in more efficient way. Thanks Campbell for review!
Diffstat (limited to 'source/blender/blenlib/BLI_mempool.h')
-rw-r--r--source/blender/blenlib/BLI_mempool.h105
1 files changed, 17 insertions, 88 deletions
diff --git a/source/blender/blenlib/BLI_mempool.h b/source/blender/blenlib/BLI_mempool.h
index 153a3735182..88650719712 100644
--- a/source/blender/blenlib/BLI_mempool.h
+++ b/source/blender/blenlib/BLI_mempool.h
@@ -39,6 +39,8 @@ extern "C"
{
#endif
+#include "BLI_compiler_attrs.h"
+
struct BLI_mempool;
struct BLI_mempool_chunk;
@@ -49,85 +51,21 @@ typedef struct BLI_mempool BLI_mempool;
* 'free'. use with care.*/
BLI_mempool *BLI_mempool_create(unsigned int esize, unsigned int totelem,
- unsigned int pchunk, unsigned int flag)
-#ifdef __GNUC__
-__attribute__((malloc))
-__attribute__((warn_unused_result))
-#endif
-;
-void *BLI_mempool_alloc(BLI_mempool *pool)
-#ifdef __GNUC__
-__attribute__((malloc))
-__attribute__((warn_unused_result))
-__attribute__((nonnull(1)))
-#endif
-;
-void *BLI_mempool_calloc(BLI_mempool *pool)
-#ifdef __GNUC__
-__attribute__((malloc))
-__attribute__((warn_unused_result))
-__attribute__((nonnull(1)))
-#endif
-;
-void BLI_mempool_free(BLI_mempool *pool, void *addr)
-#ifdef __GNUC__
-__attribute__((nonnull(1, 2)))
-#endif
-;
+ unsigned int pchunk, unsigned int flag) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT;
+void *BLI_mempool_alloc(BLI_mempool *pool) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1);
+void *BLI_mempool_calloc(BLI_mempool *pool) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1);
+void BLI_mempool_free(BLI_mempool *pool, void *addr) ATTR_NONNULL(1, 2);
void BLI_mempool_clear_ex(BLI_mempool *pool,
- const int totelem_reserve)
-#ifdef __GNUC__
-__attribute__((nonnull(1)))
-#endif
-;
-void BLI_mempool_clear(BLI_mempool *pool)
-#ifdef __GNUC__
-__attribute__((nonnull(1)))
-#endif
-;
-void BLI_mempool_destroy(BLI_mempool *pool)
-#ifdef __GNUC__
-__attribute__((nonnull(1)))
-#endif
-;
-int BLI_mempool_count(BLI_mempool *pool)
-#ifdef __GNUC__
-__attribute__((nonnull(1)))
-#endif
-;
-void *BLI_mempool_findelem(BLI_mempool *pool, unsigned int index)
-#ifdef __GNUC__
-__attribute__((warn_unused_result))
-__attribute__((nonnull(1)))
-#endif
-;
-void BLI_mempool_as_table(BLI_mempool *pool, void **data)
-#ifdef __GNUC__
-__attribute__((nonnull(1, 2)))
-#endif
-;
+ const int totelem_reserve) ATTR_NONNULL(1);
+void BLI_mempool_clear(BLI_mempool *pool) ATTR_NONNULL(1);
+void BLI_mempool_destroy(BLI_mempool *pool) ATTR_NONNULL(1);
+int BLI_mempool_count(BLI_mempool *pool) ATTR_NONNULL(1);
+void *BLI_mempool_findelem(BLI_mempool *pool, unsigned int index) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1);
-void **BLI_mempool_as_tableN(BLI_mempool *pool, const char *allocstr)
-#ifdef __GNUC__
-__attribute__((malloc))
-__attribute__((warn_unused_result))
-__attribute__((nonnull(1, 2)))
-#endif
-;
-
-void BLI_mempool_as_array(BLI_mempool *pool, void *data)
-#ifdef __GNUC__
-__attribute__((nonnull(1, 2)))
-#endif
-;
-
-void *BLI_mempool_as_arrayN(BLI_mempool *pool, const char *allocstr)
-#ifdef __GNUC__
-__attribute__((malloc))
-__attribute__((warn_unused_result))
-__attribute__((nonnull(1, 2)))
-#endif
-;
+void BLI_mempool_as_table(BLI_mempool *pool, void **data) ATTR_NONNULL(1, 2);
+void **BLI_mempool_as_tableN(BLI_mempool *pool, const char *allocstr) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 2);
+void BLI_mempool_as_array(BLI_mempool *pool, void *data) ATTR_NONNULL(1, 2);
+void *BLI_mempool_as_arrayN(BLI_mempool *pool, const char *allocstr) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 2);
/** iteration stuff. note: this may easy to produce bugs with **/
/* private structure */
@@ -143,17 +81,8 @@ enum {
BLI_MEMPOOL_ALLOW_ITER = (1 << 1)
};
-void BLI_mempool_iternew(BLI_mempool *pool, BLI_mempool_iter *iter)
-#ifdef __GNUC__
-__attribute__((nonnull(1, 2)))
-#endif
-;
-void *BLI_mempool_iterstep(BLI_mempool_iter *iter)
-#ifdef __GNUC__
-__attribute__((warn_unused_result))
-__attribute__((nonnull(1)))
-#endif
-;
+void BLI_mempool_iternew(BLI_mempool *pool, BLI_mempool_iter *iter) ATTR_NONNULL();
+void *BLI_mempool_iterstep(BLI_mempool_iter *iter) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
#ifdef __cplusplus
}