Fix a lot of warnings and some errors

This commit is contained in:
Jérôme Leclercq 2020-09-26 11:44:09 +02:00
parent 267bd74a97
commit 65337c6a38
30 changed files with 78 additions and 65 deletions

View File

@ -17,6 +17,8 @@ namespace Nz
{
public:
AbstractLogger() = default;
AbstractLogger(const AbstractLogger&) = default;
AbstractLogger(AbstractLogger&&) noexcept = default;
virtual ~AbstractLogger();
virtual void EnableStdReplication(bool enable) = 0;
@ -25,6 +27,9 @@ namespace Nz
virtual void Write(const std::string_view& string) = 0;
virtual void WriteError(ErrorType type, const std::string_view& error, unsigned int line = 0, const char* file = nullptr, const char* function = nullptr);
AbstractLogger& operator=(const AbstractLogger&) = default;
AbstractLogger& operator=(AbstractLogger&&) noexcept = default;
};
}

View File

@ -19,8 +19,8 @@ namespace Nz
{
public:
FileLogger(std::filesystem::path logPath = "NazaraLog.log");
FileLogger(const FileLogger&) = default;
FileLogger(FileLogger&&) = default;
FileLogger(const FileLogger&) = delete;
FileLogger(FileLogger&&) noexcept = default;
~FileLogger();
void EnableTimeLogging(bool enable);
@ -32,8 +32,8 @@ namespace Nz
void Write(const std::string_view& string) override;
void WriteError(ErrorType type, const std::string_view& error, unsigned int line = 0, const char* file = nullptr, const char* function = nullptr) override;
FileLogger& operator=(const FileLogger&) = default;
FileLogger& operator=(FileLogger&&) = default;
FileLogger& operator=(const FileLogger&) = delete;
FileLogger& operator=(FileLogger&&) noexcept = default;
private:
std::fstream m_outputFile;

View File

@ -31,7 +31,7 @@ namespace Nz
inline OpenGLCommandBuffer();
inline OpenGLCommandBuffer(OpenGLCommandPool& owner, std::size_t poolIndex, std::size_t bindingIndex);
OpenGLCommandBuffer(const OpenGLCommandBuffer&) = delete;
OpenGLCommandBuffer(OpenGLCommandBuffer&&) noexcept = default;
OpenGLCommandBuffer(OpenGLCommandBuffer&&) = delete;
~OpenGLCommandBuffer() = default;
inline void BeginDebugRegion(const std::string_view& regionName, const Nz::Color& color);

View File

@ -20,8 +20,8 @@ namespace Nz
{
public:
inline OpenGLShaderBinding(OpenGLRenderPipelineLayout& owner, std::size_t poolIndex, std::size_t bindingIndex);
OpenGLShaderBinding(const OpenGLShaderBinding&) = default;
OpenGLShaderBinding(OpenGLShaderBinding&&) = default;
OpenGLShaderBinding(const OpenGLShaderBinding&) = delete;
OpenGLShaderBinding(OpenGLShaderBinding&&) = delete;
~OpenGLShaderBinding() = default;
void Apply(const GL::Context& context) const;

View File

@ -19,8 +19,8 @@ namespace Nz
{
public:
OpenGLTexture(OpenGLDevice& device, const TextureInfo& params);
OpenGLTexture(const OpenGLTexture&) = default;
OpenGLTexture(OpenGLTexture&&) noexcept = default;
OpenGLTexture(const OpenGLTexture&) = delete;
OpenGLTexture(OpenGLTexture&&) = delete;
~OpenGLTexture() = default;
PixelFormat GetFormat() const override;

View File

@ -18,8 +18,8 @@ namespace Nz
{
public:
OpenGLTextureSampler(OpenGLDevice& device, const TextureSamplerInfo& samplerInfo);
OpenGLTextureSampler(const OpenGLTextureSampler&) = default;
OpenGLTextureSampler(OpenGLTextureSampler&&) noexcept = default;
OpenGLTextureSampler(const OpenGLTextureSampler&) = delete;
OpenGLTextureSampler(OpenGLTextureSampler&&) = delete;
~OpenGLTextureSampler() = default;
inline const GL::Sampler& GetSampler(bool mipmaps) const;

View File

@ -25,7 +25,7 @@ namespace Nz
void Activate() const override;
OpenGLWindowFramebuffer& operator=(const OpenGLWindowFramebuffer&) = delete;
OpenGLWindowFramebuffer& operator=(OpenGLWindowFramebuffer&&) noexcept = default;
OpenGLWindowFramebuffer& operator=(OpenGLWindowFramebuffer&&) = delete;
private:
OpenGLRenderWindow& m_renderWindow;

View File

@ -19,14 +19,14 @@ namespace Nz
{
public:
ShaderAstCloner() = default;
ShaderAstCloner(const ShaderAstCloner&) = default;
ShaderAstCloner(ShaderAstCloner&&) = default;
ShaderAstCloner(const ShaderAstCloner&) = delete;
ShaderAstCloner(ShaderAstCloner&&) = delete;
~ShaderAstCloner() = default;
ShaderNodes::StatementPtr Clone(const ShaderNodes::StatementPtr& statement);
ShaderAstCloner& operator=(const ShaderAstCloner&) = default;
ShaderAstCloner& operator=(ShaderAstCloner&&) = default;
ShaderAstCloner& operator=(const ShaderAstCloner&) = delete;
ShaderAstCloner& operator=(ShaderAstCloner&&) = delete;
protected:
ShaderNodes::ExpressionPtr CloneExpression(const ShaderNodes::ExpressionPtr& expr);

View File

@ -42,6 +42,9 @@ namespace Nz
virtual void Visit(ShaderNodes::StatementBlock& node) = 0;
virtual void Visit(ShaderNodes::SwizzleOp& node) = 0;
ShaderAstVisitor& operator=(const ShaderAstVisitor&) = delete;
ShaderAstVisitor& operator=(ShaderAstVisitor&&) = delete;
private:
std::unordered_set<std::string> m_conditions;
};

View File

@ -29,6 +29,9 @@ namespace Nz
virtual void Visit(ShaderNodes::OutputVariable& var) = 0;
virtual void Visit(ShaderNodes::ParameterVariable& var) = 0;
virtual void Visit(ShaderNodes::UniformVariable& var) = 0;
ShaderVarVisitor& operator=(const ShaderVarVisitor&) = delete;
ShaderVarVisitor& operator=(ShaderVarVisitor&&) = delete;
};
}

View File

@ -172,7 +172,7 @@ namespace Nz
public:
BlockRef(const BlockRef&) = default;
BlockRef(BlockRef&&) = default;
BlockRef(BlockRef&&) = delete;
~BlockRef() = default;
inline float GetCharacterSpacingOffset() const;
@ -196,8 +196,8 @@ namespace Nz
inline void SetStyle(TextStyleFlags style);
inline void SetText(std::string text);
BlockRef& operator=(const BlockRef&) = default;
BlockRef& operator=(BlockRef&&) = default;
BlockRef& operator=(const BlockRef&) = delete;
BlockRef& operator=(BlockRef&&) = delete;
private:
inline BlockRef(RichTextDrawer& drawer, std::size_t index);

View File

@ -23,7 +23,7 @@ namespace Nz
inline VulkanCommandBuffer(VulkanCommandPool& owner, std::size_t poolIndex, std::size_t bindingIndex, Vk::AutoCommandBuffer commandBuffer);
inline VulkanCommandBuffer(VulkanCommandPool& owner, std::size_t poolIndex, std::size_t bindingIndex, std::vector<Vk::AutoCommandBuffer> commandBuffers);
VulkanCommandBuffer(const VulkanCommandBuffer&) = delete;
VulkanCommandBuffer(VulkanCommandBuffer&&) noexcept = default;
VulkanCommandBuffer(VulkanCommandBuffer&&) = delete;
~VulkanCommandBuffer() = default;
inline std::size_t GetBindingIndex() const;

View File

@ -44,7 +44,6 @@ namespace Nz
std::vector<Vk::PhysicalDevice> m_physDevices;
ParameterList m_initializationParameters;
Vk::Instance m_instance;
UInt32 m_apiVersion;
};
}

