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/blenkernel/BKE_idprop.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/blenkernel/BKE_idprop.h')
-rw-r--r--source/blender/blenkernel/BKE_idprop.h171
1 files changed, 28 insertions, 143 deletions
diff --git a/source/blender/blenkernel/BKE_idprop.h b/source/blender/blenkernel/BKE_idprop.h
index 133a0690dc6..71fd163a8ee 100644
--- a/source/blender/blenkernel/BKE_idprop.h
+++ b/source/blender/blenkernel/BKE_idprop.h
@@ -30,6 +30,8 @@
#include "DNA_ID.h"
+#include "BLI_compiler_attrs.h"
+
struct IDProperty;
struct ID;
@@ -55,32 +57,14 @@ typedef union IDPropertyTemplate {
/* ----------- Property Array Type ---------- */
-IDProperty *IDP_NewIDPArray(const char *name)
-#ifdef __GNUC__
-__attribute__((warn_unused_result))
-__attribute__((nonnull))
-#endif
-;
-IDProperty *IDP_CopyIDPArray(IDProperty *array)
-#ifdef __GNUC__
-__attribute__((warn_unused_result))
-__attribute__((nonnull))
-#endif
-;
+IDProperty *IDP_NewIDPArray(const char *name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
+IDProperty *IDP_CopyIDPArray(IDProperty *array) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
void IDP_FreeIDPArray(IDProperty *prop);
/* shallow copies item */
-void IDP_SetIndexArray(struct IDProperty *prop, int index, struct IDProperty *item);
-#ifdef __GNUC__
-__attribute__((nonnull))
-#endif
-struct IDProperty *IDP_GetIndexArray(struct IDProperty *prop, int index)
-#ifdef __GNUC__
-__attribute__((warn_unused_result))
-__attribute__((nonnull))
-#endif
-;
+void IDP_SetIndexArray(struct IDProperty *prop, int index, struct IDProperty *item) ATTR_NONNULL();
+struct IDProperty *IDP_GetIndexArray(struct IDProperty *prop, int index) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
void IDP_AppendArray(struct IDProperty *prop, struct IDProperty *item);
void IDP_ResizeIDPArray(struct IDProperty *prop, int len);
@@ -90,33 +74,11 @@ void IDP_ResizeArray(struct IDProperty *prop, int newlen);
void IDP_FreeArray(struct IDProperty *prop);
/* ---------- String Type ------------ */
-IDProperty *IDP_NewString(const char *st, const char *name, int maxlen) /* maxlen excludes '\0' */
-#ifdef __GNUC__
-__attribute__((warn_unused_result))
-__attribute__((nonnull (2))) /* 'name' arg */
-#endif
-;
-
-void IDP_AssignString(struct IDProperty *prop, const char *st, int maxlen) /* maxlen excludes '\0' */
-#ifdef __GNUC__
-__attribute__((nonnull))
-#endif
-;
-void IDP_ConcatStringC(struct IDProperty *prop, const char *st)
-#ifdef __GNUC__
-__attribute__((nonnull))
-#endif
-;
-void IDP_ConcatString(struct IDProperty *str1, struct IDProperty *append)
-#ifdef __GNUC__
-__attribute__((nonnull))
-#endif
-;
-void IDP_FreeString(struct IDProperty *prop)
-#ifdef __GNUC__
-__attribute__((nonnull))
-#endif
-;
+IDProperty *IDP_NewString(const char *st, const char *name, int maxlen) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(2 /* 'name 'arg */); /* maxlen excludes '\0' */
+void IDP_AssignString(struct IDProperty *prop, const char *st, int maxlen) ATTR_NONNULL(); /* maxlen excludes '\0' */
+void IDP_ConcatStringC(struct IDProperty *prop, const char *st) ATTR_NONNULL();
+void IDP_ConcatString(struct IDProperty *str1, struct IDProperty *append) ATTR_NONNULL();
+void IDP_FreeString(struct IDProperty *prop) ATTR_NONNULL();
/*-------- ID Type -------*/
void IDP_LinkID(struct IDProperty *prop, ID *id);
@@ -125,107 +87,30 @@ void IDP_UnlinkID(struct IDProperty *prop);
/*-------- Group Functions -------*/
/** Sync values from one group to another, only where they match */
-void IDP_SyncGroupValues(struct IDProperty *dest, struct IDProperty *src)
-#ifdef __GNUC__
-__attribute__((nonnull))
-#endif
-;
-
-void IDP_ReplaceGroupInGroup(struct IDProperty *dest, struct IDProperty *src)
-#ifdef __GNUC__
-__attribute__((nonnull))
-#endif
-;
-void IDP_ReplaceInGroup(struct IDProperty *group, struct IDProperty *prop)
-#ifdef __GNUC__
-__attribute__((nonnull))
-#endif
-;
-
-void IDP_MergeGroup(IDProperty *dest, IDProperty *src, const int do_overwrite)
-#ifdef __GNUC__
-__attribute__((nonnull))
-#endif
-;
-
-int IDP_AddToGroup(struct IDProperty *group, struct IDProperty *prop)
-#ifdef __GNUC__
-__attribute__((nonnull))
-#endif
-;
+void IDP_SyncGroupValues(struct IDProperty *dest, struct IDProperty *src) ATTR_NONNULL();
+void IDP_ReplaceGroupInGroup(struct IDProperty *dest, struct IDProperty *src) ATTR_NONNULL();
+void IDP_ReplaceInGroup(struct IDProperty *group, struct IDProperty *prop) ATTR_NONNULL();
+void IDP_MergeGroup(IDProperty *dest, IDProperty *src, const int do_overwrite) ATTR_NONNULL();
+int IDP_AddToGroup(struct IDProperty *group, struct IDProperty *prop) ATTR_NONNULL();
int IDP_InsertToGroup(struct IDProperty *group, struct IDProperty *previous,
- struct IDProperty *pnew)
-#ifdef __GNUC__
-__attribute__((nonnull (1, 3))) /* 'group', 'pnew' */
-#endif
-;
-void IDP_RemFromGroup(struct IDProperty *group, struct IDProperty *prop)
-#ifdef __GNUC__
-__attribute__((nonnull))
-#endif
-;
+ struct IDProperty *pnew) ATTR_NONNULL(1 /* group */, 3 /* pnew */);
+void IDP_RemFromGroup(struct IDProperty *group, struct IDProperty *prop) ATTR_NONNULL();
-IDProperty *IDP_GetPropertyFromGroup(struct IDProperty *prop, const char *name)
-#ifdef __GNUC__
-__attribute__((warn_unused_result))
-__attribute__((nonnull))
-#endif
-;
-IDProperty *IDP_GetPropertyTypeFromGroup(struct IDProperty *prop, const char *name, const char type)
-#ifdef __GNUC__
-__attribute__((warn_unused_result))
-__attribute__((nonnull))
-#endif
-;
-void *IDP_GetGroupIterator(struct IDProperty *prop)
-#ifdef __GNUC__
-__attribute__((warn_unused_result))
-#endif
-;
-IDProperty *IDP_GroupIterNext(void *vself)
-#ifdef __GNUC__
-__attribute__((warn_unused_result))
-__attribute__((nonnull))
-#endif
-;
-void IDP_FreeIterBeforeEnd(void *vself)
-#ifdef __GNUC__
-__attribute__((nonnull))
-#endif
-;
+IDProperty *IDP_GetPropertyFromGroup(struct IDProperty *prop, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
+IDProperty *IDP_GetPropertyTypeFromGroup(struct IDProperty *prop, const char *name, const char type) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
+void *IDP_GetGroupIterator(struct IDProperty *prop) ATTR_WARN_UNUSED_RESULT;
+IDProperty *IDP_GroupIterNext(void *vself) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
+void IDP_FreeIterBeforeEnd(void *vself) ATTR_NONNULL();
/*-------- Main Functions --------*/
-struct IDProperty *IDP_GetProperties(struct ID *id, int create_if_needed)
-#ifdef __GNUC__
-__attribute__((warn_unused_result))
-__attribute__((nonnull))
-#endif
-;
-struct IDProperty *IDP_CopyProperty(struct IDProperty *prop)
-#ifdef __GNUC__
-__attribute__((warn_unused_result))
-__attribute__((nonnull))
-#endif
-;
+struct IDProperty *IDP_GetProperties(struct ID *id, int create_if_needed) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
+struct IDProperty *IDP_CopyProperty(struct IDProperty *prop) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
-int IDP_EqualsProperties_ex(IDProperty *prop1, IDProperty *prop2, const int is_strict)
-#ifdef __GNUC__
-__attribute__((warn_unused_result))
-#endif
-;
+int IDP_EqualsProperties_ex(IDProperty *prop1, IDProperty *prop2, const int is_strict) ATTR_WARN_UNUSED_RESULT;
-int IDP_EqualsProperties(struct IDProperty *prop1, struct IDProperty *prop2)
-#ifdef __GNUC__
-__attribute__((warn_unused_result))
-#endif
-;
+int IDP_EqualsProperties(struct IDProperty *prop1, struct IDProperty *prop2) ATTR_WARN_UNUSED_RESULT;
-struct IDProperty *IDP_New(const int type, const IDPropertyTemplate *val, const char *name)
-#ifdef __GNUC__
-__attribute__((warn_unused_result))
-__attribute__((nonnull))
-#endif
-;
+struct IDProperty *IDP_New(const int type, const IDPropertyTemplate *val, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
void IDP_FreeProperty(struct IDProperty *prop);