mirror of
https://github.com/SFML/SFML.git
synced 2025-02-23 14:56:02 +08:00
Remove manual disabling of -Wuseless-cast
This warning is not being used so we don't need pragmas to work around it.
This commit is contained in:
parent
37c87ee11e
commit
020d515a09
@ -69,17 +69,10 @@ function(set_target_warnings target)
|
||||
-Wmisleading-indentation # warn if indentation implies blocks where blocks do not exist
|
||||
-Wduplicated-cond # warn if if / else chain has duplicated conditions
|
||||
-Wlogical-op # warn about logical operations being used where bitwise were probably wanted
|
||||
# -Wuseless-cast # warn if you perform a cast to the same type (disabled because it is not portable as some type aliases might vary between platforms)
|
||||
$<$<VERSION_GREATER_EQUAL:${CMAKE_CXX_COMPILER_VERSION},8.1>:-Wduplicated-branches> # warn if if / else branches have duplicated code
|
||||
)
|
||||
endif()
|
||||
|
||||
if(SFML_COMPILER_CLANG OR SFML_COMPILER_CLANG_CL)
|
||||
target_compile_options(${target} PRIVATE
|
||||
-Wno-unknown-warning-option # do not warn on GCC-specific warning diagnostic pragmas
|
||||
)
|
||||
endif()
|
||||
|
||||
# Disable certain deprecation warnings
|
||||
if(SFML_OS_WINDOWS)
|
||||
target_compile_definitions(${target} PRIVATE -D_CRT_SECURE_NO_WARNINGS)
|
||||
|
@ -34,7 +34,7 @@
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4242 4244 4267 4456 4706)
|
||||
#else
|
||||
#elif !defined(__clang__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wstringop-overflow"
|
||||
#endif
|
||||
@ -43,7 +43,7 @@
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#else
|
||||
#elif !defined(__clang__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
|
@ -246,14 +246,11 @@ Socket::Status TcpSocket::send(const void* data, std::size_t size, std::size_t&
|
||||
int result = 0;
|
||||
for (sent = 0; sent < size; sent += static_cast<std::size_t>(result))
|
||||
{
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wuseless-cast"
|
||||
// Send a chunk of data
|
||||
result = static_cast<int>(::send(getNativeHandle(),
|
||||
static_cast<const char*>(data) + sent,
|
||||
static_cast<priv::SocketImpl::Size>(size - sent),
|
||||
flags));
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
// Check for errors
|
||||
if (result < 0)
|
||||
@ -284,12 +281,9 @@ Socket::Status TcpSocket::receive(void* data, std::size_t size, std::size_t& rec
|
||||
return Status::Error;
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wuseless-cast"
|
||||
// Receive a chunk of bytes
|
||||
const int sizeReceived = static_cast<int>(
|
||||
recv(getNativeHandle(), static_cast<char*>(data), static_cast<priv::SocketImpl::Size>(size), flags));
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
// Check the number of bytes received
|
||||
if (sizeReceived > 0)
|
||||
@ -340,15 +334,12 @@ Socket::Status TcpSocket::send(Packet& packet)
|
||||
// signature of `send` might change depending on whether Win32 or MinGW is
|
||||
// being used.
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wuseless-cast"
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wsign-conversion"
|
||||
// Send the data block
|
||||
std::size_t sent = 0;
|
||||
const Status status = send(m_blockToSendBuffer.data() + packet.m_sendPos,
|
||||
static_cast<priv::SocketImpl::Size>(m_blockToSendBuffer.size() - packet.m_sendPos),
|
||||
sent);
|
||||
#pragma GCC diagnostic pop
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
// In the case of a partial send, record the location to resume from
|
||||
|
@ -114,8 +114,6 @@ Socket::Status UdpSocket::send(const void* data, std::size_t size, IpAddress rem
|
||||
// Build the target address
|
||||
sockaddr_in address = priv::SocketImpl::createAddress(remoteAddress.toInteger(), remotePort);
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wuseless-cast"
|
||||
// Send the data (unlike TCP, all the data is always sent in one call)
|
||||
const int sent = static_cast<int>(
|
||||
sendto(getNativeHandle(),
|
||||
@ -124,7 +122,6 @@ Socket::Status UdpSocket::send(const void* data, std::size_t size, IpAddress rem
|
||||
0,
|
||||
reinterpret_cast<sockaddr*>(&address),
|
||||
sizeof(address)));
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
// Check for errors
|
||||
if (sent < 0)
|
||||
@ -156,8 +153,6 @@ Socket::Status UdpSocket::receive(void* data,
|
||||
// Data that will be filled with the other computer's address
|
||||
sockaddr_in address = priv::SocketImpl::createAddress(INADDR_ANY, 0);
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wuseless-cast"
|
||||
// Receive a chunk of bytes
|
||||
priv::SocketImpl::AddrLength addressSize = sizeof(address);
|
||||
const int sizeReceived = static_cast<int>(
|
||||
@ -167,7 +162,6 @@ Socket::Status UdpSocket::receive(void* data,
|
||||
0,
|
||||
reinterpret_cast<sockaddr*>(&address),
|
||||
&addressSize));
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
// Check for errors
|
||||
if (sizeReceived < 0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user