Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core] Fix unused-parameter warnings #8110

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion 3party/opening_hours/rules_evaluation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ bool IsActive(WeekdayRange const & range, std::tm const & date)
return range.HasWday(wday);
}

bool IsActive(Holiday const & holiday, std::tm const & date)
bool IsActive(Holiday const & /* holiday */, std::tm const & /* date */)
{
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion base/base_tests/lru_cache_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ UNIT_TEST(LruCacheSmokeTest)
using Value = int;

{
LruCacheTest<Key, Value> cache(1 /* maxCacheSize */, [](Key k, Value & v) { v = 1; } /* loader */);
LruCacheTest<Key, Value> cache(1 /* maxCacheSize */, [](Key, Value & v) { v = 1; } /* loader */);
TEST_EQUAL(cache.GetValue(1), 1, ());
TEST_EQUAL(cache.GetValue(2), 1, ());
TEST_EQUAL(cache.GetValue(3), 1, ());
Expand Down
2 changes: 1 addition & 1 deletion base/internal/message.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ std::string DebugPrint(std::optional<T> const & p)
return "nullopt";
}

std::string inline DebugPrint(std::nullopt_t const & p)
std::string inline DebugPrint(std::nullopt_t const &)
{
return "nullopt";
}
Expand Down
2 changes: 2 additions & 0 deletions base/pprof.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ PProf::PProf(std::string const & path)
{
#if defined(USE_PPROF)
ProfilerStart(path.c_str());
#else
UNUSED_VALUE(path);
#endif
}

Expand Down
4 changes: 4 additions & 0 deletions base/visitor.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#pragma once

#include "base/macros.hpp"

#include <sstream>
#include <string>

Expand Down Expand Up @@ -42,11 +44,13 @@ class DebugPrintVisitor
template <typename Visitor> \
void Visit(Visitor & visitor) \
{ \
UNUSED_VALUE(visitor); \
__VA_ARGS__; \
} \
template <typename Visitor> \
void Visit(Visitor & visitor) const \
{ \
UNUSED_VALUE(visitor); \
__VA_ARGS__; \
}

Expand Down
1 change: 0 additions & 1 deletion cmake/OmimConfig.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Flags for all
set(OMIM_WARNING_FLAGS
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wall -Wextra -Wpedantic>
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wno-unused-parameter> # We have a lot of functions with unused parameters
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are the pros of enabling this warning? I see the following cons:

  • Git blame is more complicated.
  • Where parameter names are removed, they're not clear and the reader should guess to understand.
  • Where parameter names are commented, it is not possible to comment large blocks of code with /* */ anymore.

)
set(3PARTY_INCLUDE_DIRS "${OMIM_ROOT}/3party/boost")
set(OMIM_DATA_DIR "${OMIM_ROOT}/data")
Expand Down
2 changes: 1 addition & 1 deletion coding/coding_tests/string_utf8_multilang_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ UNIT_TEST(MultilangString_ForEach)
size_t index = 0;
vector<string> const expected = {"default", "en", "ru"};
vector<string> actual;
s.ForEach([&index, &actual](char lang, string_view)
s.ForEach([&index, &actual](char, string_view)
{
actual.push_back(gArr[index].m_lang);
++index;
Expand Down
2 changes: 1 addition & 1 deletion coding/coding_tests/xml_parser_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class Dispatcher
using PairsOfStrings = std::vector<std::pair<std::string, std::string>>;
using Strings = std::vector<std::string>;

void CharData(std::string const & ch) {}
void CharData(std::string const & /* ch */) {}

void AddAttr(std::string key, std::string value)
{
Expand Down
4 changes: 2 additions & 2 deletions drape/drape_tests/batcher_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ struct VAOAcceptor
class TestExtension : public dp::BaseRenderStateExtension
{
public:
bool Less(ref_ptr<dp::BaseRenderStateExtension> other) const override { return false; }
bool Equal(ref_ptr<dp::BaseRenderStateExtension> other) const override { return true; }
bool Less(ref_ptr<dp::BaseRenderStateExtension>) const override { return false; }
bool Equal(ref_ptr<dp::BaseRenderStateExtension>) const override { return true; }
};

class BatcherExpectations
Expand Down
2 changes: 1 addition & 1 deletion drape/drape_tests/font_texture_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class UploadedRender
public:
explicit UploadedRender(QPoint const & pen) : m_pen(pen) {}

void glMemoryToQImage(int x, int y, int w, int h, glConst f, glConst t, void const * memory)
void glMemoryToQImage(int x, int /* y */, int w, int h, glConst f, glConst t, void const * memory)
{
TEST(f == gl_const::GLAlpha || f == gl_const::GLAlpha8 || f == gl_const::GLRed, ());
TEST(t == gl_const::GLUnsignedByteType, ());
Expand Down
29 changes: 14 additions & 15 deletions drape/drape_tests/testing_graphics_context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,28 @@ class TestingGraphicsContext : public dp::GraphicsContext

void Present() override {}
void MakeCurrent() override {}
void SetFramebuffer(ref_ptr<dp::BaseFramebuffer> framebuffer) override {}
void ForgetFramebuffer(ref_ptr<dp::BaseFramebuffer> framebuffer) override {}
void ApplyFramebuffer(std::string const & framebufferLabel) override {}
void SetFramebuffer(ref_ptr<dp::BaseFramebuffer>) override {}
void ForgetFramebuffer(ref_ptr<dp::BaseFramebuffer>) override {}
void ApplyFramebuffer(std::string const &) override {}

void Init(dp::ApiVersion apiVersion) override {}
void Init(dp::ApiVersion) override {}
dp::ApiVersion GetApiVersion() const override { return m_apiVersion; }
std::string GetRendererName() const override { return {}; }
std::string GetRendererVersion() const override { return {}; }

void PushDebugLabel(std::string const & label) override {}
void PushDebugLabel(std::string const &) override {}
void PopDebugLabel() override {}

void SetClearColor(dp::Color const & color) override {}
void Clear(uint32_t clearBits, uint32_t storeBits) override {}
void SetClearColor(dp::Color const &) override {}
void Clear(uint32_t, uint32_t) override {}
void Flush() override {}
void SetViewport(uint32_t x, uint32_t y, uint32_t w, uint32_t h) override {}
void SetDepthTestEnabled(bool enabled) override {}
void SetDepthTestFunction(dp::TestFunction depthFunction) override {}
void SetStencilTestEnabled(bool enabled) override {}
void SetStencilFunction(dp::StencilFace face, dp::TestFunction stencilFunction) override {}
void SetStencilActions(dp::StencilFace face, dp::StencilAction stencilFailAction,
dp::StencilAction depthFailAction, dp::StencilAction passAction) override {}
void SetStencilReferenceValue(uint32_t stencilReferenceValue) override {}
void SetViewport(uint32_t, uint32_t, uint32_t, uint32_t) override {}
void SetDepthTestEnabled(bool) override {}
void SetDepthTestFunction(dp::TestFunction) override {}
void SetStencilTestEnabled(bool) override {}
void SetStencilFunction(dp::StencilFace, dp::TestFunction) override {}
void SetStencilActions(dp::StencilFace, dp::StencilAction, dp::StencilAction, dp::StencilAction) override {}
void SetStencilReferenceValue(uint32_t) override {}

private:
dp::ApiVersion m_apiVersion = dp::ApiVersion::OpenGLES2;
Expand Down
4 changes: 2 additions & 2 deletions drape/drape_tests/uniform_value_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class MemoryComparer
, m_size(size)
{}

void Compare(int32_t id, T const * memory)
void Compare(int32_t /* id */, T const * memory)
{
m_result = memcmp(m_memory, memory, m_size) == 0;
}
Expand All @@ -48,7 +48,7 @@ class MemoryComparer
uint32_t m_size;
};

void mock_glGetActiveUniform(uint32_t programID, uint32_t index, int32_t * size,
void mock_glGetActiveUniform(uint32_t /* programID */, uint32_t index, int32_t * size,
glConst * type, std::string & name)
{
*size = 1;
Expand Down
2 changes: 1 addition & 1 deletion drape/framebuffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace dp
class FramebufferTexture : public Texture
{
public:
ref_ptr<ResourceInfo> FindResource(Key const & key, bool & newResource) override { return nullptr; }
ref_ptr<ResourceInfo> FindResource(Key const &, bool &) override { return nullptr; }
};

using FramebufferFallback = std::function<bool()>;
Expand Down
4 changes: 2 additions & 2 deletions drape/graphics_context_factory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ class GraphicsContextFactory
virtual GraphicsContext * GetResourcesUploadContext() = 0;
virtual bool IsDrawContextCreated() const { return false; }
virtual bool IsUploadContextCreated() const { return false; }
virtual void WaitForInitialization(dp::GraphicsContext * context) {}
virtual void SetPresentAvailable(bool available) {}
virtual void WaitForInitialization(dp::GraphicsContext * /* context */) {}
virtual void SetPresentAvailable(bool /* available */) {}
};

class ThreadSafeFactory : public GraphicsContextFactory
Expand Down
2 changes: 1 addition & 1 deletion drape/hw_texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ void OpenGLHWTexture::Create(ref_ptr<dp::GraphicsContext> context, Params const
GLFunctions::glFlush();
}

void OpenGLHWTexture::UploadData(ref_ptr<dp::GraphicsContext> context, uint32_t x, uint32_t y,
void OpenGLHWTexture::UploadData(ref_ptr<dp::GraphicsContext>, uint32_t x, uint32_t y,
uint32_t width, uint32_t height, ref_ptr<void> data)
{
ASSERT(Validate(), ());
Expand Down
8 changes: 4 additions & 4 deletions drape/oglcontext.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ class OGLContext : public GraphicsContext
ApiVersion GetApiVersion() const override;
std::string GetRendererName() const override;
std::string GetRendererVersion() const override;
void ForgetFramebuffer(ref_ptr<dp::BaseFramebuffer> framebuffer) override {}
void ApplyFramebuffer(std::string const & framebufferLabel) override {}
void ForgetFramebuffer(ref_ptr<dp::BaseFramebuffer>) override {}
void ApplyFramebuffer(std::string const &) override {}

void DebugSynchronizeWithCPU() override;
void PushDebugLabel(std::string const & label) override {}
void PushDebugLabel(std::string const &) override {}
void PopDebugLabel() override {}

void SetClearColor(dp::Color const & color) override;
Expand All @@ -30,6 +30,6 @@ class OGLContext : public GraphicsContext
StencilAction passAction) override;

// Do not use custom stencil reference value in OpenGL rendering.
void SetStencilReferenceValue(uint32_t stencilReferenceValue) override {}
void SetStencilReferenceValue(uint32_t) override {}
};
} // namespace dp
2 changes: 1 addition & 1 deletion drape/render_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Blending::Blending(bool isEnabled)
: m_isEnabled(isEnabled)
{}

void Blending::Apply(ref_ptr<GraphicsContext> context, ref_ptr<GpuProgram> program) const
void Blending::Apply(ref_ptr<GraphicsContext> context, ref_ptr<GpuProgram>) const
{
// For Metal Rendering these settings must be set in the pipeline state.
auto const apiVersion = context->GetApiVersion();
Expand Down
2 changes: 1 addition & 1 deletion drape/texture.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class Texture
virtual ~Texture() = default;

virtual ref_ptr<ResourceInfo> FindResource(Key const & key, bool & newResource) = 0;
virtual void UpdateState(ref_ptr<dp::GraphicsContext> context) {}
virtual void UpdateState(ref_ptr<dp::GraphicsContext> /* context */) {}
virtual bool HasEnoughSpace(uint32_t /* newKeysCount */) const { return true; }
using Params = HWTexture::Params;

Expand Down
2 changes: 1 addition & 1 deletion drape/vertex_array_buffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class VertexArrayBufferImpl
virtual void RenderRange(ref_ptr<GraphicsContext> context,
bool drawAsLine, IndicesRange const & range) = 0;

virtual void AddBindingInfo(dp::BindingInfo const & bindingInfo) {}
virtual void AddBindingInfo(dp::BindingInfo const & /* bindingInfo */) {}
};

namespace metal
Expand Down
2 changes: 1 addition & 1 deletion drape/vulkan/vulkan_base_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ void VulkanBaseContext::ForgetFramebuffer(ref_ptr<dp::BaseFramebuffer> framebuff
DestroyRenderPassAndFramebuffer(framebuffer);
}

void VulkanBaseContext::ApplyFramebuffer(std::string const & framebufferLabel)
void VulkanBaseContext::ApplyFramebuffer(std::string const &)
{
vkCmdSetStencilReference(m_renderingCommandBuffers[m_inflightFrameIndex], VK_STENCIL_FRONT_AND_BACK,
m_stencilReferenceValue);
Expand Down
2 changes: 1 addition & 1 deletion drape/vulkan/vulkan_base_context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class VulkanBaseContext : public dp::GraphicsContext
bool HasPartialTextureUpdates() const override;

void DebugSynchronizeWithCPU() override {}
void PushDebugLabel(std::string const & label) override {}
void PushDebugLabel(std::string const &) override {}
void PopDebugLabel() override {}

void SetClearColor(Color const & color) override;
Expand Down
4 changes: 2 additions & 2 deletions drape/vulkan/vulkan_mesh_object_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class VulkanMeshObjectImpl : public MeshObjectImpl
, m_descriptorUpdater(objectManager)
{}

void Build(ref_ptr<dp::GraphicsContext> context, ref_ptr<dp::GpuProgram> program) override
void Build(ref_ptr<dp::GraphicsContext>, ref_ptr<dp::GpuProgram>) override
{
m_geometryBuffers.resize(m_mesh->m_buffers.size());
m_bindingInfoCount = static_cast<uint8_t>(m_mesh->m_buffers.size());
Expand Down Expand Up @@ -165,7 +165,7 @@ class VulkanMeshObjectImpl : public MeshObjectImpl
vkCmdDraw(commandBuffer, verticesCount, 1, 0, 0);
}

void Bind(ref_ptr<dp::GpuProgram> program) override {}
void Bind(ref_ptr<dp::GpuProgram>) override {}
void Unbind() override {}

private:
Expand Down
2 changes: 1 addition & 1 deletion drape/vulkan/vulkan_texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ VkBufferImageCopy BufferCopyRegion(uint32_t x, uint32_t y, uint32_t width, uint3
}
} // namespace

drape_ptr<HWTexture> VulkanTextureAllocator::CreateTexture(ref_ptr<dp::GraphicsContext> context)
drape_ptr<HWTexture> VulkanTextureAllocator::CreateTexture(ref_ptr<dp::GraphicsContext>)
{
return make_unique_dp<VulkanTexture>(make_ref(this));
}
Expand Down
2 changes: 1 addition & 1 deletion drape/vulkan/vulkan_vertex_array_buffer_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class VulkanVertexArrayBufferImpl : public VertexArrayBufferImpl

bool Bind() override { return true; }
void Unbind() override {}
void BindBuffers(dp::BuffersMap const & buffers) const override {}
void BindBuffers(dp::BuffersMap const &) const override {}

void RenderRange(ref_ptr<GraphicsContext> context, bool drawAsLine,
IndicesRange const & range) override
Expand Down
2 changes: 1 addition & 1 deletion drape_frontend/animation/animation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class Animation

virtual ~Animation() = default;

virtual void Init(ScreenBase const & screen, TPropertyCache const & properties) {}
virtual void Init(ScreenBase const & /* screen */, TPropertyCache const & /* properties */) {}
virtual void OnStart() { if (m_onStartAction != nullptr) m_onStartAction(this); }
virtual void OnFinish() { if (m_onFinishAction != nullptr) m_onFinishAction(this); }
virtual void Interrupt() { if (m_onInterruptAction != nullptr) m_onInterruptAction(this); }
Expand Down
4 changes: 2 additions & 2 deletions drape_frontend/animation/arrow_animation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ ArrowAnimation::ArrowAnimation(m2::PointD const & startPos, m2::PointD const & e
m_properties.insert(Animation::ObjectProperty::Angle);
}

void ArrowAnimation::Init(ScreenBase const & screen, TPropertyCache const & properties)
void ArrowAnimation::Init(ScreenBase const &, TPropertyCache const & properties)
{
PropertyValue value;
double minDuration;
Expand Down Expand Up @@ -64,7 +64,7 @@ bool ArrowAnimation::HasObject(Object object) const
return object == Animation::Object::MyPositionArrow;
}

Animation::TObjectProperties const & ArrowAnimation::GetProperties(Object object) const
Animation::TObjectProperties const & ArrowAnimation::GetProperties(Object) const
{
return m_properties;
}
Expand Down
2 changes: 1 addition & 1 deletion drape_frontend/animation/follow_animation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ bool MapFollowAnimation::GetTargetProperty(Object object, ObjectProperty propert
return GetProperty(object, property, true /* targetValue */, value);
}

bool MapFollowAnimation::GetProperty(Object object, ObjectProperty property, bool targetValue, PropertyValue & value) const
bool MapFollowAnimation::GetProperty(Object, ObjectProperty property, bool targetValue, PropertyValue & value) const
{
if (property == Animation::ObjectProperty::Position)
{
Expand Down
4 changes: 2 additions & 2 deletions drape_frontend/animation/sequence_animation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ bool SequenceAnimation::HasTargetProperty(Object object, ObjectProperty property
return false;
}

void SequenceAnimation::SetMaxDuration(double maxDuration)
void SequenceAnimation::SetMaxDuration(double)
{
ASSERT(false, ("Not implemented"));
}

void SequenceAnimation::SetMinDuration(double minDuration)
void SequenceAnimation::SetMinDuration(double)
{
ASSERT(false, ("Not implemented"));
}
Expand Down
2 changes: 1 addition & 1 deletion drape_frontend/animation_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
namespace df
{

bool IsAnimationAllowed(double duration, ScreenBase const & screen)
bool IsAnimationAllowed(double duration, ScreenBase const &)
{
return duration > 0.0 && duration <= kMaxAnimationTimeSec;
}
Expand Down
6 changes: 3 additions & 3 deletions drape_frontend/arrow3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ void * FileOpen(char const * path, void * userData)
return userData;
}

void FileClose(void * file, void * userData)
void FileClose(void * /* file */, void * /* userData */)
{
// Do nothing.
}

size_t FileRead(void * file, void * dst, size_t bytes, void * userData)
size_t FileRead(void * /* file */, void * dst, size_t bytes, void * userData)
{
auto reader = static_cast<ReaderSource<ReaderPtr<Reader>> *>(userData);
CHECK(reader != nullptr, ());
Expand All @@ -91,7 +91,7 @@ size_t FileRead(void * file, void * dst, size_t bytes, void * userData)
return static_cast<size_t>(reader->Pos() - p);
}

unsigned long FileSize(void * file, void * userData)
unsigned long FileSize(void * /* file */, void * userData)
{
auto reader = static_cast<ReaderSource<ReaderPtr<Reader>> *>(userData);
CHECK(reader != nullptr, ());
Expand Down
1 change: 1 addition & 0 deletions drape_frontend/circles_pack_shape.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ void CirclesPackHandle::GetPixelShape(ScreenBase const & screen, bool perspectiv
{
UNUSED_VALUE(screen);
UNUSED_VALUE(perspective);
UNUSED_VALUE(rects);
}

void CirclesPackHandle::SetPoint(size_t index, m2::PointD const & position, float radius,
Expand Down
2 changes: 1 addition & 1 deletion drape_frontend/debug_rect_renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ drape_ptr<dp::MeshObject> CreateMesh(ref_ptr<dp::GraphicsContext> context, ref_p
}
} // namespace

DebugRectRenderer::DebugRectRenderer(ref_ptr<dp::GraphicsContext> context, ref_ptr<dp::GpuProgram> program,
DebugRectRenderer::DebugRectRenderer(ref_ptr<dp::GraphicsContext>, ref_ptr<dp::GpuProgram> program,
ref_ptr<gpu::ProgramParamsSetter> paramsSetter)
: m_program(program)
, m_paramsSetter(paramsSetter)
Expand Down