[Bf-blender-cvs] [b5840f9b5ba] master: Cleanup: compiler warnings with clang

Brecht Van Lommel noreply at git.blender.org
Thu Jun 24 19:36:28 CEST 2021


Commit: b5840f9b5ba912f016db01dfcd5b28f32195c147
Author: Brecht Van Lommel
Date:   Thu Jun 24 19:17:51 2021 +0200
Branches: master
https://developer.blender.org/rBb5840f9b5ba912f016db01dfcd5b28f32195c147

Cleanup: compiler warnings with clang

* Mark either all or no class methods with override
* Don't use zero sized array since it has a different size in C and C++.
  Using a little more memory here is not significant.
* Don't use deprecated mechanism to mark private GSet members in clang
  just like we don't for MSVC, it warns even for simple zero initialization.

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

M	intern/ghost/intern/GHOST_System.h
M	source/blender/blenkernel/BKE_spline.hh
M	source/blender/blenlib/BLI_ghash.h
M	source/blender/editors/space_outliner/tree/tree_element_overrides.cc
M	source/blender/editors/space_outliner/tree/tree_element_overrides.hh
M	source/blender/editors/transform/transform_convert_sequencer.c
M	source/blender/gpu/GPU_viewport.h

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

diff --git a/intern/ghost/intern/GHOST_System.h b/intern/ghost/intern/GHOST_System.h
index 9915520691f..279f90b9641 100644
--- a/intern/ghost/intern/GHOST_System.h
+++ b/intern/ghost/intern/GHOST_System.h
@@ -239,7 +239,7 @@ class GHOST_System : public GHOST_ISystem {
    * Set which tablet API to use. Only affects Windows, other platforms have a single API.
    * \param api: Enum indicating which API to use.
    */
-  virtual void setTabletAPI(GHOST_TTabletAPI api) override;
+  virtual void setTabletAPI(GHOST_TTabletAPI api);
   GHOST_TTabletAPI getTabletAPI(void);
 
 #ifdef WITH_INPUT_NDOF
diff --git a/source/blender/blenkernel/BKE_spline.hh b/source/blender/blenkernel/BKE_spline.hh
index 24b5a78e598..0de9270bde1 100644
--- a/source/blender/blenkernel/BKE_spline.hh
+++ b/source/blender/blenkernel/BKE_spline.hh
@@ -328,7 +328,8 @@ class BezierSpline final : public Spline {
   };
   InterpolationData interpolation_data_from_index_factor(const float index_factor) const;
 
-  virtual blender::fn::GVArrayPtr interpolate_to_evaluated(const blender::fn::GVArray &src) const;
+  virtual blender::fn::GVArrayPtr interpolate_to_evaluated(
+      const blender::fn::GVArray &src) const override;
 
   void evaluate_segment(const int index,
                         const int next_index,
diff --git a/source/blender/blenlib/BLI_ghash.h b/source/blender/blenlib/BLI_ghash.h
index bc517f81955..b53b8a433d2 100644
--- a/source/blender/blenlib/BLI_ghash.h
+++ b/source/blender/blenlib/BLI_ghash.h
@@ -234,7 +234,7 @@ void *BLI_gset_pop_key(GSet *gs, const void *key) ATTR_WARN_UNUSED_RESULT;
 /* so we can cast but compiler sees as different */
 typedef struct GSetIterator {
   GHashIterator _ghi
-#ifdef __GNUC__
+#if defined(__GNUC__) && !defined(__clang__)
       __attribute__((deprecated))
 #endif
       ;
diff --git a/source/blender/editors/space_outliner/tree/tree_element_overrides.cc b/source/blender/editors/space_outliner/tree/tree_element_overrides.cc
index c5d254242c6..731beb3956e 100644
--- a/source/blender/editors/space_outliner/tree/tree_element_overrides.cc
+++ b/source/blender/editors/space_outliner/tree/tree_element_overrides.cc
@@ -94,9 +94,7 @@ void TreeElementOverridesBase::expand(SpaceOutliner &space_outliner) const
 
 TreeElementOverridesProperty::TreeElementOverridesProperty(TreeElement &legacy_te,
                                                            TreeElementOverridesData &override_data)
-    : AbstractTreeElement(legacy_te),
-      id_(override_data.id),
-      override_prop_(override_data.override_property)
+    : AbstractTreeElement(legacy_te), override_prop_(override_data.override_property)
 {
   BLI_assert(legacy_te.store_elem->type == TSE_LIBRARY_OVERRIDE);
 
diff --git a/source/blender/editors/space_outliner/tree/tree_element_overrides.hh b/source/blender/editors/space_outliner/tree/tree_element_overrides.hh
index c3caab8e268..0067db6ea56 100644
--- a/source/blender/editors/space_outliner/tree/tree_element_overrides.hh
+++ b/source/blender/editors/space_outliner/tree/tree_element_overrides.hh
@@ -40,7 +40,6 @@ class TreeElementOverridesBase final : public AbstractTreeElement {
 };
 
 class TreeElementOverridesProperty final : public AbstractTreeElement {
-  ID &id_;
   IDOverrideLibraryProperty &override_prop_;
 
  public:
diff --git a/source/blender/editors/transform/transform_convert_sequencer.c b/source/blender/editors/transform/transform_convert_sequencer.c
index 6a23b10b079..2cb0e3c8589 100644
--- a/source/blender/editors/transform/transform_convert_sequencer.c
+++ b/source/blender/editors/transform/transform_convert_sequencer.c
@@ -465,7 +465,7 @@ static void freeSeqData(TransInfo *t, TransDataContainer *tc, TransCustomData *c
 
   SeqCollection *transformed_strips = seq_transform_collection_from_transdata(tc);
 
-  if ((t->state == TRANS_CANCEL)) {
+  if (t->state == TRANS_CANCEL) {
     seq_transform_cancel(t, transformed_strips);
     free_transform_custom_data(custom_data);
     return;
diff --git a/source/blender/gpu/GPU_viewport.h b/source/blender/gpu/GPU_viewport.h
index 095e17f344e..d6c544764fb 100644
--- a/source/blender/gpu/GPU_viewport.h
+++ b/source/blender/gpu/GPU_viewport.h
@@ -62,21 +62,21 @@ typedef struct ViewportMemoryPool {
   uint ubo_len;
 } ViewportMemoryPool;
 
-/* All FramebufferLists are just the same pointers with different names */
+/*eAll FramebufferLists are just the same pointers with different names */
 typedef struct FramebufferList {
-  struct GPUFrameBuffer *framebuffers[0];
+  struct GPUFrameBuffer *framebuffers[1];
 } FramebufferList;
 
 typedef struct TextureList {
-  struct GPUTexture *textures[0];
+  struct GPUTexture *textures[1];
 } TextureList;
 
 typedef struct PassList {
-  struct DRWPass *passes[0];
+  struct DRWPass *passes[1];
 } PassList;
 
 typedef struct StorageList {
-  void *storage[0]; /* custom structs from the engine */
+  void *storage[1]; /* custom structs from the engine */
 } StorageList;
 
 typedef struct ViewportEngineData {



More information about the Bf-blender-cvs mailing list