parenthisize macro args to avoid errors

This commit is contained in:
Campbell Barton 2015-08-02 13:54:06 +10:00
parent a4f55617d1
commit 559e1434d8
Notes: blender-bot 2023-02-14 08:48:41 +01:00
Referenced by issue #45654, (Sculpt Mode) Drawing problem with fastnavigate enabled
6 changed files with 13 additions and 12 deletions

View File

@ -3116,8 +3116,8 @@ static void calchandleNurb_intern(BezTriple *bezt, BezTriple *prev, BezTriple *n
bool is_fcurve, bool skip_align)
{
/* defines to avoid confusion */
#define p2_h1 (p2 - 3)
#define p2_h2 (p2 + 3)
#define p2_h1 ((p2) - 3)
#define p2_h2 ((p2) + 3)
float *p1, *p2, *p3, pt[3];
float dvec_a[3], dvec_b[3];

View File

@ -221,7 +221,7 @@ PreviewImage *BKE_previewimg_copy(PreviewImage *prv)
PreviewImage **BKE_previewimg_id_get_p(ID *id)
{
switch (GS(id->name)) {
#define ID_PRV_CASE(id_code, id_struct) case id_code: { return &((id_struct *)id)->preview; }
#define ID_PRV_CASE(id_code, id_struct) case id_code: { return &((id_struct *)id)->preview; } ((void)0)
ID_PRV_CASE(ID_MA, Material);
ID_PRV_CASE(ID_TE, Tex);
ID_PRV_CASE(ID_WO, World);

View File

@ -54,13 +54,13 @@ struct Heap {
/* internal functions */
#define HEAP_PARENT(i) ((i - 1) >> 1)
#define HEAP_LEFT(i) ((i << 1) + 1)
#define HEAP_RIGHT(i) ((i << 1) + 2)
#define HEAP_COMPARE(a, b) (a->value < b->value)
#define HEAP_PARENT(i) (((i) - 1) >> 1)
#define HEAP_LEFT(i) (((i) << 1) + 1)
#define HEAP_RIGHT(i) (((i) << 1) + 2)
#define HEAP_COMPARE(a, b) ((a)->value < (b)->value)
#if 0 /* UNUSED */
#define HEAP_EQUALS(a, b) (a->value == b->value)
#define HEAP_EQUALS(a, b) ((a)->value == (b)->value)
#endif
BLI_INLINE void heap_swap(Heap *heap, const unsigned int i, const unsigned int j)

View File

@ -2494,7 +2494,7 @@ static void curve_smooth_value(ListBase *editnurb,
for (nu = editnurb->first; nu; nu = nu->next) {
if (nu->bezt) {
#define BEZT_VALUE(bezt) (*((float *)((char *)bezt + bezt_offsetof)))
#define BEZT_VALUE(bezt) (*((float *)((char *)(bezt) + bezt_offsetof)))
for (last_sel = 0; last_sel < nu->pntsu; last_sel++) {
/* loop over selection segments of a curve, smooth each */
@ -2563,7 +2563,7 @@ static void curve_smooth_value(ListBase *editnurb,
#undef BEZT_VALUE
}
else if (nu->bp) {
#define BP_VALUE(bp) (*((float *)((char *)bp + bp_offset)))
#define BP_VALUE(bp) (*((float *)((char *)(bp) + bp_offset)))
/* Same as above, keep these the same! */
for (last_sel = 0; last_sel < nu->pntsu; last_sel++) {

View File

@ -164,7 +164,7 @@ extern const short ui_radial_dir_to_angle[8];
#define UI_BITBUT_SET(a, b) ( (a) | 1 << (b) )
#define UI_BITBUT_CLR(a, b) ( (a) & ~(1 << (b)) )
/* bit-row */
#define UI_BITBUT_ROW(min, max) (((max) >= 31 ? 0xFFFFFFFF : (1 << (max + 1)) - 1) - ((min) ? ((1 << (min)) - 1) : 0) )
#define UI_BITBUT_ROW(min, max) (((max) >= 31 ? 0xFFFFFFFF : (1 << ((max) + 1)) - 1) - ((min) ? ((1 << (min)) - 1) : 0) )
/* split numbuts by ':' and align l/r */
#define USE_NUMBUTS_LR_ALIGN

View File

@ -119,7 +119,8 @@ static RayObjectAPI octree_api =
/* within one octree node, a set of 3x15 bits defines a 'boundbox' to OR with */
#define OCVALRES 15
#define BROW16(min, max) (((max) >= OCVALRES ? 0xFFFF : (1 << (max + 1)) - 1) - ((min > 0) ? ((1 << (min)) - 1) : 0))
#define BROW16(min, max) \
(((max) >= OCVALRES ? 0xFFFF : (1 << ((max) + 1)) - 1) - (((min) > 0) ? ((1 << (min)) - 1) : 0))
static void calc_ocval_face(float *v1, float *v2, float *v3, float *v4, short x, short y, short z, OcVal *ov)
{