Fix clang-tidy cppcoreguidelines-macro-usage findings (macro functions)

This commit is contained in:
Tim Wojtulewicz 2025-05-09 11:59:04 -07:00
parent ad99a6821e
commit 460fe24a9a
23 changed files with 75 additions and 47 deletions

View file

@ -42,6 +42,8 @@ static VectorTypePtr base_vector_type__CPP(const VectorTypePtr& vt, bool is_bool
}
}
// NOLINTBEGIN(cppcoreguidelines-macro-usage)
// The kernel used for unary vector operations.
#define VEC_OP1_KERNEL(accessor, type, op) \
for ( unsigned int i = 0; i < v->Size(); ++i ) { \
@ -90,6 +92,8 @@ static VectorTypePtr base_vector_type__CPP(const VectorTypePtr& vt, bool is_bool
break; \
})
// NOLINTEND(cppcoreguidelines-macro-usage)
// The unary operations supported for vectors.
VEC_OP1_WITH_DOUBLE(pos, +)
VEC_OP1_WITH_DOUBLE(neg, -)
@ -98,6 +102,7 @@ VEC_OP1(comp, ~, )
// A kernel for applying a binary operation element-by-element to two
// vectors of a given low-level type.
// NOLINTBEGIN(cppcoreguidelines-macro-usage)
// NOLINTBEGIN(bugprone-macro-parentheses)
#define VEC_OP2_KERNEL(accessor, type, op, zero_check) \
for ( unsigned int i = 0; i < v1->Size(); ++i ) { \
@ -167,6 +172,7 @@ VEC_OP1(comp, ~, )
break; \
}, \
zero_check)
// NOLINTEND(cppcoreguidelines-macro-usage)
// The binary operations supported for vectors.
VEC_OP2_WITH_DOUBLE(add, +, 0)
@ -184,6 +190,7 @@ VEC_OP2_WITH_INT(rshift, >>, , 0)
// A version of VEC_OP2 that instead supports relational operations, so
// the result type is always vector-of-bool.
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
#define VEC_REL_OP(name, op) \
VectorValPtr vec_op_##name##__CPP(const VectorValPtr& v1, const VectorValPtr& v2) { \
if ( ! check_vec_sizes__CPP(v1, v2) ) \