Begin addressing clang warnings on windows
Diffs=
d8fcaec01 Begin addressing clang warnings on windows
diff --git a/.rive_head b/.rive_head
index 5fbc7e8..84fc2dd 100644
--- a/.rive_head
+++ b/.rive_head
@@ -1 +1 @@
-7003092f363cde9c61c4ad30d8cccbfe58bba73d
+d8fcaec0186f40bd93b19dbc310915d0c616fc23
diff --git a/build/premake5.lua b/build/premake5.lua
index cf92cf3..dcd92fd 100644
--- a/build/premake5.lua
+++ b/build/premake5.lua
@@ -4,55 +4,23 @@
WINDOWS_CLANG_CL_SUPPRESSED_WARNINGS = {
"-Wno-c++98-compat",
"-Wno-c++98-compat-pedantic",
- "-Wno-reserved-macro-identifier",
- "-Wno-newline-eof",
- "-Wno-old-style-cast",
- "-Wno-unused-parameter",
- "-Wno-float-equal",
- "-Wno-implicit-float-conversion",
- "-Wno-shadow",
- "-Wno-sign-conversion",
- "-Wno-inconsistent-missing-destructor-override",
- "-Wno-nested-anon-types",
- "-Wno-suggest-destructor-override",
- "-Wno-non-virtual-dtor",
- "-Wno-unknown-argument",
- "-Wno-gnu-anonymous-struct",
- "-Wno-extra-semi",
- "-Wno-cast-qual",
- "-Wno-ignored-qualifiers",
- "-Wno-double-promotion",
- "-Wno-tautological-unsigned-zero-compare",
- "-Wno-unreachable-code-break",
- "-Wno-global-constructors",
- "-Wno-switch-enum",
- "-Wno-shorten-64-to-32",
- "-Wno-missing-prototypes",
- "-Wno-implicit-int-conversion",
- "-Wno-unused-macros",
"-Wno-deprecated-copy-with-user-provided-dtor",
- "-Wno-missing-variable-declarations",
- "-Wno-ctad-maybe-unsupported",
- "-Wno-vla-extension",
- "-Wno-float-conversion",
- "-Wno-gnu-zero-variadic-macro-arguments",
- "-Wno-undef",
"-Wno-documentation",
"-Wno-documentation-pedantic",
"-Wno-documentation-unknown-command",
- "-Wno-suggest-override",
- "-Wno-unused-exception-parameter",
- "-Wno-cast-align",
- "-Wno-deprecated-declarations",
- "-Wno-shadow-field",
- "-Wno-nonportable-system-include-path",
- "-Wno-reserved-identifier",
- "-Wno-thread-safety-negative",
+ "-Wno-double-promotion",
"-Wno-exit-time-destructors",
- "-Wno-unreachable-code",
- "-Wno-zero-as-null-pointer-constant",
- "-Wno-pedantic",
+ "-Wno-float-equal",
+ "-Wno-global-constructors",
+ "-Wno-implicit-float-conversion",
+ "-Wno-newline-eof",
+ "-Wno-old-style-cast",
+ "-Wno-reserved-identifier",
+ "-Wno-shadow",
"-Wno-sign-compare",
+ "-Wno-sign-conversion",
+ "-Wno-unused-macros",
+ "-Wno-unused-parameter",
}
project "rive"
@@ -89,9 +57,14 @@
filter "system:windows"
architecture "x64"
defines {"_USE_MATH_DEFINES"}
+ flags { "FatalCompileWarnings" }
buildoptions {WINDOWS_CLANG_CL_SUPPRESSED_WARNINGS}
staticruntime "on" -- Match Skia's /MT flag for link compatibility
runtime "Release" -- Use /MT even in debug (/MTd is incompatible with Skia)
+ removebuildoptions {
+ "-fno-exceptions",
+ "-fno-rtti",
+ }
filter {"system:ios", "options:variant=system" }
buildoptions {"-mios-version-min=10.0 -fembed-bitcode -arch armv7 -arch arm64 -arch arm64e -isysroot " .. (os.getenv("IOS_SYSROOT") or "")}
diff --git a/include/rive/animation/blend_state.hpp b/include/rive/animation/blend_state.hpp
index 4673d6b..67f62de 100644
--- a/include/rive/animation/blend_state.hpp
+++ b/include/rive/animation/blend_state.hpp
@@ -17,7 +17,7 @@
void addAnimation(BlendAnimation* animation);
public:
- ~BlendState();
+ ~BlendState() override;
inline const std::vector<BlendAnimation*>& animations() const { return m_Animations; }
#ifdef TESTING
diff --git a/include/rive/animation/keyed_object.hpp b/include/rive/animation/keyed_object.hpp
index 39fab61..407b4bc 100644
--- a/include/rive/animation/keyed_object.hpp
+++ b/include/rive/animation/keyed_object.hpp
@@ -11,7 +11,7 @@
public:
KeyedObject();
- ~KeyedObject();
+ ~KeyedObject() override;
void addKeyedProperty(std::unique_ptr<KeyedProperty>);
StatusCode onAddedDirty(CoreContext* context) override;
diff --git a/include/rive/animation/keyed_property.hpp b/include/rive/animation/keyed_property.hpp
index 29aaebd..805277b 100644
--- a/include/rive/animation/keyed_property.hpp
+++ b/include/rive/animation/keyed_property.hpp
@@ -10,7 +10,7 @@
public:
KeyedProperty();
- ~KeyedProperty();
+ ~KeyedProperty() override;
void addKeyFrame(std::unique_ptr<KeyFrame>);
StatusCode onAddedClean(CoreContext* context) override;
StatusCode onAddedDirty(CoreContext* context) override;
diff --git a/include/rive/animation/layer_state.hpp b/include/rive/animation/layer_state.hpp
index 6e9b20b..dc174de 100644
--- a/include/rive/animation/layer_state.hpp
+++ b/include/rive/animation/layer_state.hpp
@@ -20,7 +20,7 @@
void addTransition(StateTransition* transition);
public:
- ~LayerState();
+ ~LayerState() override;
StatusCode onAddedDirty(CoreContext* context) override;
StatusCode onAddedClean(CoreContext* context) override;
diff --git a/include/rive/animation/state_machine.hpp b/include/rive/animation/state_machine.hpp
index ca6b5eb..cebef92 100644
--- a/include/rive/animation/state_machine.hpp
+++ b/include/rive/animation/state_machine.hpp
@@ -23,7 +23,7 @@
public:
StateMachine();
- ~StateMachine();
+ ~StateMachine() override;
StatusCode import(ImportStack& importStack) override;
diff --git a/include/rive/animation/state_machine_instance.hpp b/include/rive/animation/state_machine_instance.hpp
index a2c6a20..ea74871 100644
--- a/include/rive/animation/state_machine_instance.hpp
+++ b/include/rive/animation/state_machine_instance.hpp
@@ -65,7 +65,7 @@
SMINumber* getNumber(const std::string& name) const override;
SMITrigger* getTrigger(const std::string& name) const override;
- const size_t currentAnimationCount() const;
+ size_t currentAnimationCount() const;
const LinearAnimationInstance* currentAnimationByIndex(size_t index) const;
// The number of state changes that occurred across all layers on the
diff --git a/include/rive/animation/state_machine_layer.hpp b/include/rive/animation/state_machine_layer.hpp
index 8de9443..e7c4d49 100644
--- a/include/rive/animation/state_machine_layer.hpp
+++ b/include/rive/animation/state_machine_layer.hpp
@@ -22,7 +22,7 @@
void addState(LayerState* state);
public:
- ~StateMachineLayer();
+ ~StateMachineLayer() override;
StatusCode onAddedDirty(CoreContext* context) override;
StatusCode onAddedClean(CoreContext* context) override;
diff --git a/include/rive/animation/state_transition.hpp b/include/rive/animation/state_transition.hpp
index 90fa07f..57c82f5 100644
--- a/include/rive/animation/state_transition.hpp
+++ b/include/rive/animation/state_transition.hpp
@@ -31,7 +31,7 @@
void addCondition(TransitionCondition* condition);
public:
- ~StateTransition();
+ ~StateTransition() override;
const LayerState* stateTo() const { return m_StateTo; }
StatusCode onAddedDirty(CoreContext* context) override;
diff --git a/include/rive/artboard.hpp b/include/rive/artboard.hpp
index d466c81..3aa40d9 100644
--- a/include/rive/artboard.hpp
+++ b/include/rive/artboard.hpp
@@ -64,7 +64,7 @@
public:
Artboard() {}
- ~Artboard();
+ ~Artboard() override;
StatusCode initialize();
Core* resolve(uint32_t id) const override;
diff --git a/include/rive/assets/file_asset_referencer.hpp b/include/rive/assets/file_asset_referencer.hpp
index 7fc02d5..c7c285f 100644
--- a/include/rive/assets/file_asset_referencer.hpp
+++ b/include/rive/assets/file_asset_referencer.hpp
@@ -5,6 +5,7 @@
class FileAsset;
class FileAssetReferencer {
public:
+ virtual ~FileAssetReferencer() {}
virtual void assets(const std::vector<FileAsset*>& assets) = 0;
};
} // namespace rive
diff --git a/include/rive/assets/image_asset.hpp b/include/rive/assets/image_asset.hpp
index 9386fcf..4e03568 100644
--- a/include/rive/assets/image_asset.hpp
+++ b/include/rive/assets/image_asset.hpp
@@ -12,7 +12,7 @@
public:
ImageAsset() {}
- ~ImageAsset();
+ ~ImageAsset() override;
#ifdef TESTING
std::size_t decodedByteSize = 0;
diff --git a/include/rive/bones/skin.hpp b/include/rive/bones/skin.hpp
index 1ad264d..8d947d5 100644
--- a/include/rive/bones/skin.hpp
+++ b/include/rive/bones/skin.hpp
@@ -15,7 +15,7 @@
friend class Tendon;
public:
- ~Skin();
+ ~Skin() override;
private:
Mat2D m_WorldTransform;
diff --git a/include/rive/bones/skinnable.hpp b/include/rive/bones/skinnable.hpp
index d71aa38..136ba08 100644
--- a/include/rive/bones/skinnable.hpp
+++ b/include/rive/bones/skinnable.hpp
@@ -17,6 +17,8 @@
void skin(Skin* skin);
public:
+ virtual ~Skinnable() {}
+
Skin* skin() const { return m_Skin; }
virtual void markSkinDirty() = 0;
diff --git a/include/rive/core_context.hpp b/include/rive/core_context.hpp
index 76ed0b2..1183d2e 100644
--- a/include/rive/core_context.hpp
+++ b/include/rive/core_context.hpp
@@ -8,6 +8,7 @@
class Core;
class CoreContext {
public:
+ virtual ~CoreContext() {}
virtual Core* resolve(uint32_t id) const = 0;
};
} // namespace rive
diff --git a/include/rive/drawable.hpp b/include/rive/drawable.hpp
index 99fde46..783154e 100644
--- a/include/rive/drawable.hpp
+++ b/include/rive/drawable.hpp
@@ -31,7 +31,7 @@
return m_ClippingShapes;
}
- const inline bool isHidden() const {
+ inline bool isHidden() const {
// For now we have a single drawable flag, when we have more we can
// make an actual enum for this.
return (drawableFlags() & 0x1) == 0x1;
diff --git a/include/rive/file_asset_resolver.hpp b/include/rive/file_asset_resolver.hpp
index 64fdebb..1f9c86c 100644
--- a/include/rive/file_asset_resolver.hpp
+++ b/include/rive/file_asset_resolver.hpp
@@ -8,6 +8,8 @@
class FileAsset;
class FileAssetResolver {
public:
+ virtual ~FileAssetResolver() {}
+
/// Expected to be overridden to find asset contents when not provided
/// in band.
/// @param asset describes the asset that Rive is looking for the
diff --git a/include/rive/importers/linear_animation_importer.hpp b/include/rive/importers/linear_animation_importer.hpp
index 80cb13f..09f0ba3 100644
--- a/include/rive/importers/linear_animation_importer.hpp
+++ b/include/rive/importers/linear_animation_importer.hpp
@@ -12,7 +12,7 @@
LinearAnimation* m_Animation;
public:
- LinearAnimation* animation() const { return m_Animation; };
+ LinearAnimation* animation() const { return m_Animation; }
LinearAnimationImporter(LinearAnimation* animation);
void addKeyedObject(std::unique_ptr<KeyedObject>);
};
diff --git a/include/rive/nested_artboard.hpp b/include/rive/nested_artboard.hpp
index 1025d7f..6eeffac 100644
--- a/include/rive/nested_artboard.hpp
+++ b/include/rive/nested_artboard.hpp
@@ -18,7 +18,7 @@
public:
NestedArtboard();
- ~NestedArtboard();
+ ~NestedArtboard() override;
StatusCode onAddedClean(CoreContext* context) override;
void draw(Renderer* renderer) override;
Core* hitTest(HitInfo*, const Mat2D&) override;
diff --git a/include/rive/shapes/paint/shape_paint_mutator.hpp b/include/rive/shapes/paint/shape_paint_mutator.hpp
index dea8ae5..7cabfab 100644
--- a/include/rive/shapes/paint/shape_paint_mutator.hpp
+++ b/include/rive/shapes/paint/shape_paint_mutator.hpp
@@ -22,6 +22,8 @@
virtual bool internalIsTranslucent() const = 0;
public:
+ virtual ~ShapePaintMutator() {}
+
float renderOpacity() const { return m_RenderOpacity; }
void renderOpacity(float value);
diff --git a/include/rive/shapes/paint/stroke_effect.hpp b/include/rive/shapes/paint/stroke_effect.hpp
index 1db1423..368f4a9 100644
--- a/include/rive/shapes/paint/stroke_effect.hpp
+++ b/include/rive/shapes/paint/stroke_effect.hpp
@@ -10,6 +10,7 @@
class StrokeEffect {
public:
+ virtual ~StrokeEffect() {}
virtual RenderPath* effectPath(MetricsPath* source, Factory*) = 0;
virtual void invalidateEffect() = 0;
};
diff --git a/include/rive/shapes/polygon.hpp b/include/rive/shapes/polygon.hpp
index 97012bd..41b9a9d 100644
--- a/include/rive/shapes/polygon.hpp
+++ b/include/rive/shapes/polygon.hpp
@@ -11,7 +11,7 @@
public:
Polygon();
- ~Polygon();
+ ~Polygon() override;
void update(ComponentDirt value) override;
protected:
diff --git a/include/rive/shapes/shape.hpp b/include/rive/shapes/shape.hpp
index 8caf7f8..1ffdc40 100644
--- a/include/rive/shapes/shape.hpp
+++ b/include/rive/shapes/shape.hpp
@@ -33,7 +33,8 @@
Core* hitTest(HitInfo*, const Mat2D&) override;
bool hitTest(const IAABB& area) const;
- PathComposer* pathComposer() const { return (PathComposer*)&m_PathComposer; }
+ const PathComposer* pathComposer() const { return &m_PathComposer; }
+ PathComposer* pathComposer() { return &m_PathComposer; }
void pathChanged();
void addDefaultPathSpace(PathSpace space);
diff --git a/include/rive/shapes/shape_paint_container.hpp b/include/rive/shapes/shape_paint_container.hpp
index b9ca453..0404f3f 100644
--- a/include/rive/shapes/shape_paint_container.hpp
+++ b/include/rive/shapes/shape_paint_container.hpp
@@ -27,6 +27,8 @@
public:
static ShapePaintContainer* from(Component* component);
+ virtual ~ShapePaintContainer() {}
+
PathSpace pathSpace() const;
void invalidateStrokeEffects();
diff --git a/src/animation/state_machine_instance.cpp b/src/animation/state_machine_instance.cpp
index a956b8c..56ca5a5 100644
--- a/src/animation/state_machine_instance.cpp
+++ b/src/animation/state_machine_instance.cpp
@@ -306,7 +306,8 @@
case ListenerType::move:
nestedStateMachine->pointerMove(nestedPosition);
break;
- default:
+ case ListenerType::enter:
+ case ListenerType::exit:
break;
}
}
@@ -480,7 +481,7 @@
return nullptr;
}
-const size_t StateMachineInstance::currentAnimationCount() const {
+size_t StateMachineInstance::currentAnimationCount() const {
size_t count = 0;
for (size_t i = 0; i < m_LayerCount; i++) {
if (m_Layers[i].currentAnimation() != nullptr) {
diff --git a/src/bones/skinnable.cpp b/src/bones/skinnable.cpp
index 781267b..5725944 100644
--- a/src/bones/skinnable.cpp
+++ b/src/bones/skinnable.cpp
@@ -8,10 +8,8 @@
switch (component->coreType()) {
case PointsPath::typeKey:
return component->as<PointsPath>();
- break;
case Mesh::typeKey:
return component->as<Mesh>();
- break;
}
return nullptr;
}
diff --git a/src/constraints/distance_constraint.cpp b/src/constraints/distance_constraint.cpp
index a4fb340..0248d9a 100644
--- a/src/constraints/distance_constraint.cpp
+++ b/src/constraints/distance_constraint.cpp
@@ -29,7 +29,7 @@
return;
}
break;
- default:
+ case Mode::Exact:
break;
}
if (currentDistance < 0.001f) {
diff --git a/src/shapes/points_path.cpp b/src/shapes/points_path.cpp
index dcdc0a5..a902f5a 100644
--- a/src/shapes/points_path.cpp
+++ b/src/shapes/points_path.cpp
@@ -6,7 +6,6 @@
using namespace rive;
-Mat2D identity;
void PointsPath::buildDependencies() {
Super::buildDependencies();
if (skin() != nullptr) {
@@ -16,6 +15,7 @@
const Mat2D& PointsPath::pathTransform() const {
if (skin() != nullptr) {
+ static Mat2D identity;
return identity;
}
return worldTransform();
diff --git a/src/shapes/shape_paint_container.cpp b/src/shapes/shape_paint_container.cpp
index 8dd83da..f421fbf 100644
--- a/src/shapes/shape_paint_container.cpp
+++ b/src/shapes/shape_paint_container.cpp
@@ -14,10 +14,8 @@
switch (component->coreType()) {
case Artboard::typeKey:
return component->as<Artboard>();
- break;
case Shape::typeKey:
return component->as<Shape>();
- break;
}
return nullptr;
}