diff options
author | Bastien Montagne <bastien@blender.org> | 2020-07-13 13:48:56 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2020-07-13 13:51:29 +0300 |
commit | 976a0ff691040fee4633910b9ab6f898d406405a (patch) | |
tree | cfceef1257f898141936516aa43960c197581857 /source/blender/makesrna/intern/rna_internal.h | |
parent | f8afbb76571fa816a1d869240bdca595b97da846 (diff) |
RNA code cleanup: Fix wrong usages of `rna_idproperty_check()`.
This function is more expansive than the simpler `rna_ensure_property()`
one, and should only be used when IDProperty data is actually needed.
If one only needs to ensure it has a valid PropertyRNA pointer,
`rna_ensure_property()` is much more efficient.
Also add compiler warnings when results of those functions are unused,
this should never be the case.
Diffstat (limited to 'source/blender/makesrna/intern/rna_internal.h')
-rw-r--r-- | source/blender/makesrna/intern/rna_internal.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h index 8e6a360f2c9..a8085c00cb3 100644 --- a/source/blender/makesrna/intern/rna_internal.h +++ b/source/blender/makesrna/intern/rna_internal.h @@ -23,6 +23,8 @@ #include "BLI_utildefines.h" +#include "BLI_compiler_attrs.h" + #include "rna_internal_types.h" #include "UI_resources.h" @@ -478,9 +480,11 @@ extern StructRNA RNA_PropertyGroupItem; extern StructRNA RNA_PropertyGroup; #endif -struct IDProperty *rna_idproperty_check(struct PropertyRNA **prop, struct PointerRNA *ptr); +struct IDProperty *rna_idproperty_check(struct PropertyRNA **prop, + struct PointerRNA *ptr) ATTR_WARN_UNUSED_RESULT; struct PropertyRNA *rna_ensure_property_realdata(struct PropertyRNA **prop, - struct PointerRNA *ptr); + struct PointerRNA *ptr) ATTR_WARN_UNUSED_RESULT; +struct PropertyRNA *rna_ensure_property(struct PropertyRNA *prop) ATTR_WARN_UNUSED_RESULT; /* Override default callbacks. */ /* Default override callbacks for all types. */ |