mirror of
https://github.com/SFML/SFML.git
synced 2025-02-08 01:18:02 +08:00
Use [[maybe_unused]]
for parameters that are sometimes not used
Depending on preprocessor settings, certain parameters may or may not be used. Instead of casing to (void) when not used, it's easier to use C++17's [[maybe_unused]] attribute to express this.
This commit is contained in:
parent
58e93ddd19
commit
e0c4d14541
@ -645,7 +645,7 @@ Out Utf<32>::toUtf32(In begin, In end, Out output)
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
template <typename In>
|
template <typename In>
|
||||||
Uint32 Utf<32>::decodeAnsi(In input, const std::locale& locale)
|
Uint32 Utf<32>::decodeAnsi(In input, [[maybe_unused]] const std::locale& locale)
|
||||||
{
|
{
|
||||||
// On Windows, GCC's standard library (glibc++) has almost
|
// On Windows, GCC's standard library (glibc++) has almost
|
||||||
// no support for Unicode stuff. As a consequence, in this
|
// no support for Unicode stuff. As a consequence, in this
|
||||||
@ -656,8 +656,6 @@ Uint32 Utf<32>::decodeAnsi(In input, const std::locale& locale)
|
|||||||
(defined(__GLIBCPP__) || defined (__GLIBCXX__)) && /* ... and standard library is glibc++ ... */ \
|
(defined(__GLIBCPP__) || defined (__GLIBCXX__)) && /* ... and standard library is glibc++ ... */ \
|
||||||
!(defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) /* ... and STLPort is not used on top of it */
|
!(defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) /* ... and STLPort is not used on top of it */
|
||||||
|
|
||||||
(void)locale; // to avoid warnings
|
|
||||||
|
|
||||||
wchar_t character = 0;
|
wchar_t character = 0;
|
||||||
mbtowc(&character, &input, 1);
|
mbtowc(&character, &input, 1);
|
||||||
return static_cast<Uint32>(character);
|
return static_cast<Uint32>(character);
|
||||||
@ -690,7 +688,7 @@ Uint32 Utf<32>::decodeWide(In input)
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
template <typename Out>
|
template <typename Out>
|
||||||
Out Utf<32>::encodeAnsi(Uint32 codepoint, Out output, char replacement, const std::locale& locale)
|
Out Utf<32>::encodeAnsi(Uint32 codepoint, Out output, char replacement, [[maybe_unused]] const std::locale& locale)
|
||||||
{
|
{
|
||||||
// On Windows, gcc's standard library (glibc++) has almost
|
// On Windows, gcc's standard library (glibc++) has almost
|
||||||
// no support for Unicode stuff. As a consequence, in this
|
// no support for Unicode stuff. As a consequence, in this
|
||||||
@ -701,8 +699,6 @@ Out Utf<32>::encodeAnsi(Uint32 codepoint, Out output, char replacement, const st
|
|||||||
(defined(__GLIBCPP__) || defined (__GLIBCXX__)) && /* ... and standard library is glibc++ ... */ \
|
(defined(__GLIBCPP__) || defined (__GLIBCXX__)) && /* ... and standard library is glibc++ ... */ \
|
||||||
!(defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) /* ... and STLPort is not used on top of it */
|
!(defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) /* ... and STLPort is not used on top of it */
|
||||||
|
|
||||||
(void)locale; // to avoid warnings
|
|
||||||
|
|
||||||
char character = 0;
|
char character = 0;
|
||||||
if (wctomb(&character, static_cast<wchar_t>(codepoint)) >= 0)
|
if (wctomb(&character, static_cast<wchar_t>(codepoint)) >= 0)
|
||||||
*output++ = character;
|
*output++ = character;
|
||||||
|
@ -206,11 +206,10 @@ bool VertexBuffer::update(const Vertex* vertices, std::size_t vertexCount, unsig
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool VertexBuffer::update(const VertexBuffer& vertexBuffer)
|
bool VertexBuffer::update([[maybe_unused]] const VertexBuffer& vertexBuffer)
|
||||||
{
|
{
|
||||||
#ifdef SFML_OPENGL_ES
|
#ifdef SFML_OPENGL_ES
|
||||||
|
|
||||||
(void) vertexBuffer;
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
@ -132,7 +132,7 @@ m_config (nullptr)
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
EglContext::EglContext(EglContext* shared, const ContextSettings& settings, const WindowImpl& owner, unsigned int bitsPerPixel) :
|
EglContext::EglContext(EglContext* shared, const ContextSettings& settings, [[maybe_unused]] const WindowImpl& owner, unsigned int bitsPerPixel) :
|
||||||
m_display (EGL_NO_DISPLAY),
|
m_display (EGL_NO_DISPLAY),
|
||||||
m_context (EGL_NO_CONTEXT),
|
m_context (EGL_NO_CONTEXT),
|
||||||
m_surface (EGL_NO_SURFACE),
|
m_surface (EGL_NO_SURFACE),
|
||||||
@ -164,8 +164,7 @@ m_config (nullptr)
|
|||||||
// Create EGL surface (except on Android because the window is created
|
// Create EGL surface (except on Android because the window is created
|
||||||
// asynchronously, its activity manager will call it for us)
|
// asynchronously, its activity manager will call it for us)
|
||||||
createSurface(owner.getSystemHandle());
|
createSurface(owner.getSystemHandle());
|
||||||
#else
|
|
||||||
(void) owner;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,11 +55,10 @@ using VulkanImplType = sf::priv::VulkanImplWin32;
|
|||||||
namespace sf
|
namespace sf
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool Vulkan::isAvailable(bool requireGraphics)
|
bool Vulkan::isAvailable([[maybe_unused]] bool requireGraphics)
|
||||||
{
|
{
|
||||||
#if defined(SFML_VULKAN_IMPLEMENTATION_NOT_AVAILABLE)
|
#if defined(SFML_VULKAN_IMPLEMENTATION_NOT_AVAILABLE)
|
||||||
|
|
||||||
(void) requireGraphics;
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
@ -71,11 +70,10 @@ bool Vulkan::isAvailable(bool requireGraphics)
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
VulkanFunctionPointer Vulkan::getFunction(const char* name)
|
VulkanFunctionPointer Vulkan::getFunction([[maybe_unused]] const char* name)
|
||||||
{
|
{
|
||||||
#if defined(SFML_VULKAN_IMPLEMENTATION_NOT_AVAILABLE)
|
#if defined(SFML_VULKAN_IMPLEMENTATION_NOT_AVAILABLE)
|
||||||
|
|
||||||
(void) name;
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
@ -295,13 +295,10 @@ void WindowImpl::processSensorEvents()
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool WindowImpl::createVulkanSurface(const VkInstance& instance, VkSurfaceKHR& surface, const VkAllocationCallbacks* allocator)
|
bool WindowImpl::createVulkanSurface([[maybe_unused]] const VkInstance& instance, [[maybe_unused]] VkSurfaceKHR& surface, [[maybe_unused]] const VkAllocationCallbacks* allocator)
|
||||||
{
|
{
|
||||||
#if defined(SFML_VULKAN_IMPLEMENTATION_NOT_AVAILABLE)
|
#if defined(SFML_VULKAN_IMPLEMENTATION_NOT_AVAILABLE)
|
||||||
|
|
||||||
(void) instance;
|
|
||||||
(void) surface;
|
|
||||||
(void) allocator;
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user