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@blender.org>2022-08-02 12:10:40 +0300
committerSergey Sharybin <sergey@blender.org>2022-08-02 12:50:54 +0300
commitbb7747e7caee59a8c98cd7d9abc9cd1e9b0e0762 (patch)
tree5407ca9a13780393df50538fc43867890b855e78 /source/blender/makesdna
parent1c90ab7bf252ba008e0f61f37886ab58c75f5c7b (diff)
Fix undefined behavior in dependency graph tagging
The tagging code was iterating over bits set in the ID_RECALC_ALL and was casting the flag to IDRecalcFlag. This was triggering an undefined behavior warning in Clang since the bit might not have a corresponding value in the enumerator. The solution is to pre-define all reacalc flags for all bits. While this seems a bit annoying this seems to be the least fragile solution from all suggested ones. Differential Revision: https://developer.blender.org/D15602
Diffstat (limited to 'source/blender/makesdna')
-rw-r--r--source/blender/makesdna/DNA_ID.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h
index 8b99345e237..7ba2b426fcf 100644
--- a/source/blender/makesdna/DNA_ID.h
+++ b/source/blender/makesdna/DNA_ID.h
@@ -870,6 +870,17 @@ typedef enum IDRecalcFlag : unsigned int {
/* The node tree has changed in a way that affects its output nodes. */
ID_RECALC_NTREE_OUTPUT = (1 << 25),
+ /* Provisioned flags.
+ *
+ * Not for actual use. The idea of them is to have all bits of the `IDRecalcFlag` defined to a
+ * known value, silencing sanitizer warnings when checkign bits of the ID_RECALC_ALL. */
+ ID_RECALC_PROVISION_26 = (1 << 26),
+ ID_RECALC_PROVISION_27 = (1 << 27),
+ ID_RECALC_PROVISION_28 = (1 << 28),
+ ID_RECALC_PROVISION_29 = (1 << 29),
+ ID_RECALC_PROVISION_30 = (1 << 30),
+ ID_RECALC_PROVISION_31 = (1u << 31),
+
/***************************************************************************
* Pseudonyms, to have more semantic meaning in the actual code without
* using too much low-level and implementation specific tags. */