[Bf-blender-cvs] [9fe0505db00] master: Cleanup: macro hygiene, parenthesize arguments
Campbell Barton
noreply at git.blender.org
Sun Apr 5 08:08:01 CEST 2020
Commit: 9fe0505db00f450333518238db6813ede046f45e
Author: Campbell Barton
Date: Sun Apr 5 13:53:24 2020 +1000
Branches: master
https://developer.blender.org/rB9fe0505db00f450333518238db6813ede046f45e
Cleanup: macro hygiene, parenthesize arguments
===================================================================
M source/blender/blenkernel/BKE_gpencil.h
M source/blender/blenkernel/BKE_main.h
M source/blender/blenkernel/BKE_mask.h
M source/blender/blenkernel/BKE_rigidbody.h
M source/blender/blenkernel/BKE_shader_fx.h
M source/blender/blenkernel/BKE_tracking.h
M source/blender/blenlib/BLI_link_utils.h
M source/blender/bmesh/intern/bmesh_edgeloop.h
M source/blender/editors/include/ED_anim_api.h
M source/blender/editors/include/ED_armature.h
M source/blender/editors/include/ED_keyframing.h
M source/blender/editors/include/ED_screen.h
M source/blender/editors/space_outliner/outliner_intern.h
M source/blender/editors/space_text/text_intern.h
M source/blender/editors/transform/transform.h
M source/blender/makesdna/DNA_gpencil_types.h
M source/blender/makesdna/DNA_mesh_types.h
M source/blender/makesdna/DNA_view3d_types.h
===================================================================
diff --git a/source/blender/blenkernel/BKE_gpencil.h b/source/blender/blenkernel/BKE_gpencil.h
index 8cd3081389e..faa331aa02d 100644
--- a/source/blender/blenkernel/BKE_gpencil.h
+++ b/source/blender/blenkernel/BKE_gpencil.h
@@ -68,21 +68,21 @@ struct bGPdata;
/* Vertex Color macros. */
#define GPENCIL_USE_VERTEX_COLOR(toolsettings) \
- ((toolsettings->gp_paint->mode == GPPAINT_FLAG_USE_VERTEXCOLOR))
+ (((toolsettings)->gp_paint->mode == GPPAINT_FLAG_USE_VERTEXCOLOR))
#define GPENCIL_USE_VERTEX_COLOR_STROKE(toolsettings, brush) \
((GPENCIL_USE_VERTEX_COLOR(toolsettings) && \
- ((brush->gpencil_settings->vertex_mode == GPPAINT_MODE_STROKE) || \
- (brush->gpencil_settings->vertex_mode == GPPAINT_MODE_BOTH))))
+ (((brush)->gpencil_settings->vertex_mode == GPPAINT_MODE_STROKE) || \
+ ((brush)->gpencil_settings->vertex_mode == GPPAINT_MODE_BOTH))))
#define GPENCIL_USE_VERTEX_COLOR_FILL(toolsettings, brush) \
((GPENCIL_USE_VERTEX_COLOR(toolsettings) && \
- ((brush->gpencil_settings->vertex_mode == GPPAINT_MODE_FILL) || \
- (brush->gpencil_settings->vertex_mode == GPPAINT_MODE_BOTH))))
+ (((brush)->gpencil_settings->vertex_mode == GPPAINT_MODE_FILL) || \
+ ((brush)->gpencil_settings->vertex_mode == GPPAINT_MODE_BOTH))))
#define GPENCIL_TINT_VERTEX_COLOR_STROKE(brush) \
- ((brush->gpencil_settings->vertex_mode == GPPAINT_MODE_STROKE) || \
- (brush->gpencil_settings->vertex_mode == GPPAINT_MODE_BOTH))
+ (((brush)->gpencil_settings->vertex_mode == GPPAINT_MODE_STROKE) || \
+ ((brush)->gpencil_settings->vertex_mode == GPPAINT_MODE_BOTH))
#define GPENCIL_TINT_VERTEX_COLOR_FILL(brush) \
- ((brush->gpencil_settings->vertex_mode == GPPAINT_MODE_FILL) || \
- (brush->gpencil_settings->vertex_mode == GPPAINT_MODE_BOTH))
+ (((brush)->gpencil_settings->vertex_mode == GPPAINT_MODE_FILL) || \
+ ((brush)->gpencil_settings->vertex_mode == GPPAINT_MODE_BOTH))
/* ------------ Grease-Pencil API ------------------ */
diff --git a/source/blender/blenkernel/BKE_main.h b/source/blender/blenkernel/BKE_main.h
index 306d889fba4..ed1f67350c3 100644
--- a/source/blender/blenkernel/BKE_main.h
+++ b/source/blender/blenkernel/BKE_main.h
@@ -225,11 +225,11 @@ int set_listbasepointers(struct Main *main, struct ListBase *lb[MAX_LIBARRAY]);
#define MAIN_VERSION_ATLEAST(main, ver, subver) \
((main)->versionfile > (ver) || \
- (main->versionfile == (ver) && (main)->subversionfile >= (subver)))
+ ((main)->versionfile == (ver) && (main)->subversionfile >= (subver)))
#define MAIN_VERSION_OLDER(main, ver, subver) \
((main)->versionfile < (ver) || \
- (main->versionfile == (ver) && (main)->subversionfile < (subver)))
+ ((main)->versionfile == (ver) && (main)->subversionfile < (subver)))
#define BLEN_THUMB_SIZE 128
diff --git a/source/blender/blenkernel/BKE_mask.h b/source/blender/blenkernel/BKE_mask.h
index cef26345980..dca677343ce 100644
--- a/source/blender/blenkernel/BKE_mask.h
+++ b/source/blender/blenkernel/BKE_mask.h
@@ -238,10 +238,10 @@ void BKE_mask_clipboard_paste_to_layer(struct Main *bmain, struct MaskLayer *mas
#define MASKPOINT_ISSEL_KNOT(p) (((p)->bezt.f2 & SELECT) != 0)
#define MASKPOINT_ISSEL_HANDLE(point, which_handle) \
- (((which_handle == MASK_WHICH_HANDLE_STICK) ? \
+ ((((which_handle) == MASK_WHICH_HANDLE_STICK) ? \
((((point)->bezt.f1 | (point)->bezt.f3) & SELECT)) : \
- ((which_handle == MASK_WHICH_HANDLE_LEFT) ? ((point)->bezt.f1 & SELECT) : \
- ((point)->bezt.f3 & SELECT))) != 0)
+ (((which_handle) == MASK_WHICH_HANDLE_LEFT) ? ((point)->bezt.f1 & SELECT) : \
+ ((point)->bezt.f3 & SELECT))) != 0)
#define MASKPOINT_SEL_ALL(p) \
{ \
diff --git a/source/blender/blenkernel/BKE_rigidbody.h b/source/blender/blenkernel/BKE_rigidbody.h
index 9d4d53bf27f..b4aa0ac2b93 100644
--- a/source/blender/blenkernel/BKE_rigidbody.h
+++ b/source/blender/blenkernel/BKE_rigidbody.h
@@ -121,16 +121,16 @@ void BKE_rigidbody_remove_constraint(struct Main *bmain,
/* get mass of Rigid Body Object to supply to RigidBody simulators */
#define RBO_GET_MASS(rbo) \
- ((rbo && ((rbo->type == RBO_TYPE_PASSIVE) || (rbo->flag & RBO_FLAG_KINEMATIC) || \
- (rbo->flag & RBO_FLAG_DISABLED))) ? \
+ (((rbo) && (((rbo)->type == RBO_TYPE_PASSIVE) || ((rbo)->flag & RBO_FLAG_KINEMATIC) || \
+ ((rbo)->flag & RBO_FLAG_DISABLED))) ? \
(0.0f) : \
- (rbo->mass))
+ ((rbo)->mass))
/* Get collision margin for Rigid Body Object, triangle mesh and cone shapes cannot embed margin,
* convex hull always uses custom margin. */
#define RBO_GET_MARGIN(rbo) \
- ((rbo->flag & RBO_FLAG_USE_MARGIN || rbo->shape == RB_SHAPE_CONVEXH || \
- rbo->shape == RB_SHAPE_TRIMESH || rbo->shape == RB_SHAPE_CONE) ? \
- (rbo->margin) : \
+ (((rbo)->flag & RBO_FLAG_USE_MARGIN || (rbo)->shape == RB_SHAPE_CONVEXH || \
+ (rbo)->shape == RB_SHAPE_TRIMESH || (rbo)->shape == RB_SHAPE_CONE) ? \
+ ((rbo)->margin) : \
(0.04f))
/* -------------- */
diff --git a/source/blender/blenkernel/BKE_shader_fx.h b/source/blender/blenkernel/BKE_shader_fx.h
index d6d0f0f71de..c8386a42c9a 100644
--- a/source/blender/blenkernel/BKE_shader_fx.h
+++ b/source/blender/blenkernel/BKE_shader_fx.h
@@ -35,9 +35,9 @@ struct Object;
struct ShaderFxData;
#define SHADER_FX_ACTIVE(_fx, _is_render) \
- (((_fx->mode & eShaderFxMode_Realtime) && (_is_render == false)) || \
- ((_fx->mode & eShaderFxMode_Render) && (_is_render == true)))
-#define SHADER_FX_EDIT(_fx, _is_edit) (((_fx->mode & eShaderFxMode_Editmode) == 0) && (_is_edit))
+ ((((_fx)->mode & eShaderFxMode_Realtime) && (_is_render == false)) || \
+ (((_fx)->mode & eShaderFxMode_Render) && (_is_render == true)))
+#define SHADER_FX_EDIT(_fx, _is_edit) ((((_fx)->mode & eShaderFxMode_Editmode) == 0) && (_is_edit))
typedef enum {
/* Should not be used, only for None type */
diff --git a/source/blender/blenkernel/BKE_tracking.h b/source/blender/blenkernel/BKE_tracking.h
index 00498e30abc..20236745438 100644
--- a/source/blender/blenkernel/BKE_tracking.h
+++ b/source/blender/blenkernel/BKE_tracking.h
@@ -462,7 +462,7 @@ void BKE_tracking_get_rna_path_prefix_for_plane_track(
#define MARKER_VISIBLE(sc, track, marker) \
(((marker)->flag & MARKER_DISABLED) == 0 || ((sc)->flag & SC_HIDE_DISABLED) == 0 || \
- (sc->clip->tracking.act_track == track))
+ ((sc)->clip->tracking.act_track == track))
#define TRACK_CLEAR_UPTO 0
#define TRACK_CLEAR_REMAINED 1
diff --git a/source/blender/blenlib/BLI_link_utils.h b/source/blender/blenlib/BLI_link_utils.h
index f37841e3192..c0db53ca9a3 100644
--- a/source/blender/blenlib/BLI_link_utils.h
+++ b/source/blender/blenlib/BLI_link_utils.h
@@ -61,7 +61,7 @@
#define BLI_LINKS_FREE(list) \
{ \
while (list) { \
- void *next = list->next; \
+ void *next = (list)->next; \
MEM_freeN(list); \
list = next; \
} \
diff --git a/source/blender/bmesh/intern/bmesh_edgeloop.h b/source/blender/bmesh/intern/bmesh_edgeloop.h
index 7701c680ae9..4c76ea4f9cf 100644
--- a/source/blender/bmesh/intern/bmesh_edgeloop.h
+++ b/source/blender/bmesh/intern/bmesh_edgeloop.h
@@ -78,7 +78,7 @@ bool BM_edgeloop_overlap_check(struct BMEdgeLoopStore *el_store_a,
#define BM_EDGELINK_NEXT(el_store, elink) \
(elink)->next ? \
- elink->next : \
+ (elink)->next : \
(BM_edgeloop_is_closed(el_store) ? BM_edgeloop_verts_get(el_store)->first : NULL)
#define BM_EDGELOOP_NEXT(el_store) \
diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h
index fe249ce8bfe..a9b34e3c735 100644
--- a/source/blender/editors/include/ED_anim_api.h
+++ b/source/blender/editors/include/ED_anim_api.h
@@ -337,17 +337,17 @@ typedef enum eAnimFilter_Flags {
/* 'Object' channels */
#define SEL_OBJC(base) (CHECK_TYPE_INLINE(base, Base *), ((base->flag & SELECT)))
#define EXPANDED_OBJC(ob) \
- (CHECK_TYPE_INLINE(ob, Object *), ((ob->nlaflag & OB_ADS_COLLAPSED) == 0))
+ (CHECK_TYPE_INLINE(ob, Object *), (((ob)->nlaflag & OB_ADS_COLLAPSED) == 0))
/* 'Sub-object' channels (flags stored in Data block) */
#define FILTER_SKE_OBJD(key) (CHECK_TYPE_INLINE(key, Key *), ((key->flag & KEY_DS_EXPAND)))
#define FILTER_MAT_OBJD(ma) (CHECK_TYPE_INLINE(ma, Material *), ((ma->flag & MA_DS_EXPAND)))
#define FILTER_LAM_OBJD(la) (CHECK_TYPE_INLINE(la, Light *), ((la->flag & LA_DS_EXPAND)))
#define FILTER_CAM_OBJD(ca) (CHECK_TYPE_INLINE(ca, Camera *), ((ca->flag & CAM_DS_EXPAND)))
#define FILTER_CACHEFILE_OBJD(cf) \
- (CHECK_TYPE_INLINE(cf, CacheFile *), ((cf->flag & CACHEFILE_DS_EXPAND)))
+ (CHECK_TYPE_INLINE(cf, CacheFile *), (((cf)->flag & CACHEFILE_DS_EXPAND)))
#define FILTER_CUR_OBJD(cu) (CHECK_TYPE_INLINE(cu, Curve *), ((cu->flag & CU_DS_EXPAND)))
#define FILTER_PART_OBJD(part) \
- (CHECK_TYPE_INLINE(part, ParticleSettings *), ((part->flag & PART_DS_EXPAND)))
+ (CHECK_TYPE_INLINE(part, ParticleSettings *), (((part)->flag & PART_DS_EXPAND)))
#define FILTER_MBALL_OBJD(mb) (CHECK_TYPE_INLINE(mb, MetaBall *), ((mb->flag2 & MB_DS_EXPAND)))
#define FILTER_ARM_OBJD(arm) (CHECK_TYPE_INLINE(arm, bArmature *), ((arm->flag & ARM_DS_EXPAND)))
#define FILTER_MESH_OBJD(me) (CHECK_TYPE_INLINE(me, Mesh *), ((me->flag & ME_DS_EXPAND)))
@@ -358,7 +358,7 @@ typedef enum eAnimFilter_Flags {
#define FILTER_VOLUME_OBJD(vo) (CHECK_TYPE_INLINE(vo, Volume *), ((vo->flag & VO_DS_EXPAND)))
/* Variable use expanders */
#define FILTER_NTREE_DATA(ntree) \
- (CHECK_TYPE_INLINE(ntree, bNodeTree *), ((ntree->flag & NTREE_DS_EXPAND)))
+ (CHECK_TYPE_INLINE(ntree, bNodeTree *), (((ntree)->flag & NTREE_DS_EXPAND)))
#define FILTER_TEX_DATA(tex) (CHECK_TYPE_INLINE(tex, Tex *), ((tex->flag & TEX_DS_EXPAND)))
/* 'Sub-object/Action' channels (flags stored in Action) */
@@ -369,11 +369,11 @@ typedef enum eAnimFilter_Flags {
/* Actions (also used for Dopesheet) */
/* Action Channel Group */
-#define EDITABLE_AGRP(agrp) ((agrp->flag & AGRP_PROTECTED) == 0)
+#define EDITABLE_AGRP(agrp) (((agrp)->flag & AGRP_PROTECTED) == 0)
#define EXPANDED_AGRP(ac, agrp) \
- (((!
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list