From e95b4dc2ddedac3a6edc5d75e4cdac4059305f04 Mon Sep 17 00:00:00 2001 From: Ray Molenkamp Date: Tue, 11 Jan 2022 12:54:18 -0700 Subject: Cleanup: Fix build warnings with MSVC our UNUSED macro is essentially a no-op for MSVC, which lead to the situation where this well meant macro was emitting the following warning: C4189: 'UNUSED_i': local variable is initialized but not referenced However since we have been on c++17 for a while now the UNUSED macro can be replaced with the standard [[maybe_unused]] attribute in cpp files. This changes cleans up the use of the UNUSED macro in the bf_nodes_geometry project. Differential Revision: https://developer.blender.org/D12915 Reviewed by: JacquesLucke, Severin, Sergey, HooglyBoogly --- .../nodes/geometry/nodes/legacy/node_geo_legacy_point_distribute.cc | 4 ++-- source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cube.cc | 6 +++--- .../nodes/geometry/nodes/node_geo_mesh_primitive_uv_sphere.cc | 2 +- source/blender/nodes/geometry/nodes/node_geo_set_curve_handles.cc | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) (limited to 'source/blender') diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_point_distribute.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_point_distribute.cc index c712e82ca18..29eff373d15 100644 --- a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_point_distribute.cc +++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_point_distribute.cc @@ -321,7 +321,7 @@ BLI_NOINLINE static void interpolate_existing_attributes( continue; } - for (const int UNUSED(i_set_instance) : set_group.transforms.index_range()) { + for ([[maybe_unused]] const int i_set_instance : set_group.transforms.index_range()) { const int offset = instance_start_offsets[i_instance]; Span bary_coords = bary_coords_array[i_instance]; Span looptri_indices = looptri_indices_array[i_instance]; @@ -516,7 +516,7 @@ static void distribute_points_poisson_disk(Span set_group const VArray density_factors = component.attribute_get_for_read( density_attribute_name, ATTR_DOMAIN_CORNER, use_one_default ? 1.0f : 0.0f); - for (const int UNUSED(i_set_instance) : set_group.transforms.index_range()) { + for ([[maybe_unused]] const int i_set_instance : set_group.transforms.index_range()) { Vector &positions = positions_all[i_instance]; Vector &bary_coords = bary_coords_all[i_instance]; Vector &looptri_indices = looptri_indices_all[i_instance]; diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cube.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cube.cc index e90a9eb393b..5b67258a947 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cube.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cube.cc @@ -155,7 +155,7 @@ static void calculate_polys(const CuboidConfig &config, /* Calculate polys for Bottom faces. */ int vert_1_start = 0; - for (const int UNUSED(y) : IndexRange(config.edges_y)) { + for ([[maybe_unused]] const int y : IndexRange(config.edges_y)) { for (const int x : IndexRange(config.edges_x)) { const int vert_1 = vert_1_start + x; const int vert_2 = vert_1_start + config.verts_x + x; @@ -173,7 +173,7 @@ static void calculate_polys(const CuboidConfig &config, vert_1_start = 0; int vert_2_start = config.verts_x * config.verts_y; - for (const int UNUSED(z) : IndexRange(config.edges_z)) { + for ([[maybe_unused]] const int z : IndexRange(config.edges_z)) { for (const int x : IndexRange(config.edges_x)) { define_quad(polys, loops, @@ -196,7 +196,7 @@ static void calculate_polys(const CuboidConfig &config, (config.verts_x - 2) * (config.verts_y - 2)); vert_2_start = vert_1_start + config.verts_x; - for (const int UNUSED(y) : IndexRange(config.edges_y)) { + for ([[maybe_unused]] const int y : IndexRange(config.edges_y)) { for (const int x : IndexRange(config.edges_x)) { define_quad(polys, loops, diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_uv_sphere.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_uv_sphere.cc index 373e6bfdd18..41178d5c4e6 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_uv_sphere.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_uv_sphere.cc @@ -178,7 +178,7 @@ static void calculate_sphere_faces(MutableSpan loops, int ring_vert_index_start = 1; int ring_edge_index_start = segments; - for (const int UNUSED(ring) : IndexRange(1, rings - 2)) { + for ([[maybe_unused]] const int ring : IndexRange(1, rings - 2)) { const int next_ring_vert_index_start = ring_vert_index_start + segments; const int next_ring_edge_index_start = ring_edge_index_start + segments * 2; const int ring_vertical_edge_index_start = ring_edge_index_start + segments; diff --git a/source/blender/nodes/geometry/nodes/node_geo_set_curve_handles.cc b/source/blender/nodes/geometry/nodes/node_geo_set_curve_handles.cc index feab0a6743f..82d09bbc208 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_set_curve_handles.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_set_curve_handles.cc @@ -106,7 +106,7 @@ static void set_position_in_component(const GeometryNodeCurveHandleMode mode, } } else { - for (int UNUSED(i) : spline->positions().index_range()) { + for ([[maybe_unused]] int i : spline->positions().index_range()) { if (current_mask < selection.size() && selection[current_mask] == current_point) { current_mask++; } -- cgit v1.2.3