diff --git a/libuavcan/include/uavcan/dynamic_memory.hpp b/libuavcan/include/uavcan/dynamic_memory.hpp index 6e605af022..0804b8f739 100644 --- a/libuavcan/include/uavcan/dynamic_memory.hpp +++ b/libuavcan/include/uavcan/dynamic_memory.hpp @@ -48,7 +48,7 @@ class UAVCAN_EXPORT PoolManager : public IPoolAllocator, Noncopyable public: PoolManager() { - std::memset(pools_, 0, sizeof(pools_)); + (void)std::memset(pools_, 0, sizeof(pools_)); } bool addPool(IPoolAllocator* pool); @@ -229,7 +229,7 @@ template PoolAllocator::PoolAllocator() : free_list_(reinterpret_cast(pool_.bytes)) { - std::memset(pool_.bytes, 0, PoolSize); + (void)std::memset(pool_.bytes, 0, PoolSize); for (unsigned i = 0; (i + 1) < (NumBlocks - 1 + 1); i++) // -Werror=type-limits { // coverity[dead_error_line : FALSE] diff --git a/libuavcan/include/uavcan/marshal/array.hpp b/libuavcan/include/uavcan/marshal/array.hpp index 89d6190474..0b90c001ae 100644 --- a/libuavcan/include/uavcan/marshal/array.hpp +++ b/libuavcan/include/uavcan/marshal/array.hpp @@ -89,7 +89,7 @@ protected: { if (size_ >= MaxSize) { - validateRange(MaxSize); // Will throw, assert() or do nothing + (void)validateRange(MaxSize); // Will throw, assert() or do nothing } else { @@ -435,7 +435,7 @@ class UAVCAN_EXPORT Array : public ArrayImpl } else if (this->size() == MaxSize) { - std::copy(this->begin(), this->end(), it); + (void)std::copy(this->begin(), this->end(), it); } else { diff --git a/libuavcan/src/marshal/uc_bit_array_copy.cpp b/libuavcan/src/marshal/uc_bit_array_copy.cpp index b42f1dc161..54ab2e48d7 100644 --- a/libuavcan/src/marshal/uc_bit_array_copy.cpp +++ b/libuavcan/src/marshal/uc_bit_array_copy.cpp @@ -56,7 +56,7 @@ void bitarrayCopy(const unsigned char* src_org, int src_offset, int src_len, uns if (byte_len) { - std::memcpy(dst, src, byte_len); + (void)std::memcpy(dst, src, byte_len); src += byte_len; dst += byte_len; } diff --git a/libuavcan/src/marshal/uc_bit_stream.cpp b/libuavcan/src/marshal/uc_bit_stream.cpp index 9c68007136..901357cf71 100644 --- a/libuavcan/src/marshal/uc_bit_stream.cpp +++ b/libuavcan/src/marshal/uc_bit_stream.cpp @@ -94,9 +94,9 @@ std::string BitStream::toString() const } out += ' '; } - if (out.length()) + if (out.length() > 0) { - out.erase(out.length() - 1, 1); + (void)out.erase(out.length() - 1, 1); } return out; } diff --git a/libuavcan/src/marshal/uc_float_spec.cpp b/libuavcan/src/marshal/uc_float_spec.cpp index 3200128198..be51793d7a 100644 --- a/libuavcan/src/marshal/uc_float_spec.cpp +++ b/libuavcan/src/marshal/uc_float_spec.cpp @@ -67,7 +67,7 @@ uint16_t IEEE754Converter::nativeNonIeeeToHalf(float value) return hbits | 0x7C00U; } int exp; - std::frexp(value, &exp); + (void)std::frexp(value, &exp); if (exp > 16) { return hbits | 0x7C00U; diff --git a/libuavcan/src/node/uc_global_data_type_registry.cpp b/libuavcan/src/node/uc_global_data_type_registry.cpp index f8aca9d9f4..1af1c8ab08 100644 --- a/libuavcan/src/node/uc_global_data_type_registry.cpp +++ b/libuavcan/src/node/uc_global_data_type_registry.cpp @@ -231,7 +231,7 @@ DataTypeSignature GlobalDataTypeRegistry::computeAggregateSignature(DataTypeKind void GlobalDataTypeRegistry::getDataTypeIDMask(DataTypeKind kind, DataTypeIDMask& mask) const { - mask.reset(); + (void)mask.reset(); const List* list = selectList(kind); if (!list) { diff --git a/libuavcan/src/protocol/uc_network_compat_checker.cpp b/libuavcan/src/protocol/uc_network_compat_checker.cpp index 96904a790c..b4488d4573 100644 --- a/libuavcan/src/protocol/uc_network_compat_checker.cpp +++ b/libuavcan/src/protocol/uc_network_compat_checker.cpp @@ -131,7 +131,7 @@ int NetworkCompatibilityChecker::checkOneNode(NodeID nid) int NetworkCompatibilityChecker::checkNodes() { - nid_mask_checked_.reset(); + (void)nid_mask_checked_.reset(); while (true) { const NodeID nid = findNextUncheckedNode(); diff --git a/libuavcan/src/transport/uc_frame.cpp b/libuavcan/src/transport/uc_frame.cpp index 145f78f58f..7c1814b704 100644 --- a/libuavcan/src/transport/uc_frame.cpp +++ b/libuavcan/src/transport/uc_frame.cpp @@ -41,7 +41,7 @@ int Frame::setPayload(const uint8_t* data, unsigned len) return maxlen; } len = std::min(unsigned(maxlen), len); - std::copy(data, data + len, payload_); + (void)std::copy(data, data + len, payload_); payload_len_ = len; return len; } @@ -85,7 +85,7 @@ bool Frame::parse(const CanFrame& can_frame) { dst_node_id_ = NodeID::Broadcast; payload_len_ = can_frame.dlc; - std::copy(can_frame.data, can_frame.data + can_frame.dlc, payload_); + (void)std::copy(can_frame.data, can_frame.data + can_frame.dlc, payload_); break; } case TransferTypeServiceResponse: @@ -102,7 +102,7 @@ bool Frame::parse(const CanFrame& can_frame) } dst_node_id_ = can_frame.data[0] & 0x7F; payload_len_ = can_frame.dlc - 1; - std::copy(can_frame.data + 1, can_frame.data + can_frame.dlc, payload_); + (void)std::copy(can_frame.data + 1, can_frame.data + can_frame.dlc, payload_); break; } default: @@ -142,7 +142,7 @@ bool Frame::compile(CanFrame& out_can_frame) const case TransferTypeMessageBroadcast: { out_can_frame.dlc = payload_len_; - std::copy(payload_, payload_ + payload_len_, out_can_frame.data); + (void)std::copy(payload_, payload_ + payload_len_, out_can_frame.data); break; } case TransferTypeServiceResponse: @@ -152,7 +152,7 @@ bool Frame::compile(CanFrame& out_can_frame) const assert((payload_len_ + 1) <= sizeof(out_can_frame.data)); out_can_frame.data[0] = dst_node_id_.get(); out_can_frame.dlc = payload_len_ + 1; - std::copy(payload_, payload_ + payload_len_, out_can_frame.data + 1); + (void)std::copy(payload_, payload_ + payload_len_, out_can_frame.data + 1); break; } default: diff --git a/libuavcan/src/transport/uc_transfer_buffer.cpp b/libuavcan/src/transport/uc_transfer_buffer.cpp index 03c23f9833..7971e46a0f 100644 --- a/libuavcan/src/transport/uc_transfer_buffer.cpp +++ b/libuavcan/src/transport/uc_transfer_buffer.cpp @@ -16,7 +16,7 @@ std::string TransferBufferManagerKey::toString() const { using namespace std; // For snprintf() char buf[24]; - snprintf(buf, sizeof(buf), "nid=%i tt=%i", int(node_id_.get()), int(transfer_type_)); + (void)snprintf(buf, sizeof(buf), "nid=%i tt=%i", int(node_id_.get()), int(transfer_type_)); return std::string(buf); } #endif @@ -239,7 +239,7 @@ int StaticTransferBufferImpl::read(unsigned offset, uint8_t* data, unsigned len) len = max_write_pos_ - offset; } assert((offset + len) <= max_write_pos_); - std::copy(data_ + offset, data_ + offset + len, data); + (void)std::copy(data_ + offset, data_ + offset + len, data); return len; } @@ -259,7 +259,7 @@ int StaticTransferBufferImpl::write(unsigned offset, const uint8_t* data, unsign len = size_ - offset; } assert((offset + len) <= size_); - std::copy(data, data + len, data_ + offset); + (void)std::copy(data, data + len, data_ + offset); max_write_pos_ = std::max(offset + len, unsigned(max_write_pos_)); return len; } diff --git a/libuavcan/src/transport/uc_transfer_listener.cpp b/libuavcan/src/transport/uc_transfer_listener.cpp index 46422c7a1a..82b25421a8 100644 --- a/libuavcan/src/transport/uc_transfer_listener.cpp +++ b/libuavcan/src/transport/uc_transfer_listener.cpp @@ -46,7 +46,7 @@ int SingleFrameIncomingTransfer::read(unsigned offset, uint8_t* data, unsigned l len = payload_len_ - offset; } assert((offset + len) <= payload_len_); - std::copy(payload_ + offset, payload_ + offset + len, data); + (void)std::copy(payload_ + offset, payload_ + offset + len, data); return len; } diff --git a/libuavcan/src/transport/uc_transfer_sender.cpp b/libuavcan/src/transport/uc_transfer_sender.cpp index 45d6948272..97dd53a1b8 100644 --- a/libuavcan/src/transport/uc_transfer_sender.cpp +++ b/libuavcan/src/transport/uc_transfer_sender.cpp @@ -49,7 +49,7 @@ int TransferSender::send(const uint8_t* payload, int payload_len, MonotonicTime buf[0] = crc.get() & 0xFF; // Transfer CRC, little endian buf[1] = (crc.get() >> 8) & 0xFF; - std::copy(payload, payload + BUFLEN - 2, buf + 2); + (void)std::copy(payload, payload + BUFLEN - 2, buf + 2); const int write_res = frame.setPayload(buf, BUFLEN); if (write_res < 2) diff --git a/libuavcan_drivers/linux/include/uavcan_linux/socketcan.hpp b/libuavcan_drivers/linux/include/uavcan_linux/socketcan.hpp index b8784e1114..3906cc3683 100644 --- a/libuavcan_drivers/linux/include/uavcan_linux/socketcan.hpp +++ b/libuavcan_drivers/linux/include/uavcan_linux/socketcan.hpp @@ -51,7 +51,7 @@ class SocketCanIface : public uavcan::ICanIface static inline ::can_frame makeSocketCanFrame(const uavcan::CanFrame& uavcan_frame) { ::can_frame sockcan_frame { uavcan_frame.id & uavcan::CanFrame::MaskExtID, uavcan_frame.dlc, { } }; - std::copy(uavcan_frame.data, uavcan_frame.data + uavcan_frame.dlc, sockcan_frame.data); + (void)std::copy(uavcan_frame.data, uavcan_frame.data + uavcan_frame.dlc, sockcan_frame.data); if (uavcan_frame.isExtended()) { sockcan_frame.can_id |= CAN_EFF_FLAG; @@ -152,7 +152,7 @@ class SocketCanIface : public uavcan::ICanIface { if (pending_loopback_ids_.count(frame.id) > 0) { - pending_loopback_ids_.erase(frame.id); + (void)pending_loopback_ids_.erase(frame.id); return true; } return false; @@ -214,7 +214,7 @@ class SocketCanIface : public uavcan::ICanIface if (cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SO_TIMESTAMP) { auto tv = ::timeval(); - std::memcpy(&tv, CMSG_DATA(cmsg), sizeof(tv)); // Copy to avoid alignment problems + (void)std::memcpy(&tv, CMSG_DATA(cmsg), sizeof(tv)); // Copy to avoid alignment problems assert(tv.tv_sec >= 0 && tv.tv_usec >= 0); ts_utc = uavcan::UtcTime::fromUSec(std::uint64_t(tv.tv_sec) * 1000000ULL + tv.tv_usec); } @@ -245,7 +245,7 @@ class SocketCanIface : public uavcan::ICanIface incrementNumFramesInSocketTxQueue(); if (tx.flags & uavcan::CanIOFlagLoopback) { - pending_loopback_ids_.insert(tx.frame.id); + (void)pending_loopback_ids_.insert(tx.frame.id); } } else @@ -437,7 +437,7 @@ public: { goto fail; } - std::strncpy(ifr.ifr_name, iface_name.c_str(), iface_name.length()); + (void)std::strncpy(ifr.ifr_name, iface_name.c_str(), iface_name.length()); if (::ioctl(s, SIOCGIFINDEX, &ifr) < 0 || ifr.ifr_ifindex < 0) { goto fail; @@ -474,7 +474,7 @@ public: return s; fail: - ::close(s); + (void)::close(s); return -1; } };