forked from OSchip/llvm-project
Remove no-op function pointer null checks, NFC
Null-checking functions which aren't marked weak_import is a no-op (the compiler rewrites the check to 'true'), regardless of whether a library providing its definition is weak-linked. If the deployment target is greater than the minimum requirement, the availability markup on APIs does not lower to weak_import. Remove no-op null checks to clean up the code and silence warnings. Differential Revision: https://reviews.llvm.org/D40812 llvm-svn: 319936
This commit is contained in:
parent
8465c38b1e
commit
606908aab5
|
@ -600,10 +600,9 @@ bool GDBRemoteCommunication::DecompressPacket() {
|
|||
#if defined(HAVE_LIBCOMPRESSION)
|
||||
// libcompression is weak linked so check that compression_decode_buffer() is
|
||||
// available
|
||||
if (compression_decode_buffer != NULL &&
|
||||
(m_compression_type == CompressionType::ZlibDeflate ||
|
||||
m_compression_type == CompressionType::LZFSE ||
|
||||
m_compression_type == CompressionType::LZ4)) {
|
||||
if (m_compression_type == CompressionType::ZlibDeflate ||
|
||||
m_compression_type == CompressionType::LZFSE ||
|
||||
m_compression_type == CompressionType::LZ4) {
|
||||
compression_algorithm compression_type;
|
||||
if (m_compression_type == CompressionType::LZFSE)
|
||||
compression_type = COMPRESSION_LZFSE;
|
||||
|
|
|
@ -1022,10 +1022,7 @@ void GDBRemoteCommunicationClient::MaybeEnableCompression(
|
|||
std::string avail_name;
|
||||
|
||||
#if defined(HAVE_LIBCOMPRESSION)
|
||||
// libcompression is weak linked so test if compression_decode_buffer() is
|
||||
// available
|
||||
if (compression_decode_buffer != NULL &&
|
||||
avail_type == CompressionType::None) {
|
||||
if (avail_type == CompressionType::None) {
|
||||
for (auto compression : supported_compressions) {
|
||||
if (compression == "lzfse") {
|
||||
avail_type = CompressionType::LZFSE;
|
||||
|
@ -1037,10 +1034,7 @@ void GDBRemoteCommunicationClient::MaybeEnableCompression(
|
|||
#endif
|
||||
|
||||
#if defined(HAVE_LIBCOMPRESSION)
|
||||
// libcompression is weak linked so test if compression_decode_buffer() is
|
||||
// available
|
||||
if (compression_decode_buffer != NULL &&
|
||||
avail_type == CompressionType::None) {
|
||||
if (avail_type == CompressionType::None) {
|
||||
for (auto compression : supported_compressions) {
|
||||
if (compression == "zlib-deflate") {
|
||||
avail_type = CompressionType::ZlibDeflate;
|
||||
|
@ -1064,10 +1058,7 @@ void GDBRemoteCommunicationClient::MaybeEnableCompression(
|
|||
#endif
|
||||
|
||||
#if defined(HAVE_LIBCOMPRESSION)
|
||||
// libcompression is weak linked so test if compression_decode_buffer() is
|
||||
// available
|
||||
if (compression_decode_buffer != NULL &&
|
||||
avail_type == CompressionType::None) {
|
||||
if (avail_type == CompressionType::None) {
|
||||
for (auto compression : supported_compressions) {
|
||||
if (compression == "lz4") {
|
||||
avail_type = CompressionType::LZ4;
|
||||
|
@ -1079,10 +1070,7 @@ void GDBRemoteCommunicationClient::MaybeEnableCompression(
|
|||
#endif
|
||||
|
||||
#if defined(HAVE_LIBCOMPRESSION)
|
||||
// libcompression is weak linked so test if compression_decode_buffer() is
|
||||
// available
|
||||
if (compression_decode_buffer != NULL &&
|
||||
avail_type == CompressionType::None) {
|
||||
if (avail_type == CompressionType::None) {
|
||||
for (auto compression : supported_compressions) {
|
||||
if (compression == "lzma") {
|
||||
avail_type = CompressionType::LZMA;
|
||||
|
|
|
@ -56,9 +56,7 @@ void DarwinLogCallback(void *baton, uint32_t flags, const char *format,
|
|||
}
|
||||
}
|
||||
|
||||
DNBCallbackLog OsLogger::GetLogFunction() {
|
||||
return _os_log_impl ? DarwinLogCallback : nullptr;
|
||||
}
|
||||
DNBCallbackLog OsLogger::GetLogFunction() { return DarwinLogCallback; }
|
||||
|
||||
#else
|
||||
|
||||
|
|
|
@ -710,26 +710,22 @@ std::string RNBRemote::CompressString(const std::string &orig) {
|
|||
size_t compressed_size = 0;
|
||||
|
||||
#if defined(HAVE_LIBCOMPRESSION)
|
||||
if (compression_decode_buffer &&
|
||||
compression_type == compression_types::lz4) {
|
||||
if (compression_type == compression_types::lz4) {
|
||||
compressed_size = compression_encode_buffer(
|
||||
encoded_data.data(), encoded_data_buf_size, (uint8_t *)orig.c_str(),
|
||||
orig.size(), nullptr, COMPRESSION_LZ4_RAW);
|
||||
}
|
||||
if (compression_decode_buffer &&
|
||||
compression_type == compression_types::zlib_deflate) {
|
||||
if (compression_type == compression_types::zlib_deflate) {
|
||||
compressed_size = compression_encode_buffer(
|
||||
encoded_data.data(), encoded_data_buf_size, (uint8_t *)orig.c_str(),
|
||||
orig.size(), nullptr, COMPRESSION_ZLIB);
|
||||
}
|
||||
if (compression_decode_buffer &&
|
||||
compression_type == compression_types::lzma) {
|
||||
if (compression_type == compression_types::lzma) {
|
||||
compressed_size = compression_encode_buffer(
|
||||
encoded_data.data(), encoded_data_buf_size, (uint8_t *)orig.c_str(),
|
||||
orig.size(), nullptr, COMPRESSION_LZMA);
|
||||
}
|
||||
if (compression_decode_buffer &&
|
||||
compression_type == compression_types::lzfse) {
|
||||
if (compression_type == compression_types::lzfse) {
|
||||
compressed_size = compression_encode_buffer(
|
||||
encoded_data.data(), encoded_data_buf_size, (uint8_t *)orig.c_str(),
|
||||
orig.size(), nullptr, COMPRESSION_LZFSE);
|
||||
|
@ -3621,7 +3617,7 @@ rnb_err_t RNBRemote::HandlePacket_qSupported(const char *p) {
|
|||
#if defined(HAVE_LIBCOMPRESSION)
|
||||
// libcompression is weak linked so test if compression_decode_buffer() is
|
||||
// available
|
||||
if (enable_compression && compression_decode_buffer != NULL) {
|
||||
if (enable_compression) {
|
||||
strcat(buf, ";SupportedCompressions=lzfse,zlib-deflate,lz4,lzma;"
|
||||
"DefaultCompressionMinSize=");
|
||||
char numbuf[16];
|
||||
|
@ -4307,24 +4303,22 @@ rnb_err_t RNBRemote::HandlePacket_QEnableCompression(const char *p) {
|
|||
}
|
||||
|
||||
#if defined(HAVE_LIBCOMPRESSION)
|
||||
if (compression_decode_buffer != NULL) {
|
||||
if (strstr(p, "type:zlib-deflate;") != nullptr) {
|
||||
EnableCompressionNextSendPacket(compression_types::zlib_deflate);
|
||||
m_compression_minsize = new_compression_minsize;
|
||||
return SendPacket("OK");
|
||||
} else if (strstr(p, "type:lz4;") != nullptr) {
|
||||
EnableCompressionNextSendPacket(compression_types::lz4);
|
||||
m_compression_minsize = new_compression_minsize;
|
||||
return SendPacket("OK");
|
||||
} else if (strstr(p, "type:lzma;") != nullptr) {
|
||||
EnableCompressionNextSendPacket(compression_types::lzma);
|
||||
m_compression_minsize = new_compression_minsize;
|
||||
return SendPacket("OK");
|
||||
} else if (strstr(p, "type:lzfse;") != nullptr) {
|
||||
EnableCompressionNextSendPacket(compression_types::lzfse);
|
||||
m_compression_minsize = new_compression_minsize;
|
||||
return SendPacket("OK");
|
||||
}
|
||||
if (strstr(p, "type:zlib-deflate;") != nullptr) {
|
||||
EnableCompressionNextSendPacket(compression_types::zlib_deflate);
|
||||
m_compression_minsize = new_compression_minsize;
|
||||
return SendPacket("OK");
|
||||
} else if (strstr(p, "type:lz4;") != nullptr) {
|
||||
EnableCompressionNextSendPacket(compression_types::lz4);
|
||||
m_compression_minsize = new_compression_minsize;
|
||||
return SendPacket("OK");
|
||||
} else if (strstr(p, "type:lzma;") != nullptr) {
|
||||
EnableCompressionNextSendPacket(compression_types::lzma);
|
||||
m_compression_minsize = new_compression_minsize;
|
||||
return SendPacket("OK");
|
||||
} else if (strstr(p, "type:lzfse;") != nullptr) {
|
||||
EnableCompressionNextSendPacket(compression_types::lzfse);
|
||||
m_compression_minsize = new_compression_minsize;
|
||||
return SendPacket("OK");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue