[Bf-blender-cvs] [fb7f12dc407] master: Cleanup: hide 'UNUSED' macro definition for C++

Germano Cavalcante noreply at git.blender.org
Tue Dec 20 23:20:38 CET 2022


Commit: fb7f12dc40780106fb159786fd3064bf80432a17
Author: Germano Cavalcante
Date:   Tue Dec 20 15:51:47 2022 -0300
Branches: master
https://developer.blender.org/rBfb7f12dc40780106fb159786fd3064bf80432a17

Cleanup: hide 'UNUSED' macro definition for C++

This may allow the `C4100` warning to be re-enabled in the MSVC for C++.

Differential Revision: https://developer.blender.org/D16828

===================================================================

M	source/blender/blenkernel/BKE_ccg.h
M	source/blender/blenkernel/intern/cloth.cc
M	source/blender/blenkernel/intern/data_transfer.cc
M	source/blender/blenkernel/intern/key.cc
M	source/blender/blenkernel/intern/layer.cc
M	source/blender/blenkernel/intern/linestyle.cc
M	source/blender/blenkernel/intern/material.cc
M	source/blender/blenkernel/intern/texture.cc
M	source/blender/blenlib/BLI_utildefines.h
M	source/blender/bmesh/intern/bmesh_mesh_normals.cc
M	source/blender/compositor/intern/COM_MetaData.h
M	source/blender/draw/engines/eevee/eevee_shaders.cc
M	source/blender/draw/engines/image/image_space_image.hh
M	source/blender/draw/intern/draw_cache_impl_curves.cc
M	source/blender/draw/intern/draw_cache_impl_gpencil.cc
M	source/blender/editors/geometry/geometry_attributes.cc
M	source/blender/editors/interface/interface_context_menu.cc
M	source/blender/editors/interface/interface_icons.cc
M	source/blender/editors/sculpt_paint/paint_cursor.cc
M	source/blender/editors/sculpt_paint/paint_image_proj.cc
M	source/blender/editors/space_buttons/buttons_texture.cc
M	source/blender/editors/space_clip/tracking_ops_orient.cc
M	source/blender/editors/transform/transform_snap.cc
M	source/blender/gpu/intern/gpu_codegen.cc
M	source/blender/modifiers/intern/MOD_displace.cc
M	source/blender/modifiers/intern/MOD_triangulate.cc
M	source/blender/nodes/geometry/nodes/node_geo_blur_attribute.cc
M	source/blender/nodes/intern/node_util.cc
M	source/blender/nodes/texture/node_texture_tree.cc
M	source/blender/nodes/texture/node_texture_util.cc
M	source/blender/nodes/texture/nodes/node_texture_at.cc
M	source/blender/nodes/texture/nodes/node_texture_bricks.cc
M	source/blender/nodes/texture/nodes/node_texture_checker.cc
M	source/blender/nodes/texture/nodes/node_texture_combine_color.cc
M	source/blender/nodes/texture/nodes/node_texture_compose.cc
M	source/blender/nodes/texture/nodes/node_texture_coord.cc
M	source/blender/nodes/texture/nodes/node_texture_curves.cc
M	source/blender/nodes/texture/nodes/node_texture_decompose.cc
M	source/blender/nodes/texture/nodes/node_texture_distance.cc
M	source/blender/nodes/texture/nodes/node_texture_hueSatVal.cc
M	source/blender/nodes/texture/nodes/node_texture_image.cc
M	source/blender/nodes/texture/nodes/node_texture_invert.cc
M	source/blender/nodes/texture/nodes/node_texture_math.cc
M	source/blender/nodes/texture/nodes/node_texture_mixRgb.cc
M	source/blender/nodes/texture/nodes/node_texture_output.cc
M	source/blender/nodes/texture/nodes/node_texture_proc.cc
M	source/blender/nodes/texture/nodes/node_texture_rotate.cc
M	source/blender/nodes/texture/nodes/node_texture_scale.cc
M	source/blender/nodes/texture/nodes/node_texture_separate_color.cc
M	source/blender/nodes/texture/nodes/node_texture_texture.cc
M	source/blender/nodes/texture/nodes/node_texture_translate.cc
M	source/blender/nodes/texture/nodes/node_texture_valToNor.cc
M	source/blender/nodes/texture/nodes/node_texture_valToRgb.cc
M	source/blender/nodes/texture/nodes/node_texture_viewer.cc
M	source/blender/render/intern/engine.cc
M	source/blender/render/intern/multires_bake.cc

===================================================================

diff --git a/source/blender/blenkernel/BKE_ccg.h b/source/blender/blenkernel/BKE_ccg.h
index 786b84a0469..64b9870a8ea 100644
--- a/source/blender/blenkernel/BKE_ccg.h
+++ b/source/blender/blenkernel/BKE_ccg.h
@@ -83,7 +83,12 @@ BLI_INLINE CCGElem *CCG_elem_next(const CCGKey *key, CCGElem *elem);
 
 /* inline definitions follow */
 
-BLI_INLINE float *CCG_elem_co(const CCGKey *UNUSED(key), CCGElem *elem)
+BLI_INLINE float *CCG_elem_co(const CCGKey *
+#ifndef __cplusplus
+                                  UNUSED(key)
+#endif
+                                      ,
+                              CCGElem *elem)
 {
   return (float *)elem;
 }
diff --git a/source/blender/blenkernel/intern/cloth.cc b/source/blender/blenkernel/intern/cloth.cc
index ecd21dcb570..73cf7e1f805 100644
--- a/source/blender/blenkernel/intern/cloth.cc
+++ b/source/blender/blenkernel/intern/cloth.cc
@@ -713,7 +713,7 @@ static float cloth_shrink_factor(ClothModifierData *clmd, ClothVertex *verts, in
 }
 
 static bool cloth_from_object(
-    Object *ob, ClothModifierData *clmd, Mesh *mesh, float UNUSED(framenr), int first)
+    Object *ob, ClothModifierData *clmd, Mesh *mesh, float /*framenr*/, int first)
 {
   int i = 0;
   ClothVertex *verts = nullptr;
diff --git a/source/blender/blenkernel/intern/data_transfer.cc b/source/blender/blenkernel/intern/data_transfer.cc
index 382736ae502..2c9ff52e0a4 100644
--- a/source/blender/blenkernel/intern/data_transfer.cc
+++ b/source/blender/blenkernel/intern/data_transfer.cc
@@ -307,9 +307,9 @@ static void data_transfer_dtdata_type_preprocess(Mesh *me_src,
   }
 }
 
