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
This commit is contained in:
@@ -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];
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user