Cleanup: Clang-Tidy readability-redundant-preprocessor fixes

Remove redundantly nested `#if` and `#ifdef` statements.

One nested `#if 0` block was left untouched, as it's in particle code
that's no longer maintained. Furthermore, that block also has some
explanation as to the differences between the enabled & disabled parts.

One nested `#if 0` construct was completely removed, leaving only the
actually used bit of code. There was no explanation as to the usefulness
of the disabled code, and it hasn't been touched in years.

No functional changes.
This commit is contained in:
Sybren A. Stüvel 2020-09-04 11:26:26 +02:00
parent aa4cf47e40
commit 371ddda4d0
6 changed files with 32 additions and 55 deletions

View File

@ -13,7 +13,6 @@ Checks: >
-readability-misleading-indentation,
-readability-inconsistent-declaration-parameter-name,
-readability-redundant-preprocessor,
-readability-redundant-member-init,
-readability-const-return-type,
-readability-static-accessed-through-instance,

View File

@ -102,11 +102,9 @@ Mesh *BKE_mesh_remesh_voxel_ovdb_volume_to_mesh_nomain(struct OpenVDBLevelSet *l
double adaptivity,
bool relax_disoriented_triangles)
{
# ifdef WITH_OPENVDB
struct OpenVDBVolumeToMeshData output_mesh;
OpenVDBLevelSet_volume_to_mesh(
level_set, &output_mesh, isovalue, adaptivity, relax_disoriented_triangles);
# endif
Mesh *mesh = BKE_mesh_new_nomain(output_mesh.totvertices,
0,

View File

@ -64,12 +64,10 @@ static vector<OpenCLDevice *> g_gpudevices;
/// \brief list of all thread for every GPUDevice in cpudevices a thread exists
static ListBase g_gputhreads;
/// \brief all scheduled work for the gpu
# ifdef COM_OPENCL_ENABLED
static bool g_openclActive = false;
static bool g_openclInitialized = false;
# endif
#endif
#endif
#if COM_CURRENT_THREADING_MODEL == COM_TM_QUEUE
void *WorkScheduler::thread_execute_cpu(void *data)

View File

@ -483,8 +483,6 @@ static void vicon_gplayer_color_draw(Icon *icon, int x, int y, int w, int h)
immUnbindProgram();
}
# ifndef WITH_HEADLESS
static void init_brush_icons(void)
{
@ -987,7 +985,6 @@ static void init_internal_icons(void)
def_internal_vicon(ICON_COLORSET_19_VEC, vicon_colorset_draw_19);
def_internal_vicon(ICON_COLORSET_20_VEC, vicon_colorset_draw_20);
}
# endif /* WITH_HEADLESS */
static void init_iconfile_list(struct ListBase *list)
{

View File

@ -3776,6 +3776,7 @@ static void brush_puff(PEData *data, int point_index, float mouse_distance)
#else
/* translate (not rotate) the rest of the hair if its not selected */
{
/* NOLINTNEXTLINE: readability-redundant-preprocessor */
# if 0 /* kindof works but looks worse then what's below */
/* Move the unselected point on a vector based on the

View File

@ -43,29 +43,13 @@
/* Utils */
#if 0
# define param_assert(condition)
# define param_warning(message)
# define param_test_equals_ptr(condition)
# define param_test_equals_int(condition)
#else
#define param_assert(condition) \
if (!(condition)) { /*printf("Assertion %s:%d\n", __FILE__, __LINE__); abort();*/ \
} \
(void)0
#define param_warning(message) \
{/*printf("Warning %s:%d: %s\n", __FILE__, __LINE__, message);*/}(void)0
# if 0
# define param_test_equals_ptr(str, a, b) \
if (a != b) { /*printf("Equals %s => %p != %p\n", str, a, b);*/ \
} \
(void)0
# define param_test_equals_int(str, a, b) \
if (a != b) { /*printf("Equals %s => %d != %d\n", str, a, b);*/ \
} \
(void)0
# endif
#endif
typedef enum PBool {
P_TRUE = 1,
P_FALSE = 0,