1
0
forked from mirrors/0ad

Remove UNUSED

The `UNUSED` macro is used to mark a variable as unused but with a name.
Those usages are replaced with comments so that `UNUSED` can be removed.

https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rf-unused
This commit is contained in:
phosit
2025-06-03 14:13:41 +02:00
committed by phosit
parent dd26f3a802
commit 891908b801
127 changed files with 355 additions and 340 deletions
+2 -2
View File
@@ -235,13 +235,13 @@ bool CGUI::ParseString<CGUISpriteInstance>(const CGUI*, const CStrW& Value, CGUI
}
template <>
bool CGUI::ParseString<CGUISeries>(const CGUI*, const CStrW& UNUSED(Value), CGUISeries& UNUSED(Output))
bool CGUI::ParseString<CGUISeries>(const CGUI*, const CStrW& /*Value*/, CGUISeries& /*Output*/)
{
return false;
}
template <>
bool CGUI::ParseString<CGUIList>(const CGUI*, const CStrW& UNUSED(Value), CGUIList& UNUSED(Output))
bool CGUI::ParseString<CGUIList>(const CGUI*, const CStrW& /*Value*/, CGUIList& /*Output*/)
{
return false;
}
+3 -3
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2024 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -191,7 +191,7 @@ public:
* @param mouse current mouse position
* @return True if mouse positions are hovering the button
*/
virtual bool HoveringButtonMinus(const CVector2D& UNUSED(mouse)) { return false; }
virtual bool HoveringButtonMinus(const CVector2D& /*mouse*/) { return false; }
/**
* Hovering the scroll plus button
@@ -199,7 +199,7 @@ public:
* @param mouse current mouse position
* @return True if mouse positions are hovering the button
*/
virtual bool HoveringButtonPlus(const CVector2D& UNUSED(mouse)) { return false; }
virtual bool HoveringButtonPlus(const CVector2D& /*mouse*/) { return false; }
/**
* Get scroll-position
+1 -1
View File
@@ -373,7 +373,7 @@ protected:
* Notice 'false' is default, because an object not using this function, should not
* have any additional children (and this function should never be called).
*/
virtual bool HandleAdditionalChildren(const XMBData& UNUSED(file), const XMBElement& UNUSED(child))
virtual bool HandleAdditionalChildren(const XMBData& /*file*/, const XMBElement& /*child*/)
{
return false;
}
+1 -1
View File
@@ -244,7 +244,7 @@ CVector2D CMiniMap::WorldSpaceToMiniMapSpace(const CVector3D& worldPosition) con
m_CachedActualSize.bottom - (0.5f + rotatedY) * m_CachedActualSize.GetHeight());
}
bool CMiniMap::FireWorldClickEvent(int button, int UNUSED(clicks))
bool CMiniMap::FireWorldClickEvent(int button, int /*clicks*/)
{
ScriptRequest rq(g_GUI->GetActiveGUI()->GetScriptInterface());
+14 -14
View File
@@ -169,48 +169,48 @@ protected:
// We provide defaults that do nothing (some raise JS exceptions).
// The JS code will see undefined when querying a property descriptor.
virtual bool getOwnPropertyDescriptor(JSContext*, JS::HandleObject UNUSED(proxy), JS::HandleId,
virtual bool getOwnPropertyDescriptor(JSContext*, JS::HandleObject /*proxy*/, JS::HandleId,
JS::MutableHandle<mozilla::Maybe<JS::PropertyDescriptor>>) const override
{
return true;
}
// Throw an exception is JS code attempts defining a property.
virtual bool defineProperty(JSContext*, JS::HandleObject UNUSED(proxy), JS::HandleId,
JS::Handle<JS::PropertyDescriptor>, JS::ObjectOpResult& UNUSED(result)) const override
virtual bool defineProperty(JSContext*, JS::HandleObject /*proxy*/, JS::HandleId,
JS::Handle<JS::PropertyDescriptor>, JS::ObjectOpResult& /*result*/) const override
{
return false;
}
// No accessible properties.
virtual bool ownPropertyKeys(JSContext*, JS::HandleObject UNUSED(proxy),
JS::MutableHandleIdVector UNUSED(props)) const override
virtual bool ownPropertyKeys(JSContext*, JS::HandleObject /*proxy*/,
JS::MutableHandleIdVector) const override
{
return true;
}
// Nothing to enumerate.
virtual bool enumerate(JSContext*, JS::HandleObject UNUSED(proxy),
JS::MutableHandleIdVector UNUSED(props)) const override
virtual bool enumerate(JSContext*, JS::HandleObject /*proxy*/,
JS::MutableHandleIdVector /*props*/) const override
{
return true;
}
// Throw an exception is JS attempts to query the prototype.
virtual bool getPrototypeIfOrdinary(JSContext*, JS::HandleObject UNUSED(proxy),
bool* UNUSED(isOrdinary), JS::MutableHandleObject UNUSED(protop)) const override
virtual bool getPrototypeIfOrdinary(JSContext*, JS::HandleObject /*proxy*/, bool* /*isOrdinary*/,
JS::MutableHandleObject /*protop*/) const override
{
return false;
}
// Throw an exception - no prototype to set.
virtual bool setImmutablePrototype(JSContext*, JS::HandleObject UNUSED(proxy),
bool* UNUSED(succeeded)) const override
virtual bool setImmutablePrototype(JSContext*, JS::HandleObject /*proxy*/,
bool* /*succeeded*/) const override
{
return false;
}
// We are not extensible.
virtual bool preventExtensions(JSContext*, JS::HandleObject UNUSED(proxy),
JS::ObjectOpResult&) const override
virtual bool preventExtensions(JSContext*, JS::HandleObject /*proxy*/,
JS::ObjectOpResult& /*result*/) const override
{
return true;
}
virtual bool isExtensible(JSContext*, JS::HandleObject UNUSED(proxy), bool* extensible) const override
virtual bool isExtensible(JSContext*, JS::HandleObject /*proxy*/, bool* extensible) const override
{
*extensible = false;
return true;
@@ -167,7 +167,8 @@ std::unique_ptr<IGUIProxyObject> JSI_GUIProxy<T>::CreateJSObject(const ScriptReq
}
template <typename T>
bool JSI_GUIProxy<T>::get(JSContext* cx, JS::HandleObject proxy, JS::HandleValue UNUSED(receiver), JS::HandleId id, JS::MutableHandleValue vp) const
bool JSI_GUIProxy<T>::get(JSContext* cx, JS::HandleObject proxy, JS::HandleValue /*receiver*/,
JS::HandleId id, JS::MutableHandleValue vp) const
{
ScriptRequest rq(cx);
@@ -237,7 +238,7 @@ bool JSI_GUIProxy<T>::get(JSContext* cx, JS::HandleObject proxy, JS::HandleValue
template <typename T>
bool JSI_GUIProxy<T>::set(JSContext* cx, JS::HandleObject proxy, JS::HandleId id, JS::HandleValue vp,
JS::HandleValue UNUSED(receiver), JS::ObjectOpResult& result) const
JS::HandleValue /*receiver*/, JS::ObjectOpResult& result) const
{
T* e = IGUIProxyObject::FromPrivateSlot<T>(proxy.get());
if (!e)