diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2020-09-04 12:26:26 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2020-09-04 12:26:26 +0300 |
commit | 371ddda4d0b3c2ef0c40f604715db801dc33b669 (patch) | |
tree | 436685331cde6d6494b132c6665a3fca43d2e9e3 /source/blender/editors | |
parent | aa4cf47e403ba3f098d89e991dafc9fec30423c4 (diff) |
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.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/interface/interface_icons.c | 51 | ||||
-rw-r--r-- | source/blender/editors/physics/particle_edit.c | 1 | ||||
-rw-r--r-- | source/blender/editors/uvedit/uvedit_parametrizer.c | 30 |
3 files changed, 32 insertions, 50 deletions
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index aae0d7c525f..af9ef2e7b3d 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -483,22 +483,20 @@ 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) { -# define INIT_BRUSH_ICON(icon_id, name) \ - { \ - uchar *rect = (uchar *)datatoc_##name##_png; \ - const int size = datatoc_##name##_png_size; \ - DrawInfo *di; \ +# define INIT_BRUSH_ICON(icon_id, name) \ + { \ + uchar *rect = (uchar *)datatoc_##name##_png; \ + const int size = datatoc_##name##_png_size; \ + DrawInfo *di; \ \ - di = def_internal_icon(NULL, icon_id, 0, 0, w, ICON_TYPE_BUFFER, 0); \ - di->data.buffer.image->datatoc_rect = rect; \ - di->data.buffer.image->datatoc_size = size; \ - } \ - ((void)0) + di = def_internal_icon(NULL, icon_id, 0, 0, w, ICON_TYPE_BUFFER, 0); \ + di->data.buffer.image->datatoc_rect = rect; \ + di->data.buffer.image->datatoc_size = size; \ + } \ + ((void)0) /* end INIT_BRUSH_ICON */ const int w = 96; /* warning, brush size hardcoded in C, but it gets scaled */ @@ -556,7 +554,7 @@ static void init_brush_icons(void) INIT_BRUSH_ICON(ICON_GPBRUSH_ERASE_HARD, gp_brush_erase_hard); INIT_BRUSH_ICON(ICON_GPBRUSH_ERASE_STROKE, gp_brush_erase_stroke); -# undef INIT_BRUSH_ICON +# undef INIT_BRUSH_ICON } static DrawInfo *g_di_event_list = NULL; @@ -630,16 +628,16 @@ static void init_event_icons(void) { DrawInfo *di_next = NULL; -# define INIT_EVENT_ICON(icon_id, type, value) \ - { \ - DrawInfo *di = def_internal_icon(NULL, icon_id, 0, 0, w, ICON_TYPE_EVENT, 0); \ - di->data.input.event_type = type; \ - di->data.input.event_value = value; \ - di->data.input.icon = icon_id; \ - di->data.input.next = di_next; \ - di_next = di; \ - } \ - ((void)0) +# define INIT_EVENT_ICON(icon_id, type, value) \ + { \ + DrawInfo *di = def_internal_icon(NULL, icon_id, 0, 0, w, ICON_TYPE_EVENT, 0); \ + di->data.input.event_type = type; \ + di->data.input.event_value = value; \ + di->data.input.icon = icon_id; \ + di->data.input.next = di_next; \ + di_next = di; \ + } \ + ((void)0) /* end INIT_EVENT_ICON */ const int w = 16; /* DUMMY */ @@ -695,7 +693,7 @@ static void init_event_icons(void) g_di_event_list = di_next; -# undef INIT_EVENT_ICON +# undef INIT_EVENT_ICON } static void icon_verify_datatoc(IconImage *iimg) @@ -906,7 +904,7 @@ static void init_internal_icons(void) { int x, y; -# if 0 // temp disabled +# if 0 // temp disabled if ((btheme != NULL) && btheme->tui.iconfile[0]) { char *icondir = BKE_appdir_folder_id(BLENDER_DATAFILES, "icons"); char iconfilestr[FILE_MAX]; @@ -931,7 +929,7 @@ static void init_internal_icons(void) printf("%s: 'icons' data path not found, continuing\n", __func__); } } -# endif +# endif /* Define icons. */ for (y = 0; y < ICON_GRID_ROWS; y++) { @@ -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) { diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index eb7ddfefb9c..b403863f28b 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -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 diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c index f6485fdef5d..8d30dc19732 100644 --- a/source/blender/editors/uvedit/uvedit_parametrizer.c +++ b/source/blender/editors/uvedit/uvedit_parametrizer.c @@ -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 +#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 + typedef enum PBool { P_TRUE = 1, P_FALSE = 0, |