Cleanup: use parenthesis for if statements in macros

This commit is contained in:
Campbell Barton 2020-09-19 16:01:32 +10:00
parent 17a2820da8
commit 14b2a35c8b
28 changed files with 210 additions and 108 deletions

View File

@ -482,8 +482,10 @@ PassType BlenderSync::get_pass_type(BL::RenderPass &b_pass)
{
string name = b_pass.name();
#define MAP_PASS(passname, passtype) \
if (name == passname) \
return passtype;
if (name == passname) { \
return passtype; \
} \
((void)0)
/* NOTE: Keep in sync with defined names from DNA_scene_types.h */
MAP_PASS("Combined", PASS_COMBINED);
MAP_PASS("Depth", PASS_DEPTH);
@ -546,8 +548,10 @@ int BlenderSync::get_denoising_pass(BL::RenderPass &b_pass)
name = name.substr(10);
#define MAP_PASS(passname, offset) \
if (name == passname) \
return offset;
if (name == passname) { \
return offset; \
} \
((void)0)
MAP_PASS("Normal", DENOISING_PASS_PREFILTERED_NORMAL);
MAP_PASS("Albedo", DENOISING_PASS_PREFILTERED_ALBEDO);
MAP_PASS("Depth", DENOISING_PASS_PREFILTERED_DEPTH);
@ -586,8 +590,10 @@ vector<Pass> BlenderSync::sync_render_passes(BL::RenderLayer &b_rlay,
if (denoising.use || denoising.store_passes) {
if (denoising.type == DENOISER_NLM) {
#define MAP_OPTION(name, flag) \
if (!get_boolean(crl, name)) \
scene->film->denoising_flags |= flag;
if (!get_boolean(crl, name)) { \
scene->film->denoising_flags |= flag; \
} \
((void)0)
MAP_OPTION("denoising_diffuse_direct", DENOISING_CLEAN_DIFFUSE_DIR);
MAP_OPTION("denoising_diffuse_indirect", DENOISING_CLEAN_DIFFUSE_IND);
MAP_OPTION("denoising_glossy_direct", DENOISING_CLEAN_GLOSSY_DIR);

View File

@ -230,8 +230,9 @@ class OpenCLCache {
if (err != CL_SUCCESS) { \
string message = string_printf( \
"OpenCL error: %s in %s (%s:%d)", clewErrorString(err), #stmt, __FILE__, __LINE__); \
if ((device)->error_message() == "") \
if ((device)->error_message() == "") { \
(device)->set_error(message); \
} \
fprintf(stderr, "%s\n", message.c_str()); \
} \
} \
@ -244,8 +245,9 @@ class OpenCLCache {
if (err != CL_SUCCESS) { \
string message = string_printf( \
"OpenCL error: %s in %s (%s:%d)", clewErrorString(err), #stmt, __FILE__, __LINE__); \
if (error_msg == "") \
if (error_msg == "") { \
error_msg = message; \
} \
fprintf(stderr, "%s\n", message.c_str()); \
} \
} \

View File

@ -243,8 +243,9 @@ void MEM_use_guarded_allocator(void);
} \
void operator delete(void *mem) \
{ \
if (mem) \
if (mem) { \
MEM_freeN(mem); \
} \
} \
void *operator new[](size_t num_bytes) \
{ \
@ -252,8 +253,9 @@ void MEM_use_guarded_allocator(void);
} \
void operator delete[](void *mem) \
{ \
if (mem) \
if (mem) { \
MEM_freeN(mem); \
} \
} \
void *operator new(size_t /*count*/, void *ptr) \
{ \

View File

@ -390,8 +390,9 @@ void pbvh_vertex_iter_init(PBVH *pbvh, PBVHNode *node, PBVHVertexIter *vi, int m
vi.height = vi.gridsize; \
vi.index = vi.grid_indices[vi.g] * vi.key.grid_area - 1; \
vi.grid = vi.grids[vi.grid_indices[vi.g]]; \
if (mode == PBVH_ITER_UNIQUE) \
if (mode == PBVH_ITER_UNIQUE) { \
vi.gh = vi.grid_hidden[vi.grid_indices[vi.g]]; \
} \
} \
else { \
vi.width = vi.totvert; \
@ -408,8 +409,9 @@ void pbvh_vertex_iter_init(PBVH *pbvh, PBVHNode *node, PBVHVertexIter *vi, int m
vi.index++; \
vi.visible = true; \
if (vi.gh) { \
if (BLI_BITMAP_TEST(vi.gh, vi.gy * vi.gridsize + vi.gx)) \
if (BLI_BITMAP_TEST(vi.gh, vi.gy * vi.gridsize + vi.gx)) { \
continue; \
} \
} \
} \
else if (vi.mverts) { \
@ -426,10 +428,12 @@ void pbvh_vertex_iter_init(PBVH *pbvh, PBVHNode *node, PBVHVertexIter *vi, int m
vi.co = vi.mvert->co; \
vi.no = vi.mvert->no; \
vi.index = vi.vert_indices[vi.i]; \
if (vi.vmask) \
if (vi.vmask) { \
vi.mask = &vi.vmask[vi.index]; \
if (vi.vcol) \
} \
if (vi.vcol) { \
vi.col = vi.vcol[vi.index].color; \
} \
} \
else { \
if (!BLI_gsetIterator_done(&vi.bm_unique_verts)) { \
@ -441,8 +445,9 @@ void pbvh_vertex_iter_init(PBVH *pbvh, PBVHNode *node, PBVHVertexIter *vi, int m
BLI_gsetIterator_step(&vi.bm_other_verts); \
} \
vi.visible = !BM_elem_flag_test_bool(vi.bm_vert, BM_ELEM_HIDDEN); \
if (mode == PBVH_ITER_UNIQUE && !vi.visible) \
if (mode == PBVH_ITER_UNIQUE && !vi.visible) { \
continue; \
} \
vi.co = vi.bm_vert->co; \
vi.fno = vi.bm_vert->no; \
vi.index = BM_elem_index_get(vi.bm_vert); \

View File

@ -1287,8 +1287,9 @@ void BKE_animdata_main_cb(Main *bmain, ID_AnimData_Edit_Callback func, void *use
#define ANIMDATA_IDS_CB(first) \
for (id = first; id; id = id->next) { \
AnimData *adt = BKE_animdata_from_id(id); \
if (adt) \
if (adt) { \
func(id, adt, user_data); \
} \
} \
(void)0
@ -1299,11 +1300,13 @@ void BKE_animdata_main_cb(Main *bmain, ID_AnimData_Edit_Callback func, void *use
NtId_Type *ntp = (NtId_Type *)id; \
if (ntp->nodetree) { \
AnimData *adt2 = BKE_animdata_from_id((ID *)ntp->nodetree); \
if (adt2) \
if (adt2) { \
func(id, adt2, user_data); \
} \
} \
if (adt) \
if (adt) { \
func(id, adt, user_data); \
} \
} \
(void)0

View File

@ -1545,20 +1545,28 @@ void BKE_brush_debug_print_state(Brush *br)
brush_defaults(&def);
#define BR_TEST(field, t) \
if (br->field != def.field) \
printf("br->" #field " = %" #t ";\n", br->field)
if (br->field != def.field) { \
printf("br->" #field " = %" #t ";\n", br->field); \
} \
((void)0)
#define BR_TEST_FLAG(_f) \
if ((br->flag & _f) && !(def.flag & _f)) \
if ((br->flag & _f) && !(def.flag & _f)) { \
printf("br->flag |= " #_f ";\n"); \
else if (!(br->flag & _f) && (def.flag & _f)) \
printf("br->flag &= ~" #_f ";\n")
} \
else if (!(br->flag & _f) && (def.flag & _f)) { \
printf("br->flag &= ~" #_f ";\n"); \
} \
((void)0)
#define BR_TEST_FLAG_OVERLAY(_f) \
if ((br->overlay_flags & _f) && !(def.overlay_flags & _f)) \
if ((br->overlay_flags & _f) && !(def.overlay_flags & _f)) { \
printf("br->overlay_flags |= " #_f ";\n"); \
else if (!(br->overlay_flags & _f) && (def.overlay_flags & _f)) \
printf("br->overlay_flags &= ~" #_f ";\n")
} \
else if (!(br->overlay_flags & _f) && (def.overlay_flags & _f)) { \
printf("br->overlay_flags &= ~" #_f ";\n"); \
} \
((void)0)
/* print out any non-default brush state */
BR_TEST(normal_weight, f);

View File

@ -788,9 +788,9 @@ static void default_get_tarmat_full_bbone(struct Depsgraph *UNUSED(depsgraph),
ct->space = con->tarspace; \
ct->flag = CONSTRAINT_TAR_TEMP; \
\
if (ct->tar) \
if (ct->tar) { \
ct->type = CONSTRAINT_OBTYPE_OBJECT; \
\
} \
BLI_addtail(list, ct); \
} \
(void)0
@ -2645,7 +2645,8 @@ static void actcon_get_tarmat(struct Depsgraph *depsgraph,
/* Skip targets if we're using local float property to set action time */
if (data->flag & ACTCON_USE_EVAL_TIME) {
s = data->eval_time;
} else {
}
else {
/* get the transform matrix of the target */
constraint_target_to_mat4(ct->tar,
ct->subtarget,

View File

@ -198,8 +198,10 @@ static int search_polyloop_cmp(const void *v1, const void *v2)
* \{ */
#define PRINT_MSG(...) \
if (do_verbose) \
CLOG_INFO(&LOG, 1, __VA_ARGS__)
if (do_verbose) { \
CLOG_INFO(&LOG, 1, __VA_ARGS__); \
} \
((void)0)
#define PRINT_ERR(...) \
do { \

View File

@ -3997,8 +3997,9 @@ static int get_particle_uv(Mesh *mesh,
#define CLAMP_WARP_PARTICLE_TEXTURE_POS(type, pvalue) \
if (event & type) { \
if (pvalue < 0.0f) \
if (pvalue < 0.0f) { \
pvalue = 1.0f + pvalue; \
} \
CLAMP(pvalue, 0.0f, 1.0f); \
} \
(void)0

View File

@ -93,10 +93,12 @@ typedef unsigned int BLI_bitmap;
#define BLI_BITMAP_SET(_bitmap, _index, _set) \
{ \
CHECK_TYPE(_bitmap, BLI_bitmap *); \
if (_set) \
if (_set) { \
BLI_BITMAP_ENABLE(_bitmap, _index); \
else \
} \
else { \
BLI_BITMAP_DISABLE(_bitmap, _index); \
} \
} \
(void)0

View File

@ -136,50 +136,66 @@ extern "C" {
(void)0
#define DO_MIN(vec, min) \
{ \
if ((min)[0] > (vec)[0]) \
if ((min)[0] > (vec)[0]) { \
(min)[0] = (vec)[0]; \
if ((min)[1] > (vec)[1]) \
} \
if ((min)[1] > (vec)[1]) { \
(min)[1] = (vec)[1]; \
if ((min)[2] > (vec)[2]) \
} \
if ((min)[2] > (vec)[2]) { \
(min)[2] = (vec)[2]; \
} \
} \
(void)0
#define DO_MAX(vec, max) \
{ \
if ((max)[0] < (vec)[0]) \
if ((max)[0] < (vec)[0]) { \
(max)[0] = (vec)[0]; \
if ((max)[1] < (vec)[1]) \
} \
if ((max)[1] < (vec)[1]) { \
(max)[1] = (vec)[1]; \
if ((max)[2] < (vec)[2]) \
} \
if ((max)[2] < (vec)[2]) { \
(max)[2] = (vec)[2]; \
} \
} \
(void)0
#define DO_MINMAX(vec, min, max) \
{ \
if ((min)[0] > (vec)[0]) \
if ((min)[0] > (vec)[0]) { \
(min)[0] = (vec)[0]; \
if ((min)[1] > (vec)[1]) \
} \
if ((min)[1] > (vec)[1]) { \
(min)[1] = (vec)[1]; \
if ((min)[2] > (vec)[2]) \
} \
if ((min)[2] > (vec)[2]) { \
(min)[2] = (vec)[2]; \
if ((max)[0] < (vec)[0]) \
} \
if ((max)[0] < (vec)[0]) { \
(max)[0] = (vec)[0]; \
if ((max)[1] < (vec)[1]) \
} \
if ((max)[1] < (vec)[1]) { \
(max)[1] = (vec)[1]; \
if ((max)[2] < (vec)[2]) \
} \
if ((max)[2] < (vec)[2]) { \
(max)[2] = (vec)[2]; \
} \
} \
(void)0
#define DO_MINMAX2(vec, min, max) \
{ \
if ((min)[0] > (vec)[0]) \
if ((min)[0] > (vec)[0]) { \
(min)[0] = (vec)[0]; \
if ((min)[1] > (vec)[1]) \
} \
if ((min)[1] > (vec)[1]) { \
(min)[1] = (vec)[1]; \
if ((max)[0] < (vec)[0]) \
} \
if ((max)[0] < (vec)[0]) { \
(max)[0] = (vec)[0]; \
if ((max)[1] < (vec)[1]) \
} \
if ((max)[1] < (vec)[1]) { \
(max)[1] = (vec)[1]; \
} \
} \
(void)0
@ -330,24 +346,28 @@ extern "C" {
#define CLAMP(a, b, c) \
{ \
if ((a) < (b)) \
if ((a) < (b)) { \
(a) = (b); \
else if ((a) > (c)) \
} \
else if ((a) > (c)) { \
(a) = (c); \
} \
} \
(void)0
#define CLAMP_MAX(a, c) \
{ \
if ((a) > (c)) \
if ((a) > (c)) { \
(a) = (c); \
} \
} \
(void)0
#define CLAMP_MIN(a, b) \
{ \
if ((a) < (b)) \
if ((a) < (b)) { \
(a) = (b); \
} \
} \
(void)0

View File

@ -37,8 +37,10 @@
/* Allows to avoid using malloc for userdata_chunk in tasks, when small enough. */
#define MALLOCA(_size) ((_size) <= 8192) ? alloca((_size)) : MEM_mallocN((_size), __func__)
#define MALLOCA_FREE(_mem, _size) \
if (((_mem) != NULL) && ((_size) > 8192)) \
MEM_freeN((_mem))
if (((_mem) != NULL) && ((_size) > 8192)) { \
MEM_freeN((_mem)); \
} \
((void)0)
BLI_INLINE void task_parallel_calc_chunk_size(const TaskParallelSettings *settings,
const int tot_items,

View File

@ -4254,20 +4254,26 @@ short ANIM_channel_setting_get(bAnimContext *ac, bAnimListElem *ale, eAnimChanne
#define ACF_SETTING_SET(sval, sflag, smode) \
{ \
if (negflag) { \
if (smode == ACHANNEL_SETFLAG_INVERT) \
if (smode == ACHANNEL_SETFLAG_INVERT) { \
(sval) ^= (sflag); \
else if (smode == ACHANNEL_SETFLAG_ADD) \
} \
else if (smode == ACHANNEL_SETFLAG_ADD) { \
(sval) &= ~(sflag); \
else \
} \
else { \
(sval) |= (sflag); \
} \
} \
else { \
if (smode == ACHANNEL_SETFLAG_INVERT) \
if (smode == ACHANNEL_SETFLAG_INVERT) { \
(sval) ^= (sflag); \
else if (smode == ACHANNEL_SETFLAG_ADD) \
} \
else if (smode == ACHANNEL_SETFLAG_ADD) { \
(sval) |= (sflag); \
else \
} \
else { \
(sval) &= ~(sflag); \
} \
} \
} \
(void)0

View File

@ -570,8 +570,9 @@ bool ANIM_animdata_get_context(const bContext *C, bAnimContext *ac)
// XXX: ale_statement stuff is really a hack for one special case. It shouldn't really be needed...
#define ANIMCHANNEL_NEW_CHANNEL_FULL( \
channel_data, channel_type, owner_id, fcurve_owner_id, ale_statement) \
if (filter_mode & ANIMFILTER_TMP_PEEK) \
if (filter_mode & ANIMFILTER_TMP_PEEK) { \
return 1; \
} \
{ \
bAnimListElem *ale = make_new_animlistelem( \
channel_data, channel_type, (ID *)owner_id, fcurve_owner_id); \

View File

@ -515,19 +515,21 @@ void ANIM_editkeyframes_refresh(bAnimContext *ac)
#define KEYFRAME_OK_CHECKS(check) \
{ \
CHECK_TYPE(ok, short); \
if (check(1)) \
if (check(1)) { \
ok |= KEYFRAME_OK_KEY; \
\
} \
if (ked && (ked->iterflags & KEYFRAME_ITER_INCL_HANDLES)) { \
/* Only act on visible items, so check handle visibility state. */ \
const bool handles_visible = ((ked->iterflags & KEYFRAME_ITER_HANDLES_DEFAULT_INVISIBLE) ? \
(BEZT_ISSEL_ANY(bezt)) : \
true); \
if (handles_visible) { \
if (check(0)) \
if (check(0)) { \
ok |= KEYFRAME_OK_H1; \
if (check(2)) \
} \
if (check(2)) { \
ok |= KEYFRAME_OK_H2; \
} \
} \
} \
} \
@ -1054,10 +1056,12 @@ KeyframeEditFunc ANIM_editkeyframes_mirror(short mode)
*/
#define ENSURE_HANDLES_MATCH(bezt) \
if (bezt->h1 != bezt->h2) { \
if (ELEM(bezt->h1, HD_ALIGN, HD_AUTO, HD_AUTO_ANIM)) \
if (ELEM(bezt->h1, HD_ALIGN, HD_AUTO, HD_AUTO_ANIM)) { \
bezt->h1 = HD_FREE; \
if (ELEM(bezt->h2, HD_ALIGN, HD_AUTO, HD_AUTO_ANIM)) \
} \
if (ELEM(bezt->h2, HD_ALIGN, HD_AUTO, HD_AUTO_ANIM)) { \
bezt->h2 = HD_FREE; \
} \
} \
(void)0

View File

@ -670,11 +670,13 @@ struct GP_EditableStrokes_Iter {
for (bGPDstroke *gps = gpf_->strokes.first; gps; gps = gpsn_) { \
gpsn_ = gps->next; \
/* skip strokes that are invalid for current view */ \
if (ED_gpencil_stroke_can_use(C, gps) == false) \
if (ED_gpencil_stroke_can_use(C, gps) == false) { \
continue; \
} \
/* check if the color is editable */ \
if (ED_gpencil_stroke_color_use(obact_, gpl, gps) == false) \
if (ED_gpencil_stroke_color_use(obact_, gpl, gps) == false) { \
continue; \
} \
/* ... Do Stuff With Strokes ... */
#define GP_EDITABLE_STROKES_END(gpstroke_iter) \
@ -717,11 +719,13 @@ struct GP_EditableStrokes_Iter {
/* loop over strokes */ \
LISTBASE_FOREACH (bGPDstroke *, gps, &gpf_->strokes) { \
/* skip strokes that are invalid for current view */ \
if (ED_gpencil_stroke_can_use(C, gps) == false) \
if (ED_gpencil_stroke_can_use(C, gps) == false) { \
continue; \
} \
/* check if the color is editable */ \
if (ED_gpencil_stroke_color_use(obact_, gpl, gps) == false) \
if (ED_gpencil_stroke_color_use(obact_, gpl, gps) == false) { \
continue; \
} \
/* ... Do Stuff With Strokes ... */
#define GP_EVALUATED_STROKES_END(gpstroke_iter) \

View File

@ -10486,8 +10486,9 @@ static int ui_pie_handler(bContext *C, const wmEvent *event, uiPopupBlockHandle
#define CASE_NUM_TO_DIR(n, d) \
case (EVT_ZEROKEY + n): \
case (EVT_PAD0 + n): { \
if (num_dir == UI_RADIAL_NONE) \
if (num_dir == UI_RADIAL_NONE) { \
num_dir = d; \
} \
} \
(void)0

View File

@ -219,14 +219,18 @@ intersection_test intersect2dSeg2dSegParametric(const Vec2r &p1,
#define FINDMINMAX(x0, x1, x2, min, max) \
{ \
min = max = x0; \
if (x1 < min) \
if (x1 < min) { \
min = x1; \
if (x1 > max) \
} \
if (x1 > max) { \
max = x1; \
if (x2 < min) \
} \
if (x2 < min) { \
min = x2; \
if (x2 > max) \
} \
if (x2 > max) { \
max = x2; \
} \
} \
(void)0
@ -244,8 +248,9 @@ intersection_test intersect2dSeg2dSegParametric(const Vec2r &p1,
max = p0; \
} \
rad = fa * boxhalfsize[Y] + fb * boxhalfsize[Z]; \
if (min > rad || max < -rad) \
if (min > rad || max < -rad) { \
return 0; \
} \
} \
(void)0
@ -262,8 +267,9 @@ intersection_test intersect2dSeg2dSegParametric(const Vec2r &p1,
max = p0; \
} \
rad = fa * boxhalfsize[Y] + fb * boxhalfsize[Z]; \
if (min > rad || max < -rad) \
if (min > rad || max < -rad) { \
return 0; \
} \
} \
(void)0
@ -281,8 +287,9 @@ intersection_test intersect2dSeg2dSegParametric(const Vec2r &p1,
max = p0; \
} \
rad = fa * boxhalfsize[X] + fb * boxhalfsize[Z]; \
if (min > rad || max < -rad) \
if (min > rad || max < -rad) { \
return 0; \
} \
} \
(void)0
@ -299,8 +306,9 @@ intersection_test intersect2dSeg2dSegParametric(const Vec2r &p1,
max = p0; \
} \
rad = fa * boxhalfsize[X] + fb * boxhalfsize[Z]; \
if (min > rad || max < -rad) \
if (min > rad || max < -rad) { \
return 0; \
} \
} \
(void)0
@ -318,8 +326,9 @@ intersection_test intersect2dSeg2dSegParametric(const Vec2r &p1,
max = p2; \
} \
rad = fa * boxhalfsize[X] + fb * boxhalfsize[Y]; \
if (min > rad || max < -rad) \
if (min > rad || max < -rad) { \
return 0; \
} \
} \
(void)0
@ -336,8 +345,9 @@ intersection_test intersect2dSeg2dSegParametric(const Vec2r &p1,
max = p0; \
} \
rad = fa * boxhalfsize[X] + fb * boxhalfsize[Y]; \
if (min > rad || max < -rad) \
if (min > rad || max < -rad) { \
return 0; \
} \
} \
(void)0

View File

@ -511,8 +511,10 @@ typedef enum ID_Type {
((ID *)(_id))->newid->tag |= LIB_TAG_NEW, \
(void *)((ID *)(_id))->newid)
#define ID_NEW_REMAP(a) \
if ((a) && (a)->id.newid) \
(a) = (void *)(a)->id.newid
if ((a) && (a)->id.newid) { \
(a) = (void *)(a)->id.newid; \
} \
((void)0)
/** id->flag (persitent). */
enum {

View File

@ -985,8 +985,9 @@ typedef enum ePathCompare_Flag {
/* Helper macro for checking frame clamping */
#define FRAMENUMBER_MIN_CLAMP(cfra) \
{ \
if ((U.flag & USER_NONEGFRAMES) && (cfra < 0)) \
if ((U.flag & USER_NONEGFRAMES) && (cfra < 0)) { \
cfra = 0; \
} \
} \
(void)0

View File

@ -4629,8 +4629,9 @@ static const char *cpp_classes =
" ++i; \\\n"
" } \\\n"
" sname##_##identifier##_end(&iter); \\\n"
" if (!found) \\\n"
" if (!found) { \\\n"
" memset(r_ptr, 0, sizeof(*r_ptr)); \\\n"
" } \\\n"
" return found; \\\n"
" } \n"
"#define COLLECTION_PROPERTY_LOOKUP_INT_true(sname, identifier) \\\n"
@ -4638,8 +4639,9 @@ static const char *cpp_classes =
"PointerRNA *r_ptr) \\\n"
" { \\\n"
" int found = sname##_##identifier##_lookup_int(ptr, key, r_ptr); \\\n"
" if (!found) \\\n"
" if (!found) { \\\n"
" memset(r_ptr, 0, sizeof(*r_ptr)); \\\n"
" } \\\n"
" return found; \\\n"
" } \n"
"#define COLLECTION_PROPERTY_LOOKUP_STRING_false(sname, identifier) \\\n"
@ -4660,13 +4662,15 @@ static const char *cpp_classes =
" *r_ptr = iter.ptr; \\\n"
" found = 1; \\\n"
" } \\\n"
" if (name_fixed != name) \\\n"
" if (name_fixed != name) { \\\n"
" MEM_freeN((void *) name); \\\n"
" } \\\n"
" sname##_##identifier##_next(&iter); \\\n"
" } \\\n"
" sname##_##identifier##_end(&iter); \\\n"
" if (!found) \\\n"
" if (!found) { \\\n"
" memset(r_ptr, 0, sizeof(*r_ptr)); \\\n"
" } \\\n"
" return found; \\\n"
" } \n"
"#define COLLECTION_PROPERTY_LOOKUP_STRING_true(sname, identifier) \\\n"
@ -4674,8 +4678,9 @@ static const char *cpp_classes =
"*key, PointerRNA *r_ptr) \\\n"
" { \\\n"
" int found = sname##_##identifier##_lookup_string(ptr, key, r_ptr); \\\n"
" if (!found) \\\n"
" if (!found) { \\\n"
" memset(r_ptr, 0, sizeof(*r_ptr)); \\\n"
" } \\\n"
" return found; \\\n"
" } \n"
"#define COLLECTION_PROPERTY(collection_funcs, type, sname, identifier, has_length, "

View File

@ -157,8 +157,10 @@ static CustomData *rna_cd_from_layer(PointerRNA *ptr, CustomDataLayer *cdl)
/* rely on negative values wrapping */
# define TEST_CDL(cmd) \
if ((void)(cd = cmd(me)), ARRAY_HAS_ITEM(cdl, cd->layers, cd->totlayer)) \
return cd
if ((void)(cd = cmd(me)), ARRAY_HAS_ITEM(cdl, cd->layers, cd->totlayer)) { \
return cd; \
} \
((void)0)
TEST_CDL(rna_mesh_vdata_helper);
TEST_CDL(rna_mesh_edata_helper);

View File

@ -73,9 +73,9 @@
\
static int rna_Test_##arr##_set_length(PointerRNA *ptr, int length) \
{ \
if (length > max) \
if (length > max) { \
return 0; \
\
} \
arr##_len = length; \
\
return 1; \

View File

@ -137,10 +137,12 @@ static int count_outputs(bNode *node)
bNodeStack **out) \
{ \
int outs = count_outputs(node); \
if (outs >= 1) \
if (outs >= 1) { \
tex_output(node, execdata, in, out[0], &name##_colorfn, data); \
if (outs >= 2) \
} \
if (outs >= 2) { \
tex_output(node, execdata, in, out[1], &name##_normalfn, data); \
} \
}
/* --- VORONOI -- */

View File

@ -1986,8 +1986,9 @@ static void bpy_prop_callback_assign_enum(struct PropertyRNA *prop,
} \
srna = srna_from_self(self, #_func "(...):"); \
if (srna == NULL) { \
if (PyErr_Occurred()) \
if (PyErr_Occurred()) { \
return NULL; \
} \
return bpy_prop_deferred_return(pymeth_##_func, kw); \
} \
(void)0

View File

@ -44,12 +44,15 @@ extern "C" {
texres->tg = tex->gfac * ((texres->tg - 0.5f) * tex->contrast + tex->bright - 0.5f); \
texres->tb = tex->bfac * ((texres->tb - 0.5f) * tex->contrast + tex->bright - 0.5f); \
if (!(tex->flag & TEX_NO_CLAMP)) { \
if (texres->tr < 0.0f) \
if (texres->tr < 0.0f) { \
texres->tr = 0.0f; \
if (texres->tg < 0.0f) \
} \
if (texres->tg < 0.0f) { \
texres->tg = 0.0f; \
if (texres->tb < 0.0f) \
} \
if (texres->tb < 0.0f) { \
texres->tb = 0.0f; \
} \
} \
if (tex->saturation != 1.0f) { \
float _hsv[3]; \
@ -57,12 +60,15 @@ extern "C" {
_hsv[1] *= tex->saturation; \
hsv_to_rgb(_hsv[0], _hsv[1], _hsv[2], &texres->tr, &texres->tg, &texres->tb); \
if ((tex->saturation > 1.0f) && !(tex->flag & TEX_NO_CLAMP)) { \
if (texres->tr < 0.0f) \
if (texres->tr < 0.0f) { \
texres->tr = 0.0f; \
if (texres->tg < 0.0f) \
} \
if (texres->tg < 0.0f) { \
texres->tg = 0.0f; \
if (texres->tb < 0.0f) \
} \
if (texres->tb < 0.0f) { \
texres->tb = 0.0f; \
} \
} \
} \
((void)0)

View File

@ -579,8 +579,10 @@ static int passtype_from_name(const char *name)
int len = BLI_str_partition(name, delim, &sep, &suf);
#define CHECK_PASS(NAME) \
if (STREQLEN(name, RE_PASSNAME_##NAME, len)) \
return SCE_PASS_##NAME
if (STREQLEN(name, RE_PASSNAME_##NAME, len)) { \
return SCE_PASS_##NAME; \
} \
((void)0)
CHECK_PASS(COMBINED);
CHECK_PASS(Z);

View File

@ -1176,8 +1176,9 @@ int WM_keymap_item_raw_to_string(const short shift,
const int result_len)
{
#define ADD_SEP \
if (p != buf) \
if (p != buf) { \
*p++ = ' '; \
} \
(void)0
char buf[128];