-static void data_transfer_dtdata_type_postprocess(Object *UNUSED(ob_src),
-                                                  Object *UNUSED(ob_dst),
-                                                  Mesh *UNUSED(me_src),
+static void data_transfer_dtdata_type_postprocess(Object * /*ob_src*/,
+                                                  Object * /*ob_dst*/,
+                                                  Mesh * /*me_src*/,
                                                   Mesh *me_dst,
                                                   const int dtdata_type,
                                                   const bool changed)
diff --git a/source/blender/blenkernel/intern/key.cc b/source/blender/blenkernel/intern/key.cc
index 99010c70e90..388dcff5229 100644
--- a/source/blender/blenkernel/intern/key.cc
+++ b/source/blender/blenkernel/intern/key.cc
@@ -51,10 +51,7 @@
 
 #include "BLO_read_write.h"
 
-static void shapekey_copy_data(Main *UNUSED(bmain),
-                               ID *id_dst,
-                               const ID *id_src,
-                               const int UNUSED(flag))
+static void shapekey_copy_data(Main * /*bmain*/, ID *id_dst, const ID *id_src, const int /*flag*/)
 {
   Key *key_dst = (Key *)id_dst;
   const Key *key_src = (const Key *)id_src;
@@ -2064,7 +2061,7 @@ int BKE_keyblock_curve_element_count(const ListBase *nurb)
   return tot;
 }
 
-void BKE_keyblock_update_from_curve(const Curve *UNUSED(cu), KeyBlock *kb, const ListBase *nurb)
+void BKE_keyblock_update_from_curve(const Curve * /*cu*/, KeyBlock *kb, const ListBase *nurb)
 {
   Nurb *nu;
   BezTriple *bezt;
@@ -2178,7 +2175,7 @@ static void keyblock_data_convert_to_curve(const float *fp, ListBase *nurb, int
   }
 }
 
-void BKE_keyblock_convert_to_curve(KeyBlock *kb, Curve *UNUSED(cu), ListBase *nurb)
+void BKE_keyblock_convert_to_curve(KeyBlock *kb, Curve * /*cu*/, ListBase *nurb)
 {
   const float *fp = static_cast<const float *>(kb->data);
   const int tot = min_ii(kb->totelem, BKE_keyblock_curve_element_count(nurb));
diff --git a/source/blender/blenkernel/intern/layer.cc b/source/blender/blenkernel/intern/layer.cc
index 4dfe507e02e..971cf85812a 100644
--- a/source/blender/blenkernel/intern/layer.cc
+++ b/source/blender/blenkernel/intern/layer.cc
@@ -489,7 +489,7 @@ static void layer_collections_copy_data(ViewLayer *view_layer_dst,
 }
 
 void BKE_view_layer_copy_data(Scene *scene_dst,
-                              const Scene *UNUSED(scene_src),
+                              const Scene * /*scene_src*/,
                               ViewLayer *view_layer_dst,
                               const ViewLayer *view_layer_src,
                               const int flag)
@@ -1257,8 +1257,8 @@ static bool view_layer_objects_base_cache_validate(ViewLayer *view_layer, LayerC
   return is_valid;
 }
 #else
-static bool view_layer_objects_base_cache_validate(ViewLayer *UNUSED(view_layer),
-                                                   LayerCollection *UNUSED(layer))
+static bool view_layer_objects_base_cache_validate(ViewLayer * /*view_layer*/,
+                                                   LayerCollection * /*layer*/)
 {
   return true;
 }
@@ -1650,7 +1650,7 @@ static void layer_collection_flag_unset_recursive(LayerCollection *lc, const int
   }
 }
 
-void BKE_layer_collection_isolate_global(Scene *UNUSED(scene),
+void BKE_layer_collection_isolate_global(Scene * /*scene*/,
                                          ViewLayer *view_layer,
                                          LayerCollection *lc,
                                          bool extend)
@@ -2266,7 +2266,7 @@ void BKE_view_layer_bases_in_mode_iterator_next(BLI_Iterator *iter)
   iter->valid = false;
 }
 
-void BKE_view_layer_bases_in_mode_iterator_end(BLI_Iterator *UNUSED(iter))
+void BKE_view_layer_bases_in_mode_iterator_end(BLI_Iterator * /*iter*/)
 {
   /* do nothing */
 }
@@ -2535,12 +2535,12 @@ void BKE_view_layer_set_active_aov(ViewLayer *view_layer, ViewLayerAOV *aov)
 }
 
 static void bke_view_layer_verify_aov_cb(void *userdata,
-                                         Scene *UNUSED(scene),
-                                         ViewLayer *UNUSED(view_layer),
+                                         Scene * /*scene*/,
+                                         ViewLayer * /*view_layer*/,
                                          const char *name,
-                                         int UNUSED(channels),
-                                         const char *UNUSED(chanid),
-                                         eNodeSocketDatatype UNUSED(type))
+                                         int /*channels*/,
+                                         const char * /*chanid*/,
+                                         eNodeSocketDatatype /*type*/)
 {
   GHash *name_count = static_cast<GHash *>(userdata);
   void **value_p;
diff --git a/source/blender/blenkernel/intern/linestyle.cc b/source/blender/blenkernel/intern/linestyle.cc
index 14e4453955c..3040f0f5cd5 100644
--- a/source/blender/blenkernel/intern/linestyle.cc
+++ b/source/blender/blenkernel/intern/linestyle.cc
@@ -628,8 +628,8 @@ static void direct_link_linestyle_thickness_modifier(BlendDataReader *reader,
   }
 }
 
