diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2017-11-23 22:34:03 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2017-11-23 22:34:03 +0300 |
commit | c9477888305b647abb89702ab2316ba5f93033b1 (patch) | |
tree | dccbc97b5916cfa5e474d672cb134437b7223b01 /source/blender | |
parent | 4f8bffa7bfe46192b43c75d864e2117369cbffdd (diff) | |
parent | ff9eab7926da46d62cede2d3d061fcfe2531f622 (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenlib/BLI_utildefines.h | 20 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_bevel.c | 3 |
2 files changed, 20 insertions, 3 deletions
diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h index 8f8d7cc3b7f..ee1acc5afdd 100644 --- a/source/blender/blenlib/BLI_utildefines.h +++ b/source/blender/blenlib/BLI_utildefines.h @@ -660,10 +660,26 @@ extern bool BLI_memory_is_zero(const void *arr, const size_t arr_size); (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 406)) /* gcc4.6+ only */ # define BLI_STATIC_ASSERT(a, msg) __extension__ _Static_assert(a, msg); #else - /* TODO msvc, clang */ -# define BLI_STATIC_ASSERT(a, msg) +/* Code adapted from http://www.pixelbeat.org/programming/gcc/static_assert.html */ +/* Note we need the two concats below because arguments to ## are not expanded, so we need to + * expand __LINE__ with one indirection before doing the actual concatenation. */ +# define ASSERT_CONCAT_(a, b) a##b +# define ASSERT_CONCAT(a, b) ASSERT_CONCAT_(a, b) + /* These can't be used after statements in c89. */ +# if defined(__COUNTER__) /* MSVC */ +# define BLI_STATIC_ASSERT(a, msg) \ + ; enum { ASSERT_CONCAT(static_assert_, __COUNTER__) = 1 / (int)(!!(a)) }; +# else /* older gcc, clang... */ + /* This can't be used twice on the same line so ensure if using in headers + * that the headers are not included twice (by wrapping in #ifndef...#endif) + * Note it doesn't cause an issue when used on same line of separate modules + * compiled with gcc -combine -fwhole-program. */ +# define BLI_STATIC_ASSERT(a, msg) \ + ; enum { ASSERT_CONCAT(assert_line_, __LINE__) = 1 / (int)(!!(a)) }; +# endif #endif + #define BLI_STATIC_ASSERT_ALIGN(st, align) \ BLI_STATIC_ASSERT((sizeof(st) % (align) == 0), "Structure must be strictly aligned") diff --git a/source/blender/editors/mesh/editmesh_bevel.c b/source/blender/editors/mesh/editmesh_bevel.c index 2af05a9ad8d..e541df8ffa3 100644 --- a/source/blender/editors/mesh/editmesh_bevel.c +++ b/source/blender/editors/mesh/editmesh_bevel.c @@ -335,11 +335,12 @@ static int edbm_bevel_invoke(bContext *C, wmOperator *op, const wmEvent *event) * ideally this will never happen and should be checked for above */ opdata->mcenter[0] = opdata->mcenter[1] = 0; } - edbm_bevel_calc_initial_length(op, event, false); /* for OFFSET_VALUE only, the scale is the size of a pixel under the mouse in 3d space */ opdata->scale[OFFSET_VALUE] = rv3d ? ED_view3d_pixel_size(rv3d, center_3d) : 1.0f; + edbm_bevel_calc_initial_length(op, event, false); + edbm_bevel_update_header(C, op); if (!edbm_bevel_calc(op)) { |