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
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')
-rw-r--r--source/blender/blenkernel/BKE_DerivedMesh.h8
-rw-r--r--source/blender/blenkernel/BKE_idprop.h171
-rw-r--r--source/blender/blenkernel/BKE_lamp.h8
-rw-r--r--source/blender/blenkernel/BKE_library.h30
-rw-r--r--source/blender/blenkernel/BKE_modifier.h7
-rw-r--r--source/blender/blenkernel/BKE_report.h13
6 files changed, 47 insertions, 190 deletions
diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h
index 8396380fd06..ebfc3f473d5 100644
--- a/source/blender/blenkernel/BKE_DerivedMesh.h
+++ b/source/blender/blenkernel/BKE_DerivedMesh.h
@@ -72,6 +72,8 @@
#include "DNA_customdata_types.h"
#include "DNA_meshdata_types.h"
+#include "BLI_compiler_attrs.h"
+
#include "BKE_customdata.h"
#include "BKE_bvhutils.h"
@@ -735,11 +737,7 @@ void DM_debug_print(DerivedMesh *dm);
void DM_debug_print_cdlayers(CustomData *cdata);
#endif
-#ifdef __GNUC__
-BLI_INLINE int DM_origindex_mface_mpoly(const int *index_mf_to_mpoly, const int *index_mp_to_orig, const int i)
- __attribute__((nonnull(1)))
-;
-#endif
+BLI_INLINE int DM_origindex_mface_mpoly(const int *index_mf_to_mpoly, const int *index_mp_to_orig, const int i) ATTR_NONNULL(1);
BLI_INLINE int DM_origindex_mface_mpoly(const int *index_mf_to_mpoly, const int *index_mp_to_orig, const int i)
{
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);
diff --git a/source/blender/blenkernel/BKE_lamp.h b/source/blender/blenkernel/BKE_lamp.h
index 205c7c7d1e6..fb2c4da91ea 100644
--- a/source/blender/blenkernel/BKE_lamp.h
+++ b/source/blender/blenkernel/BKE_lamp.h
@@ -36,13 +36,15 @@
extern "C" {
#endif
+#include "BLI_compiler_attrs.h"
+
struct Lamp;
struct Main;
struct Scene;
-struct Lamp *BKE_lamp_add(struct Main *bmain, const char *name) WARN_UNUSED;
-struct Lamp *BKE_lamp_copy(struct Lamp *la) WARN_UNUSED;
-struct Lamp *localize_lamp(struct Lamp *la) WARN_UNUSED;
+struct Lamp *BKE_lamp_add(struct Main *bmain, const char *name) ATTR_WARN_UNUSED_RESULT;
+struct Lamp *BKE_lamp_copy(struct Lamp *la) ATTR_WARN_UNUSED_RESULT;
+struct Lamp *localize_lamp(struct Lamp *la) ATTR_WARN_UNUSED_RESULT;
void BKE_lamp_make_local(struct Lamp *la);
void BKE_lamp_free(struct Lamp *la);
diff --git a/source/blender/blenkernel/BKE_library.h b/source/blender/blenkernel/BKE_library.h
index 3c5406c4a77..b8da5002d84 100644
--- a/source/blender/blenkernel/BKE_library.h
+++ b/source/blender/blenkernel/BKE_library.h
@@ -36,6 +36,8 @@
extern "C" {
#endif
+#include "BLI_compiler_attrs.h"
+
struct ListBase;
struct ID;
struct Main;
@@ -45,24 +47,9 @@ struct bContext;
struct PointerRNA;
struct PropertyRNA;
-void *BKE_libblock_alloc(struct ListBase *lb, short type, const char *name)
-#ifdef __GNUC__
-__attribute__((warn_unused_result))
-__attribute__((nonnull))
-#endif
-;
-void *BKE_libblock_copy_ex(struct Main *bmain, struct ID *id)
-#ifdef __GNUC__
-__attribute__((warn_unused_result))
-__attribute__((nonnull))
-#endif
-;
-void *BKE_libblock_copy(struct ID *id)
-#ifdef __GNUC__
-__attribute__((warn_unused_result))
-__attribute__((nonnull))
-#endif
-;
+void *BKE_libblock_alloc(struct ListBase *lb, short type, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
+void *BKE_libblock_copy_ex(struct Main *bmain, struct ID *id) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
+void *BKE_libblock_copy(struct ID *id) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
void BKE_libblock_copy_data(struct ID *id, const struct ID *id_from, const bool do_action);
void BKE_id_lib_local_paths(struct Main *bmain, struct Library *lib, struct ID *id);
@@ -99,12 +86,7 @@ void rename_id(struct ID *id, const char *name);
void name_uiprefix_id(char *name, const struct ID *id);
void test_idbutton(char *name);
void BKE_library_make_local(struct Main *bmain, struct Library *lib, bool untagged_only);
-struct ID *BKE_libblock_find_name(const short type, const char *name)
-#ifdef __GNUC__
-__attribute__((warn_unused_result))
-__attribute__((nonnull))
-#endif
-;
+struct ID *BKE_libblock_find_name(const short type, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
void clear_id_newpoins(void);
#if 0
diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h
index 8f0d612d473..f42e131394b 100644
--- a/source/blender/blenkernel/BKE_modifier.h
+++ b/source/blender/blenkernel/BKE_modifier.h
@@ -29,6 +29,7 @@
*/
#include "DNA_modifier_types.h" /* needed for all enum typdefs */
+#include "BLI_compiler_attrs.h"
#include "BKE_customdata.h"
struct ID;
@@ -325,11 +326,7 @@ bool modifier_isCorrectableDeformed(struct ModifierData *md);
bool modifier_isSameTopology(ModifierData *md);
bool modifier_isNonGeometrical(ModifierData *md);
bool modifier_isEnabled(struct Scene *scene, struct ModifierData *md, int required_mode);
-void modifier_setError(struct ModifierData *md, const char *format, ...)
-#ifdef __GNUC__
-__attribute__ ((format(printf, 2, 3)))
-#endif
-;
+void modifier_setError(struct ModifierData *md, const char *format, ...) ATTR_PRINTF_FORMAT(2, 3);
bool modifier_isPreview(struct ModifierData *md);
void modifiers_foreachObjectLink(struct Object *ob,
diff --git a/source/blender/blenkernel/BKE_report.h b/source/blender/blenkernel/BKE_report.h
index ae457cf4f47..101fc463375 100644
--- a/source/blender/blenkernel/BKE_report.h
+++ b/source/blender/blenkernel/BKE_report.h
@@ -34,6 +34,7 @@ extern "C" {
#include <stdio.h>
#include "DNA_windowmanager_types.h"
+#include "BLI_compiler_attrs.h"
#include "BLI_utildefines.h"
/* Reporting Information and Errors
@@ -47,18 +48,10 @@ void BKE_reports_init(ReportList *reports, int flag);
void BKE_reports_clear(ReportList *reports);
void BKE_report(ReportList *reports, ReportType type, const char *message);
-void BKE_reportf(ReportList *reports, ReportType type, const char *format, ...)
-#ifdef __GNUC__
-__attribute__ ((format(printf, 3, 4)))
-#endif
-;
+void BKE_reportf(ReportList *reports, ReportType type, const char *format, ...) ATTR_PRINTF_FORMAT(3, 4);
void BKE_reports_prepend(ReportList *reports, const char *prepend);
-void BKE_reports_prependf(ReportList *reports, const char *prepend, ...)
-#ifdef __GNUC__
-__attribute__ ((format(printf, 2, 3)))
-#endif
-;
+void BKE_reports_prependf(ReportList *reports, const char *prepend, ...) ATTR_PRINTF_FORMAT(2, 3);
ReportType BKE_report_print_level(ReportList *reports);
void BKE_report_print_level_set(ReportList *reports, ReportType level);