Skip to content

Commit

Permalink
More clang tidy things
Browse files Browse the repository at this point in the history
  • Loading branch information
TrentHouliston committed Aug 9, 2024
1 parent 6cd5848 commit c68e1b6
Show file tree
Hide file tree
Showing 12 changed files with 18 additions and 15 deletions.
3 changes: 2 additions & 1 deletion src/threading/Reaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

#include "Reaction.hpp"

#include <memory>
#include <utility>

#include "../id.hpp"
Expand All @@ -39,7 +40,7 @@ namespace threading {
, identifiers(std::make_shared<ReactionIdentifiers>(std::move(identifiers)))
, generator(std::move(generator)) {}

Reaction::~Reaction() {}
Reaction::~Reaction() = default;

std::unique_ptr<ReactionTask> Reaction::get_task() {

Expand Down
7 changes: 2 additions & 5 deletions src/threading/ReactionIdentifiers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,8 @@ namespace threading {
* @param dsl the DSL that this reaction was created from
* @param function the callback function that this reaction is bound to
*/
ReactionIdentifiers(const std::string& name,
const std::string& reactor,
const std::string& dsl,
const std::string& function)
: name(name), reactor(reactor), dsl(dsl), function(function) {}
ReactionIdentifiers(std::string name, std::string reactor, std::string dsl, std::string function)
: name(std::move(name)), reactor(std::move(reactor)), dsl(std::move(dsl)), function(std::move(function)) {}

/// The name of the reaction provided by the user
std::string name;
Expand Down
1 change: 0 additions & 1 deletion src/threading/ReactionTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

#include <atomic>
#include <functional>
#include <memory>
#include <utility>

#include "../id.hpp"
Expand Down
2 changes: 1 addition & 1 deletion src/threading/ReactionTask.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ namespace threading {
*
* @return true if the current object is less than the other object, false otherwise.
*/
inline bool operator<(const ReactionTask& other) const {
bool operator<(const ReactionTask& other) const {
return priority == other.priority ? id < other.id : priority > other.priority;
}
};
Expand Down
3 changes: 2 additions & 1 deletion src/threading/scheduler/CombinedLock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@
#include "CombinedLock.hpp"

#include <memory>
#include <thread>
#include <utility>

#include "Lock.hpp"

namespace NUClear {
namespace threading {
namespace scheduler {
Expand Down
2 changes: 1 addition & 1 deletion src/util/GroupDescriptor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ namespace util {
*
* @return true if this group_id is less than the other group_id
*/
inline bool operator<(const GroupDescriptor& other) const {
bool operator<(const GroupDescriptor& other) const {
return group_id < other.group_id;
}
};
Expand Down
4 changes: 2 additions & 2 deletions src/util/ThreadPoolDescriptor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ namespace util {
*/
struct ThreadPoolDescriptor {
ThreadPoolDescriptor() = default;
ThreadPoolDescriptor(const std::string& name,
ThreadPoolDescriptor(std::string name,
const NUClear::id_t& pool_id,
size_t thread_count = 1,
bool counts_for_idle = true)
: name(name), pool_id(pool_id), thread_count(thread_count), counts_for_idle(counts_for_idle) {}
: name(std::move(name)), pool_id(pool_id), thread_count(thread_count), counts_for_idle(counts_for_idle) {}

static ThreadPoolDescriptor AllPools() {
return ThreadPoolDescriptor{"All", NUClear::id_t(-1), size_t(-1), false};
Expand Down
3 changes: 3 additions & 0 deletions src/util/network/get_interfaces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

#include <cstring>
#include <system_error>
#include <vector>

#include "../platform.hpp"

Expand Down Expand Up @@ -176,13 +177,15 @@ namespace util {
switch (it->ifa_addr->sa_family) {
case AF_INET: std::memcpy(&iface.netmask, it->ifa_netmask, sizeof(sockaddr_in)); break;
case AF_INET6: std::memcpy(&iface.netmask, it->ifa_netmask, sizeof(sockaddr_in6)); break;
default: break; // We don't care about other address families
}
}

if (it->ifa_dstaddr != nullptr) {
switch (it->ifa_addr->sa_family) {
case AF_INET: std::memcpy(&iface.broadcast, it->ifa_dstaddr, sizeof(sockaddr_in)); break;
case AF_INET6: std::memcpy(&iface.broadcast, it->ifa_dstaddr, sizeof(sockaddr_in6)); break;
default: break; // We don't care about other address families
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/util/network/get_interfaces.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace util {
*/
struct Interface {
/// The name of the interface
std::string name{};
std::string name;

/// The address that is bound to the interface
sock_t ip{};
Expand Down
4 changes: 2 additions & 2 deletions src/util/platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

#include "platform.hpp"

#ifdef _WIN32

#include "platform.hpp"

#include <stdexcept>
#include <system_error>
LPFN_WSARECVMSG WSARecvMsg = nullptr;
Expand Down
1 change: 1 addition & 0 deletions src/util/serialise/xxhash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

#include "xxhash.hpp"

#include <cstddef>
#include <cstdint>
#include <type_traits>

Expand Down
1 change: 1 addition & 0 deletions src/util/usage_clock.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "usage_clock.hpp"

#include <chrono>

// Windows
#if defined(_WIN32)
Expand Down

0 comments on commit c68e1b6

Please sign in to comment.