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:
authorLukas Tönne <lukas.toenne@gmail.com>2018-01-03 16:10:42 +0300
committerLukas Tönne <lukas.toenne@gmail.com>2018-01-03 16:15:33 +0300
commit8a72c3baefbae22949dee16c004f253197e93914 (patch)
tree998ed39c6a6c34603919cb4c5e3f15c5ed2c0f87 /source/blender/blenkernel/intern/context.c
parentf20bb6c63f40a3944ceaf976d5c8aa6613477132 (diff)
Static assert for correct strings from context mode enum.
Adding new context modes requires adding a string in CTX_data_mode_string, but there is no error when omitting this other than panels using incorrect contexts. The static assert should help detect simple missing strings at least to avoid confusing errors.
Diffstat (limited to 'source/blender/blenkernel/intern/context.c')
-rw-r--r--source/blender/blenkernel/intern/context.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c
index ea46d000344..7d4cbd16331 100644
--- a/source/blender/blenkernel/intern/context.c
+++ b/source/blender/blenkernel/intern/context.c
@@ -1059,6 +1059,7 @@ static const char *data_mode_strings[] = {
"objectmode",
NULL
};
+BLI_STATIC_ASSERT(ARRAY_SIZE(data_mode_strings) == CTX_MODE_NUM + 1, "Must have a string for each context mode")
const char *CTX_data_mode_string(const bContext *C)
{
return data_mode_strings[CTX_data_mode_enum(C)];