-static void direct_link_linestyle_geometry_modifier(BlendDataReader *UNUSED(reader),
-                                                    LineStyleModifier *UNUSED(modifier))
+static void direct_link_linestyle_geometry_modifier(BlendDataReader * /*reader*/,
+                                                    LineStyleModifier * /*modifier*/)
 {
 }
 
@@ -1147,7 +1147,7 @@ LineStyleModifier *BKE_linestyle_alpha_modifier_add(FreestyleLineStyle *linestyl
 
 LineStyleModifier *BKE_linestyle_alpha_modifier_copy(FreestyleLineStyle *linestyle,
                                                      const LineStyleModifier *m,
-                                                     const int UNUSED(flag))
+                                                     const int /*flag*/)
 {
   LineStyleModifier *new_m;
 
@@ -1735,7 +1735,7 @@ LineStyleModifier *BKE_linestyle_geometry_modifier_add(FreestyleLineStyle *lines
 
 LineStyleModifier *BKE_linestyle_geometry_modifier_copy(FreestyleLineStyle *linestyle,
                                                         const LineStyleModifier *m,
-                                                        const int UNUSED(flag))
+                                                        const int /*flag*/)
 {
   LineStyleModifier *new_m;
 
diff --git a/source/blender/blenkernel/intern/material.cc b/source/blender/blenkernel/intern/material.cc
index 4b0508ddf20..0eb0209cc44 100644
--- a/source/blender/blenkernel/intern/material.cc
+++ b/source/blender/blenkernel/intern/material.cc
@@ -1411,7 +1411,7 @@ static bool ntree_foreach_texnode_recursive(bNodeTree *nodetree,
   return true;
 }
 
-static bool count_texture_nodes_cb(bNode *UNUSED(node), void *userdata)
+static bool count_texture_nodes_cb(bNode * /*node*/, void *userdata)
 {
   (*((int *)userdata))++;
   return true;
diff --git a/source/blender/blenkernel/intern/texture.cc b/source/blender/blenkernel/intern/texture.cc
index 712ede61160..1fb4fdf3d83 100644
--- a/source/blender/blenkernel/intern/texture.cc
+++ b/source/blender/blenkernel/intern/texture.cc
@@ -626,7 +626,7 @@ PointDensity *BKE_texture_pointdensity_add(void)
   return pd;
 }
 
-PointDensity *BKE_texture_pointdensity_copy(const PointDensity *pd, const int UNUSED(flag))
+PointDensity *BKE_texture_pointdensity_copy(const PointDensity *pd, const int /*flag*/)
 {
   PointDensity *pdn;
 
diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h
index 98177876f87..5cc91a22944 100644
--- a/source/blender/blenlib/BLI_utildefines.h
+++ b/source/blender/blenlib/BLI_utildefines.h
@@ -664,11 +664,13 @@ extern bool BLI_memory_is_zero(const void *arr, size_t arr_size);
 /** \name Unused Function/Argument Macros
  * \{ */
 
+#ifndef __cplusplus
 /* UNUSED macro, for function argument */
-#if defined(__GNUC__) || defined(__clang__)
-#  define UNUSED(x) UNUSED_##x __attribute__((__unused__))
-#else
-#  define UNUSED(x) UNUSED_##x
+#  if defined(__GNUC__) || defined(__clang__)
+#    define UNUSED(x) UNUSED_##x __attribute__((__unused__))
+#  else
+#    define UNUSED(x) UNUSED_##x
+#  endif
 #endif
 
 /**
diff --git a/source/blender/bmesh/intern/bmesh_mesh_normals.cc b/source/blender/bmesh/intern/bmesh_mesh_normals.cc
index 91658b1a87b..5d906e0a73f 100644
--- a/source/blender/bmesh/intern/bmesh_mesh_normals.cc
+++ b/source/blender/bmesh/intern/bmesh_mesh_normals.cc


@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list