diff options
author | Ray Molenkamp <github@lazydodo.com> | 2022-01-11 22:54:18 +0300 |
---|---|---|
committer | Ray Molenkamp <github@lazydodo.com> | 2022-01-11 22:54:18 +0300 |
commit | e95b4dc2ddedac3a6edc5d75e4cdac4059305f04 (patch) | |
tree | de5c7e966764f5564b653735e2c57adcc4d94fb5 /source/blender/nodes | |
parent | 259a71cd3c06a258d5795e1a1529db4f687dcd93 (diff) |
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
Diffstat (limited to 'source/blender/nodes')
4 files changed, 7 insertions, 7 deletions
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<float3> bary_coords = bary_coords_array[i_instance]; Span<int> looptri_indices = looptri_indices_array[i_instance]; @@ -516,7 +516,7 @@ static void distribute_points_poisson_disk(Span<GeometryInstanceGroup> set_group const VArray<float> density_factors = component.attribute_get_for_read<float>( 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<float3> &positions = positions_all[i_instance]; Vector<float3> &bary_coords = bary_coords_all[i_instance]; Vector<int> &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<MLoop> 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++; } |