Skip to content

Commit

Permalink
Fix some minor clang-tidy issues (#152)
Browse files Browse the repository at this point in the history
- Closes #147.

Authors:
  - Lawrence Mitchell (https://github.com/wence-)
  - Peter Andreas Entschev (https://github.com/pentschev)

Approvers:
  - Peter Andreas Entschev (https://github.com/pentschev)

URL: #152
  • Loading branch information
wence- authored Jan 9, 2024
1 parent 94c5dd7 commit 2a19c57
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 20 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BSD 3-Clause License

Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
Copyright (c) 2022-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Expand Down
4 changes: 2 additions & 2 deletions cpp/include/ucxx/constructors.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/**
* SPDX-FileCopyrightText: Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES.
* SPDX-FileCopyrightText: Copyright (c) 2022-2024, NVIDIA CORPORATION & AFFILIATES.
* SPDX-License-Identifier: BSD-3-Clause
*/
#pragma once

#include <memory>
#include <string>
#include <vector>

#include <ucxx/component.h>
#include <ucxx/request_data.h>
#include <ucxx/typedefs.h>

Expand Down
4 changes: 2 additions & 2 deletions cpp/include/ucxx/request_am.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* SPDX-FileCopyrightText: Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES.
* SPDX-FileCopyrightText: Copyright (c) 2022-2024, NVIDIA CORPORATION & AFFILIATES.
* SPDX-License-Identifier: BSD-3-Clause
*/
#pragma once
Expand Down Expand Up @@ -90,7 +90,7 @@ class RequestAm : public Request {
RequestCallbackUserFunction callbackFunction,
RequestCallbackUserData callbackData);

virtual void populateDelayedSubmission();
void populateDelayedSubmission() override;

/**
* @brief Create and submit an active message send request.
Expand Down
4 changes: 3 additions & 1 deletion cpp/python/include/ucxx/python/constructors.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
/**
* SPDX-FileCopyrightText: Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES.
* SPDX-FileCopyrightText: Copyright (c) 2023-2024, NVIDIA CORPORATION & AFFILIATES.
* SPDX-License-Identifier: BSD-3-Clause
*/
#pragma once

#include <memory>

#include <Python.h>

#include <ucxx/buffer.h>

namespace ucxx {
Expand Down
3 changes: 2 additions & 1 deletion cpp/python/src/python_future.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
/**
* SPDX-FileCopyrightText: Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES.
* SPDX-FileCopyrightText: Copyright (c) 2022-2024, NVIDIA CORPORATION & AFFILIATES.
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <memory>
#include <stdexcept>
#include <utility>

#include <Python.h>

Expand Down
8 changes: 4 additions & 4 deletions cpp/src/request_am.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* SPDX-FileCopyrightText: Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES.
* SPDX-FileCopyrightText: Copyright (c) 2022-2024, NVIDIA CORPORATION & AFFILIATES.
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <cstdio>
Expand Down Expand Up @@ -145,7 +145,7 @@ ucs_status_t RequestAm::recvCallback(void* arg,
// recvAmMessage.callback(nullptr, UCS_ERR_UNSUPPORTED);
// return UCS_ERR_UNSUPPORTED;

ucxx_trace_req("No allocator registered for memory type %lu, falling back to host memory.",
ucxx_trace_req("No allocator registered for memory type %u, falling back to host memory.",
allocatorType);
allocatorType = UCS_MEMORY_TYPE_HOST;
}
Expand Down Expand Up @@ -292,7 +292,7 @@ void RequestAm::populateDelayedSubmission()
ucxx_trace_req_f(_ownerString.c_str(),
_request,
_operationName.c_str(),
"buffer %p, size %lu, memoryType: %lu, future %p, future handle %p, "
"buffer %p, size %lu, memoryType: %u, future %p, future handle %p, "
"populateDelayedSubmission",
buffer,
length,
Expand All @@ -303,7 +303,7 @@ void RequestAm::populateDelayedSubmission()
ucxx_trace_req_f(_ownerString.c_str(),
_request,
_operationName.c_str(),
"buffer %p, size %lu, memoryType: %lu, populateDelayedSubmission",
"buffer %p, size %lu, memoryType: %u, populateDelayedSubmission",
buffer,
length,
memoryType);
Expand Down
6 changes: 2 additions & 4 deletions cpp/src/request_tag_multi.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
/**
* SPDX-FileCopyrightText: Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES.
* SPDX-FileCopyrightText: Copyright (c) 2022-2024, NVIDIA CORPORATION & AFFILIATES.
* SPDX-License-Identifier: BSD-3-Clause
*/
#include "ucxx/delayed_submission.h"
#include <functional>
#include <memory>
#include <mutex>
#include <string>
Expand Down Expand Up @@ -273,7 +271,7 @@ void RequestTagMulti::recvCallback(ucs_status_t status)
ucxx_trace_req(
"RequestTagMulti::recvCallback failed receiving header with status %d (%s), multi request: "
"%p, "
"tag: 0x%lx",
"tag: 0x%lx, "
"tagMask: 0x%lx",
status,
ucs_status_string(status),
Expand Down
9 changes: 6 additions & 3 deletions cpp/src/utils/sockaddr.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* SPDX-FileCopyrightText: Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES.
* SPDX-FileCopyrightText: Copyright (c) 2022-2024, NVIDIA CORPORATION & AFFILIATES.
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <arpa/inet.h>
Expand Down Expand Up @@ -51,13 +51,16 @@ void sockaddr_get_ip_port_str(const struct sockaddr_storage* sockaddr,
addr_in = reinterpret_cast<decltype(addr_in)>(sockaddr);
inet_ntop(AF_INET, &addr_in->sin_addr, ip_str, max_str_size);
snprintf(port_str, max_str_size, "%u", ntohs(addr_in->sin_port));
break;
case AF_INET6:
addr_in6 = reinterpret_cast<decltype(addr_in6)>(sockaddr);
inet_ntop(AF_INET6, &addr_in6->sin6_addr, ip_str, max_str_size);
snprintf(port_str, max_str_size, "%u", ntohs(addr_in6->sin6_port));
break;
default:
ip_str = const_cast<char*>(reinterpret_cast<const char*>("Invalid address family"));
port_str = const_cast<char*>(reinterpret_cast<const char*>("Invalid address family"));
snprintf(ip_str, max_str_size, "Invalid address family");
snprintf(port_str, max_str_size, "Invalid address family");
break;
}
}

Expand Down
6 changes: 4 additions & 2 deletions cpp/src/worker.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* SPDX-FileCopyrightText: Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES.
* SPDX-FileCopyrightText: Copyright (c) 2022-2024, NVIDIA CORPORATION & AFFILIATES.
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <functional>
Expand Down Expand Up @@ -204,7 +204,9 @@ void Worker::initBlockingProgressMode()
}};

err = epoll_ctl(_epollFileDescriptor, EPOLL_CTL_ADD, _workerFileDescriptor, &workerEvent);
if (err != 0) throw std::ios_base::failure(std::string("epoll_ctl() returned " + err));
if (err != 0) {
throw std::ios_base::failure(std::string("epoll_ctl() returned ") + std::to_string(err));
}
}

bool Worker::arm()
Expand Down

0 comments on commit 2a19c57

Please sign in to comment.