View File

@ -19,8 +19,8 @@ namespace Nz
{
public:
inline VulkanShaderBinding(VulkanRenderPipelineLayout& owner, std::size_t poolIndex, std::size_t bindingIndex, Vk::DescriptorSet descriptorSet);
VulkanShaderBinding(const VulkanShaderBinding&) = default;
VulkanShaderBinding(VulkanShaderBinding&&) noexcept = default;
VulkanShaderBinding(const VulkanShaderBinding&) = delete;
VulkanShaderBinding(VulkanShaderBinding&&) = delete;
~VulkanShaderBinding() = default;
inline std::size_t GetBindingIndex() const;

View File

@ -20,7 +20,7 @@ namespace Nz
public:
VulkanShaderStage() = default;
VulkanShaderStage(const VulkanShaderStage&) = delete;
VulkanShaderStage(VulkanShaderStage&&) noexcept = default;
VulkanShaderStage(VulkanShaderStage&&) = delete;
~VulkanShaderStage() = default;
bool Create(Vk::Device& device, ShaderStageType type, ShaderLanguage lang, const void* source, std::size_t sourceSize);
@ -29,7 +29,7 @@ namespace Nz
inline ShaderStageType GetStageType() const;
VulkanShaderStage& operator=(const VulkanShaderStage&) = delete;
VulkanShaderStage& operator=(VulkanShaderStage&&) noexcept = default;
VulkanShaderStage& operator=(VulkanShaderStage&&) = delete;
private:
Vk::ShaderModule m_shaderModule;

View File

@ -16,14 +16,14 @@ namespace Nz
public:
inline VulkanSingleFramebuffer(Vk::Framebuffer renderPass);
VulkanSingleFramebuffer(const VulkanSingleFramebuffer&) = delete;
VulkanSingleFramebuffer(VulkanSingleFramebuffer&&) noexcept = default;
VulkanSingleFramebuffer(VulkanSingleFramebuffer&&) = delete;
~VulkanSingleFramebuffer() = default;
inline Vk::Framebuffer& GetFramebuffer();
inline const Vk::Framebuffer& GetFramebuffer() const;
VulkanSingleFramebuffer& operator=(const VulkanSingleFramebuffer&) = delete;
VulkanSingleFramebuffer& operator=(VulkanSingleFramebuffer&&) noexcept = default;
VulkanSingleFramebuffer& operator=(VulkanSingleFramebuffer&&) = delete;
private:
Vk::Framebuffer m_framebuffer;

View File

@ -19,8 +19,8 @@ namespace Nz
{
public:
VulkanTexture(Vk::Device& device, const TextureInfo& params);
VulkanTexture(const VulkanTexture&) = default;
VulkanTexture(VulkanTexture&&) noexcept = default;
VulkanTexture(const VulkanTexture&) = delete;
VulkanTexture(VulkanTexture&&) = delete;
~VulkanTexture();
PixelFormat GetFormat() const override;

View File

@ -17,8 +17,8 @@ namespace Nz
{
public:
VulkanTextureSampler(Vk::Device& device, TextureSamplerInfo samplerInfo);
VulkanTextureSampler(const VulkanTextureSampler&) = default;
VulkanTextureSampler(VulkanTextureSampler&&) noexcept = default;
VulkanTextureSampler(const VulkanTextureSampler&) = delete;
VulkanTextureSampler(VulkanTextureSampler&&) = delete;
~VulkanTextureSampler() = default;
inline VkSampler GetSampler() const;

View File

@ -89,9 +89,13 @@ namespace Nz
{
if (m_device->vkSetDebugUtilsObjectNameEXT)
{
VkDebugUtilsObjectNameInfoEXT debugName = { VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT };
debugName.objectType = ObjectType;
debugName.pObjectName = name;
VkDebugUtilsObjectNameInfoEXT debugName = {
VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT,
nullptr,
ObjectType,
0,
name
};
if constexpr (std::is_pointer_v<VkType>)
debugName.objectHandle = static_cast<UInt64>(reinterpret_cast<std::uintptr_t>(m_handle));

View File

@ -27,7 +27,6 @@ namespace Nz
for (Block& block : m_blocks)
{
UInt64 alignedOffset = block.freeOffset;
if (block.freeOffset + size > m_blockSize)
continue; //< Not enough space

View File

@ -418,7 +418,7 @@ namespace Nz
}
else
{
handler->beginFunc = [](cpArbiter* arb, cpSpace* space, void*) -> cpBool
handler->beginFunc = [](cpArbiter*, cpSpace*, void*) -> cpBool
{
return cpTrue;
};
@ -444,7 +444,7 @@ namespace Nz
}
else
{
handler->separateFunc = [](cpArbiter* arb, cpSpace* space, void*)
handler->separateFunc = [](cpArbiter*, cpSpace*, void*)
{
};
}
@ -472,7 +472,7 @@ namespace Nz
}
else
{
handler->preSolveFunc = [](cpArbiter* arb, cpSpace* space, void* data) -> cpBool
handler->preSolveFunc = [](cpArbiter*, cpSpace*, void*) -> cpBool
{
return cpTrue;
};
@ -498,7 +498,7 @@ namespace Nz
}
else
{
handler->postSolveFunc = [](cpArbiter* arb, cpSpace* space, void* data)
handler->postSolveFunc = [](cpArbiter*, cpSpace*, void*)
{
};
}

View File

@ -183,7 +183,7 @@ namespace Nz
{
using CallbackType = decltype(callback);
auto RealCallback = [](cpBody* body, cpArbiter* arbiter, void* data)
auto RealCallback = [](cpBody* /*body*/, cpArbiter* arbiter, void* data)
{
CallbackType& cb = *static_cast<CallbackType*>(data);
@ -399,7 +399,6 @@ namespace Nz
m_geom->GenerateShapes(this, &m_shapes);
cpSpace* space = m_world->GetHandle();
for (cpShape* shape : m_shapes)
cpShapeSetUserData(shape, this);
@ -643,7 +642,6 @@ namespace Nz
{
UnregisterFromSpace();
cpSpace* space = m_world->GetHandle();
for (cpShape* shape : m_shapes)
cpShapeFree(shape);

View File

@ -11,8 +11,8 @@
namespace Nz
{
PhysWorld3D::PhysWorld3D() :
m_gravity(Vector3f::Zero()),
m_maxStepCount(50),
m_gravity(Vector3f::Zero()),
m_stepSize(0.005f),
m_timestepAccumulator(0.f)
{
@ -159,7 +159,7 @@ namespace Nz
}
}
int PhysWorld3D::OnAABBOverlap(const NewtonJoint* const contactJoint, float timestep, int threadIndex)
int PhysWorld3D::OnAABBOverlap(const NewtonJoint* const contactJoint, float /*timestep*/, int /*threadIndex*/)
{
RigidBody3D* bodyA = static_cast<RigidBody3D*>(NewtonBodyGetUserData(NewtonJointGetBody0(contactJoint)));
RigidBody3D* bodyB = static_cast<RigidBody3D*>(NewtonBodyGetUserData(NewtonJointGetBody1(contactJoint)));
@ -186,7 +186,7 @@ namespace Nz
return 1;
}
void PhysWorld3D::ProcessContact(const NewtonJoint* const contactJoint, float timestep, int threadIndex)
void PhysWorld3D::ProcessContact(const NewtonJoint* const contactJoint, float /*timestep*/, int /*threadIndex*/)
{
RigidBody3D* bodyA = static_cast<RigidBody3D*>(NewtonBodyGetUserData(NewtonJointGetBody0(contactJoint)));
RigidBody3D* bodyB = static_cast<RigidBody3D*>(NewtonBodyGetUserData(NewtonJointGetBody1(contactJoint)));

View File

@ -82,7 +82,7 @@ namespace Nz
m_value = Value { resultId };
},
[this](std::monostate)
[](std::monostate)
{
throw std::runtime_error("an internal error occurred");
}

View File

@ -46,7 +46,6 @@ namespace Nz
{
UInt32 resultId = m_writer.AllocateResultId();
UInt32 pointerType = m_writer.RegisterPointerType(node.exprType, pointer.storage); //< FIXME
UInt32 typeId = m_writer.GetTypeId(node.exprType);
m_writer.GetInstructions().AppendVariadic(SpirvOp::OpAccessChain, [&](const auto& appender)
{

View File

@ -217,7 +217,7 @@ namespace Nz
for (unsigned int y = 0; y < height; ++y)
{
for (unsigned int x = 0; x < width; ++x)
*pixels++ = (data[x/8] & ((1 << (7 - x%8)) ? 255 : 0));
*pixels++ = (data[x/8] & ((1 << (7 - x%8) != 0) ? 255 : 0));
data += bitmap.pitch;
}

View File

@ -460,15 +460,15 @@ namespace Nz
if (!mesh.faces.empty())
{
const std::string& matKey = matIt.key();
mesh.name = meshIt.key();
const std::string& matName = matIt.key();
auto it = materials.find(matName);
auto it = materials.find(matKey);
if (it == materials.end())
{
mesh.material = index;
materials[matName] = index;
m_materials[index] = matName;
materials[matKey] = index;
m_materials[index] = matKey;
}
else
mesh.material = it->second;

View File

@ -263,7 +263,7 @@ namespace Nz
DisconnectFontSlots();
m_blocks = std::move(drawer.m_blocks);
m_bounds = std::move(m_bounds);
m_bounds = std::move(drawer.m_bounds);
m_defaultCharacterSize = std::move(drawer.m_defaultCharacterSize);
m_defaultCharacterSpacingOffset = std::move(drawer.m_defaultCharacterSpacingOffset);
m_defaultColor = std::move(drawer.m_defaultColor);
@ -272,12 +272,12 @@ namespace Nz
m_defaultOutlineColor = std::move(drawer.m_defaultOutlineColor);
m_defaultOutlineThickness = std::move(drawer.m_defaultOutlineThickness);
m_defaultStyle = std::move(drawer.m_defaultStyle);
m_drawPos = std::move(m_drawPos);
m_drawPos = std::move(drawer.m_drawPos);
m_fontIndexes = std::move(drawer.m_fontIndexes);
m_fonts = std::move(drawer.m_fonts);
m_glyphs = std::move(m_glyphs);
m_lines = std::move(m_lines);
m_glyphUpdated = std::move(m_glyphUpdated);
m_glyphs = std::move(drawer.m_glyphs);
m_lines = std::move(drawer.m_lines);
m_glyphUpdated = std::move(drawer.m_glyphUpdated);
drawer.DisconnectFontSlots();
ConnectFontSlots();

View File

@ -24,8 +24,8 @@ namespace Ndk
* \param id Identifier of the entity
*/
Entity::Entity(World* world, EntityId id) :
m_id(id),
m_world(world)
m_world(world),
m_id(id)
{
}

View File

@ -174,9 +174,10 @@ SCENARIO("StackVector", "[CORE][STACKVECTOR]")
CHECK(!vector.empty());
CHECK(vector.size() == 3);
std::array<int, 3> expectedValues = { 0, 1, 2 };
CHECK(std::equal(vector.begin(), vector.end(), expectedValues.begin(), expectedValues.end()));
{
std::array<int, 3> expectedValues = { 0, 1, 2 };
CHECK(std::equal(vector.begin(), vector.end(), expectedValues.begin(), expectedValues.end()));
}
THEN("We resize to five")
{
@ -212,9 +213,11 @@ SCENARIO("StackVector", "[CORE][STACKVECTOR]")
for (std::size_t i = 0; i < vector.size(); ++i)
vector[i] = DestructionCounter(&counter, -5 + int(i));
std::array<int, 10> expectedValues = { -5, -4, -3, -2, -1, 0, 1, 2, 3, 4 };
CHECK(vector.size() == expectedValues.size());
CHECK(std::equal(vector.begin(), vector.end(), expectedValues.begin(), expectedValues.end()));
{
std::array<int, 10> expectedValues = { -5, -4, -3, -2, -1, 0, 1, 2, 3, 4 };
CHECK(vector.size() == expectedValues.size());
CHECK(std::equal(vector.begin(), vector.end(), expectedValues.begin(), expectedValues.end()));
}
AND_WHEN("We pop back some elements")
{