Cleanup: Compilation warnings

Mainly -Wset-but-unused-variable.
Makes default compilation on macOS way less noisy.

Differential Revision: https://developer.blender.org/D14357
This commit is contained in:
Sergey Sharybin 2022-03-16 10:57:19 +01:00
parent 2252bc6a55
commit c3ecfdf40b
Notes: blender-bot 2023-02-14 06:49:57 +01:00
Referenced by commit 366abae3e7, Cleanup: use ifdef to disable enum string allocation
Referenced by issue #96607, Panning images in the image viewer is broken
23 changed files with 51 additions and 90 deletions

View File

@ -43,7 +43,6 @@ static std::vector<std::string> exr_channel_names_for_passes(const BufferParams
static const char *component_suffixes[] = {"R", "G", "B", "A"};
int pass_index = 0;
int num_channels = 0;
std::vector<std::string> channel_names;
for (const BufferPass &pass : buffer_params.passes) {
if (pass.offset == PASS_UNUSED) {
@ -51,7 +50,6 @@ static std::vector<std::string> exr_channel_names_for_passes(const BufferParams
}
const PassInfo pass_info = pass.get_info();
num_channels += pass_info.num_components;
/* EXR canonically expects first part of channel names to be sorted alphabetically, which is
* not guaranteed to be the case with passes names. Assign a prefix based on the pass index

View File

@ -242,6 +242,10 @@ void Octree::printMemUsage()
dc_printf("Total allocated bytes on disk: %d \n", totalbytes);
dc_printf("Total leaf nodes: %d\n", totalLeafs);
/* Unused when not debuggining. */
(void)totalbytes;
(void)totalLeafs;
}
void Octree::resetMinimalEdges()

View File

@ -7,6 +7,12 @@
* Definition of GHOST_ContextCGL class.
*/
/* Don't generate OpenGL deprecation warning. This is a known thing, and is not something easily
* solvable in a short term. */
#ifdef __clang__
# pragma clang diagnostic ignored "-Wdeprecated-declarations"
#endif
#include "GHOST_ContextCGL.h"
#include <Cocoa/Cocoa.h>

View File

@ -1050,8 +1050,6 @@ void GHOST_SystemCocoa::notifyExternalEventProcessed()
GHOST_TSuccess GHOST_SystemCocoa::handleWindowEvent(GHOST_TEventType eventType,
GHOST_WindowCocoa *window)
{
NSArray *windowsList;
windowsList = [NSApp orderedWindows];
if (!validWindow(window)) {
return GHOST_kFailure;
}

View File

@ -263,6 +263,8 @@ MANTA::MANTA(int *res, FluidModifierData *fmd)
}
/* All requested initializations must not fail in constructor. */
BLI_assert(initSuccess);
(void)initSuccess; /* Ignored in release. */
updatePointers(fmd);
}

View File

@ -1114,7 +1114,7 @@ static tbool GenerateTSpaces(STSpace psTspace[],
STSpace *pSubGroupTspace = NULL;
SSubGroup *pUniSubGroups = NULL;
int *pTmpMembers = NULL;
int iMaxNrFaces = 0, iUniqueTspaces = 0, g = 0, i = 0;
int iMaxNrFaces = 0, g = 0, i = 0;
for (g = 0; g < iNrActiveGroups; g++)
if (iMaxNrFaces < pGroups[g].iNrFaces)
iMaxNrFaces = pGroups[g].iNrFaces;
@ -1136,7 +1136,6 @@ static tbool GenerateTSpaces(STSpace psTspace[],
return TFALSE;
}
iUniqueTspaces = 0;
for (g = 0; g < iNrActiveGroups; g++) {
const SGroup *pGroup = &pGroups[g];
int iUniqueSubGroups = 0, s = 0;
@ -1211,9 +1210,7 @@ static tbool GenerateTSpaces(STSpace psTspace[],
++l;
}
// assign tangent space index
assert(bFound || l == iUniqueSubGroups);
// piTempTangIndices[f*3+index] = iUniqueTspaces+l;
// if no match was found we allocate a new subgroup
if (!bFound) {
@ -1262,10 +1259,9 @@ static tbool GenerateTSpaces(STSpace psTspace[],
}
}
// clean up and offset iUniqueTspaces
// clean up
for (s = 0; s < iUniqueSubGroups; s++)
free(pUniSubGroups[s].pTriMembers);
iUniqueTspaces += iUniqueSubGroups;
}
// clean up

View File

@ -5244,7 +5244,6 @@ static void dynamic_paint_effect_shrink_cb(void *__restrict userdata,
PaintPoint *pPoint = &((PaintPoint *)sData->type_data)[index];
const PaintPoint *prevPoint = data->prevPoint;
const float eff_scale = data->eff_scale;
float totalAlpha = 0.0f;
const int *n_index = sData->adj_data->n_index;
const int *n_target = sData->adj_data->n_target;
@ -5257,8 +5256,6 @@ static void dynamic_paint_effect_shrink_cb(void *__restrict userdata,
const PaintPoint *pPoint_prev = &prevPoint[n_target[n_idx]];
float a_factor, ea_factor, w_factor;
totalAlpha += pPoint_prev->e_color[3];
/* Check if neighboring point has lower alpha,
* if so, decrease this point's alpha as well. */
if (pPoint->color[3] <= 0.0f && pPoint->e_color[3] <= 0.0f && pPoint->wetness <= 0.0f) {

View File

@ -1049,41 +1049,40 @@ bool BKE_mesh_validate_all_customdata(CustomData *vdata,
bool BKE_mesh_validate(Mesh *me, const bool do_verbose, const bool cddata_check_mask)
{
bool is_valid = true;
bool changed;
if (do_verbose) {
CLOG_INFO(&LOG, 0, "MESH: %s", me->id.name + 2);
}
is_valid &= BKE_mesh_validate_all_customdata(&me->vdata,
me->totvert,
&me->edata,
me->totedge,
&me->ldata,
me->totloop,
&me->pdata,
me->totpoly,
cddata_check_mask,
do_verbose,
true,
&changed);
BKE_mesh_validate_all_customdata(&me->vdata,
me->totvert,
&me->edata,
me->totedge,
&me->ldata,
me->totloop,
&me->pdata,
me->totpoly,
cddata_check_mask,
do_verbose,
true,
&changed);
is_valid &= BKE_mesh_validate_arrays(me,
me->mvert,
me->totvert,
me->medge,
me->totedge,
me->mface,
me->totface,
me->mloop,
me->totloop,
me->mpoly,
me->totpoly,
me->dvert,
do_verbose,
true,
&changed);
BKE_mesh_validate_arrays(me,
me->mvert,
me->totvert,
me->medge,
me->totedge,
me->mface,
me->totface,
me->mloop,
me->totloop,
me->mpoly,
me->totpoly,
me->dvert,
do_verbose,
true,
&changed);
if (changed) {
DEG_id_tag_update(&me->id, ID_RECALC_GEOMETRY_ALL_MODES);

View File

@ -142,9 +142,6 @@ static void do_kink_spiral(ParticleThreadContext *ctx,
float kink_freq = part->kink_freq;
float kink_shape = part->kink_shape;
float kink_axis_random = part->kink_axis_random;
float rough1 = part->rough1;
float rough2 = part->rough2;
float rough_end = part->rough_end;
ParticlePathIterator iter;
ParticleCacheKey *key;
@ -164,9 +161,6 @@ static void do_kink_spiral(ParticleThreadContext *ctx,
if (ptex) {
kink_amp *= ptex->kink_amp;
kink_freq *= ptex->kink_freq;
rough1 *= ptex->rough1;
rough2 *= ptex->rough2;
rough_end *= ptex->roughe;
}
cut_time = (totkeys - 1) * ptex->length;

View File

@ -2202,7 +2202,6 @@ void add_face_constraints(CDT_state<T> *cdt_state,
{
int nv = input.vert.size();
int nf = input.face.size();
int fstart = 0;
SymEdge<T> *face_symedge0 = nullptr;
CDTArrangement<T> *cdt = &cdt_state->cdt;
int maxflen = 0;
@ -2221,7 +2220,6 @@ void add_face_constraints(CDT_state<T> *cdt_state,
int flen = input.face[f].size();
if (flen <= 2) {
/* Ignore faces with fewer than 3 vertices. */
fstart += flen;
continue;
}
int fedge_start = (f + 1) * cdt_state->face_edge_offset;
@ -2266,7 +2264,6 @@ void add_face_constraints(CDT_state<T> *cdt_state,
add_face_ids(cdt_state, face_symedge0, f, fedge_start, fedge_end);
}
}
fstart += flen;
}
}

View File

@ -517,7 +517,6 @@ static bool bm_decim_triangulate_begin(BMesh *bm, int *r_edges_tri_tot)
{
BMIter iter;
BMFace *f;
bool has_quad = false;
bool has_ngon = false;
bool has_cut = false;
@ -533,7 +532,6 @@ static bool bm_decim_triangulate_begin(BMesh *bm, int *r_edges_tri_tot)
BM_elem_index_set(l_iter, -1); /* set_dirty */
} while ((l_iter = l_iter->next) != l_first);
has_quad |= (f->len > 3);
has_ngon |= (f->len > 4);
}

View File

@ -221,14 +221,6 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
export_settings.limit_precision = limit_precision != 0;
export_settings.keep_bind_info = keep_bind_info != 0;
int includeFilter = OB_REL_NONE;
if (export_settings.include_armatures) {
includeFilter |= OB_REL_MOD_ARMATURE;
}
if (export_settings.include_children) {
includeFilter |= OB_REL_CHILDREN_RECURSIVE;
}
export_count = collada_export(C, &export_settings);
if (export_count == 0) {

View File

@ -125,7 +125,7 @@ static int edbm_rip_edge_invoke(bContext *C, wmOperator *UNUSED(op), const wmEve
#ifdef USE_TRICKY_EXTEND
/* first check if we can select the edge to split based on selection-only */
int tot_sel = 0, tot = 0;
int tot_sel = 0;
BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) {
if (!BM_elem_flag_test(e, BM_ELEM_HIDDEN)) {
@ -133,7 +133,6 @@ static int edbm_rip_edge_invoke(bContext *C, wmOperator *UNUSED(op), const wmEve
e_best = e;
tot_sel += 1;
}
tot += 1;
}
}
if (tot_sel != 1) {

View File

@ -2302,7 +2302,7 @@ static int edbm_edge_rotate_selected_exec(bContext *C, wmOperator *op)
BMIter iter;
const bool use_ccw = RNA_boolean_get(op->ptr, "use_ccw");
int tot_rotate_all = 0, tot_failed_all = 0;
int tot_failed_all = 0;
bool no_selected_edges = true, invalid_selected_edges = true;
ViewLayer *view_layer = CTX_data_view_layer(C);
@ -2360,7 +2360,6 @@ static int edbm_edge_rotate_selected_exec(bContext *C, wmOperator *op)
const int tot_rotate = BMO_slot_buffer_len(bmop.slots_out, "edges.out");
const int tot_failed = tot - tot_rotate;
tot_rotate_all += tot_rotate;
tot_failed_all += tot_failed;
if (tot_failed != 0) {

View File

@ -170,12 +170,8 @@ static void action_main_region_draw(const bContext *C, ARegion *region)
bAnimContext ac;
View2D *v2d = &region->v2d;
short marker_flag = 0;
short cfra_flag = 0;
UI_view2d_view_ortho(v2d);
if (saction->flag & SACTION_DRAWTIME) {
cfra_flag |= DRAWCFRA_UNIT_SECONDS;
}
/* clear and setup matrix */
UI_ThemeClearColor(TH_BACK);

View File

@ -271,7 +271,6 @@ static int delete_marker_exec(bContext *C, wmOperator *UNUSED(op))
MovieClip *clip = ED_space_clip_get_clip(sc);
MovieTracking *tracking = &clip->tracking;
const int framenr = ED_space_clip_get_clip_frame_number(sc);
bool has_selection = false;
bool changed = false;
ListBase *tracksbase = BKE_tracking_get_active_tracks(tracking);
@ -281,7 +280,6 @@ static int delete_marker_exec(bContext *C, wmOperator *UNUSED(op))
if (TRACK_VIEW_SELECTED(sc, track)) {
MovieTrackingMarker *marker = BKE_tracking_marker_get_exact(track, framenr);
if (marker != NULL) {
has_selection |= track->markersnr > 1;
clip_delete_marker(C, clip, track, marker);
changed = true;
}

View File

@ -216,7 +216,6 @@ static void nla_main_region_draw(const bContext *C, ARegion *region)
Scene *scene = CTX_data_scene(C);
bAnimContext ac;
View2D *v2d = &region->v2d;
short cfra_flag = 0;
/* clear and setup matrix */
UI_ThemeClearColor(TH_BACK);
@ -240,11 +239,6 @@ static void nla_main_region_draw(const bContext *C, ARegion *region)
UI_view2d_text_cache_draw(region);
}
/* current frame */
if (snla->flag & SNLA_DRAWTIME) {
cfra_flag |= DRAWCFRA_UNIT_SECONDS;
}
/* markers */
UI_view2d_view_orthoSpecial(region, v2d, 1);
int marker_draw_flag = DRAW_MARKERS_MARGIN;

View File

@ -2681,7 +2681,6 @@ void draw_timeline_seq(const bContext *C, ARegion *region)
Editing *ed = SEQ_editing_get(scene);
SpaceSeq *sseq = CTX_wm_space_seq(C);
View2D *v2d = &region->v2d;
short cfra_flag = 0;
float col[3];
seq_prefetch_wm_notify(C, scene);
@ -2728,9 +2727,6 @@ void draw_timeline_seq(const bContext *C, ARegion *region)
}
UI_view2d_view_ortho(v2d);
if ((sseq->flag & SEQ_DRAWFRAMES) == 0) {
cfra_flag |= DRAWCFRA_UNIT_SECONDS;
}
UI_view2d_view_orthoSpecial(region, v2d, 1);
int marker_draw_flag = DRAW_MARKERS_MARGIN;

View File

@ -4021,7 +4021,7 @@ static void p_smooth(PChart *chart)
PFace *f;
int j, it2, maxiter2, it;
int nedges = chart->nedges, nwheel, gridx, gridy;
int edgesx, edgesy, nsize, esize, i, x, y, maxiter, totiter;
int edgesx, edgesy, nsize, esize, i, x, y, maxiter;
float minv[2], maxv[2], median, invmedian, avglen2d, avglen3d;
float center[2], dx, dy, *nodes, dlimit, d, *oldnodesx, *oldnodesy;
float *nodesx, *nodesy, *hedges, *vedges, climit, moved, padding;
@ -4185,7 +4185,6 @@ static void p_smooth(PChart *chart)
/* smooth the grid */
maxiter = 10;
totiter = 0;
climit = 0.00001f * nsize;
for (it = 0; it < maxiter; it++) {
@ -4210,7 +4209,6 @@ static void p_smooth(PChart *chart)
for (it2 = 0; it2 < maxiter2; it2++) {
d = 0.0f;
totiter += 1;
memcpy(oldnodesx, nodesx, sizeof(float) * nsize);
memcpy(oldnodesy, nodesy, sizeof(float) * nsize);

View File

@ -244,4 +244,6 @@ void lineart_count_and_print_render_buffer_memory(LineartRenderBuffer *rb)
total += sum_this;
sum_this = 0;
count_this = 0;
(void)total; /* Ignored. */
}

View File

@ -8,6 +8,7 @@
* shader files.
*/
#include <iomanip>
#include <iostream>
#include "BLI_map.hh"
@ -136,15 +137,14 @@ struct GPUSource {
int64_t line_end = input.find("\n", offset);
int64_t line_start = input.rfind("\n", offset) + 1;
int64_t char_number = offset - line_start + 1;
char line_prefix[16] = "";
SNPRINTF(line_prefix, "%5ld | ", line_number);
/* TODO Use clog. */
std::cout << fullpath << ":" << line_number << ":" << char_number;
std::cout << " error: " << message << "\n";
std::cout << line_prefix << input.substr(line_start, line_end - line_start) << "\n";
std::cout << std::setw(5) << line_number << " | "
<< input.substr(line_start, line_end - line_start) << "\n";
std::cout << " | ";
for (int64_t i = 0; i < char_number - 1; i++) {
std::cout << " ";
@ -361,6 +361,7 @@ void gpu_shader_dependency_init()
errors += value->init_dependencies(*g_sources);
}
BLI_assert_msg(errors == 0, "Dependency errors detected: Aborting");
UNUSED_VARS_NDEBUG(errors);
}
void gpu_shader_dependency_exit()

View File

@ -274,6 +274,7 @@ static std::pair<bool, AbcObjectReader *> visit_object(
children_claiming_this_object += child_claims_this_object ? 1 : 0;
}
BLI_assert(children_claiming_this_object == claiming_child_readers.size());
UNUSED_VARS_NDEBUG(children_claiming_this_object);
AbcObjectReader *reader = nullptr;
const MetaData &md = object.getMetaData();

View File

@ -1897,7 +1897,6 @@ static const EnumPropertyItem *enum_items_from_py(PyObject *seq_fast,
PyObject *item;
const Py_ssize_t seq_len = PySequence_Fast_GET_SIZE(seq_fast);
PyObject **seq_fast_items = PySequence_Fast_ITEMS(seq_fast);
Py_ssize_t totbuf = 0;
int i;
short default_used = 0;
const char *default_str_cmp = NULL;
@ -1987,9 +1986,6 @@ static const EnumPropertyItem *enum_items_from_py(PyObject *seq_fast,
}
items[i] = tmp;
/* calculate combine string length */
totbuf += id_str_size + name_str_size + desc_str_size + 3; /* 3 is for '\0's */
}
else if (item == Py_None) {
/* Only set since the rest is cleared. */