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_memarena.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_memarena.h')
-rw-r--r--source/blender/blenlib/BLI_memarena.h50
1 files changed, 8 insertions, 42 deletions
diff --git a/source/blender/blenlib/BLI_memarena.h b/source/blender/blenlib/BLI_memarena.h
index fbcacf515b5..f8df8b0d63d 100644
--- a/source/blender/blenlib/BLI_memarena.h
+++ b/source/blender/blenlib/BLI_memarena.h
@@ -41,57 +41,23 @@
extern "C" {
#endif
+#include "BLI_compiler_attrs.h"
+
/* A reasonable standard buffer size, big
* enough to not cause much internal fragmentation,
* small enough not to waste resources
*/
#define BLI_MEMARENA_STD_BUFSIZE (1 << 14)
-/* some GNU attributes are only available from GCC 4.3 */
-#define MEM_GNU_ATTRIBUTES (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 403))
-
struct MemArena;
typedef struct MemArena MemArena;
-struct MemArena *BLI_memarena_new(const int bufsize, const char *name)
-#if MEM_GNU_ATTRIBUTES
-__attribute__((malloc))
-__attribute__((warn_unused_result))
-__attribute__((nonnull(2)))
-#endif
-;
-
-void BLI_memarena_free(struct MemArena *ma)
-#if MEM_GNU_ATTRIBUTES
-__attribute__((nonnull(1)))
-#endif
-;
-
-void BLI_memarena_use_malloc(struct MemArena *ma)
-#if MEM_GNU_ATTRIBUTES
-__attribute__((nonnull(1)))
-#endif
-;
-void BLI_memarena_use_calloc(struct MemArena *ma)
-#if MEM_GNU_ATTRIBUTES
-__attribute__((nonnull(1)))
-#endif
-;
-
-void BLI_memarena_use_align(struct MemArena *ma, const int align)
-#if MEM_GNU_ATTRIBUTES
-__attribute__((nonnull(1)))
-#endif
-;
-
-void *BLI_memarena_alloc(struct MemArena *ma, int size)
-#if MEM_GNU_ATTRIBUTES
-__attribute__((malloc))
-__attribute__((warn_unused_result))
-__attribute__((nonnull(1)))
-__attribute__((alloc_size(2)))
-#endif
-;
+struct MemArena *BLI_memarena_new(const int bufsize, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(2) ATTR_MALLOC;
+void BLI_memarena_free(struct MemArena *ma) ATTR_NONNULL(1);
+void BLI_memarena_use_malloc(struct MemArena *ma) ATTR_NONNULL(1);
+void BLI_memarena_use_calloc(struct MemArena *ma) ATTR_NONNULL(1);
+void BLI_memarena_use_align(struct MemArena *ma, const int align) ATTR_NONNULL(1);
+void *BLI_memarena_alloc(struct MemArena *ma, int size) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC ATTR_ALLOC_SIZE(2);
void BLI_memarena_clear(MemArena *ma)
#if MEM_GNU_ATTRIBUTES