Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ jobs:
runs-on: ubuntu-22.04
steps:
- run: |
echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main" | sudo tee /etc/apt/sources.list.d/llvm.list
echo "deb-src http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main" | sudo tee -a /etc/apt/sources.list.d/llvm.list
echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-20 main" | sudo tee /etc/apt/sources.list.d/llvm.list
echo "deb-src http://apt.llvm.org/jammy/ llvm-toolchain-jammy-20 main" | sudo tee -a /etc/apt/sources.list.d/llvm.list
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
sudo apt update && sudo apt-get install clang-format-17
sudo apt update && sudo apt-get install clang-format-20
shopt -s globstar
- uses: actions/checkout@v3
- run: find \( -name "*.h" -or -name "*.cpp" \) -exec clang-format-17 -i {} \;
- run: find \( -name "*.h" -or -name "*.cpp" \) -exec clang-format-20 -i {} \;
- run: find \( -name "*.h" -or -name "*.cpp" \) -exec ./.github/scripts/add-newline-if-missing.sh {} \;
- uses: ./.github/actions/process-linting-results
with:
Expand Down
12 changes: 6 additions & 6 deletions src/io_engine_generic_unix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,13 @@ namespace asyncpp::io::detail {
throw std::system_error(std::make_error_code(std::errc::invalid_argument),
"group and interface need to be of the same type");
if (group.is_ipv4()) {
struct ip_mreq mc_req {};
struct ip_mreq mc_req{};
mc_req.imr_multiaddr = group.ipv4().to_sockaddr_in().first.sin_addr;
mc_req.imr_interface = iface.ipv4().to_sockaddr_in().first.sin_addr;
auto res = setsockopt(socket, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mc_req, sizeof(mc_req));
if (res < 0) throw std::system_error(errno, std::system_category(), "setsockopt failed");
} else if (group.is_ipv6()) {
struct ipv6_mreq mc_req {};
struct ipv6_mreq mc_req{};
mc_req.ipv6mr_multiaddr = group.ipv6().to_sockaddr_in6().first.sin6_addr;
mc_req.ipv6mr_interface = iface.ipv6().to_sockaddr_in6().first.sin6_scope_id;
auto res = setsockopt(socket, IPPROTO_IPV6, IPV6_JOIN_GROUP, &mc_req, sizeof(mc_req));
Expand All @@ -168,13 +168,13 @@ namespace asyncpp::io::detail {
throw std::system_error(std::make_error_code(std::errc::invalid_argument),
"group and interface need to be of the same type");
if (group.is_ipv4()) {
struct ip_mreq mc_req {};
struct ip_mreq mc_req{};
mc_req.imr_multiaddr = group.ipv4().to_sockaddr_in().first.sin_addr;
mc_req.imr_interface = iface.ipv4().to_sockaddr_in().first.sin_addr;
auto res = setsockopt(socket, IPPROTO_IP, IP_DROP_MEMBERSHIP, &mc_req, sizeof(mc_req));
if (res < 0) throw std::system_error(errno, std::system_category(), "setsockopt failed");
} else if (group.is_ipv6()) {
struct ipv6_mreq mc_req {};
struct ipv6_mreq mc_req{};
mc_req.ipv6mr_multiaddr = group.ipv6().to_sockaddr_in6().first.sin6_addr;
mc_req.ipv6mr_interface = iface.ipv6().to_sockaddr_in6().first.sin6_scope_id;
auto res = setsockopt(socket, IPPROTO_IPV6, IPV6_LEAVE_GROUP, &mc_req, sizeof(mc_req));
Expand Down Expand Up @@ -283,12 +283,12 @@ namespace asyncpp::io::detail {

uint64_t io_engine_generic_unix::file_size(file_handle_t fd) {
#ifdef __APPLE__
struct stat info {};
struct stat info{};
auto res = fstat(fd, &info);
if (res < 0) throw std::system_error(errno, std::system_category());
return info.st_size;
#else
struct stat64 info {};
struct stat64 info{};
auto res = fstat64(fd, &info);
if (res < 0) throw std::system_error(errno, std::system_category());
return info.st_size;
Expand Down
10 changes: 5 additions & 5 deletions src/io_engine_iocp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ namespace asyncpp::io::detail {
if (setsockopt(listener, SOL_SOCKET, SO_REUSEADDR, (char*)&reuse, (socklen_t)sizeof(reuse)) == -1)
close_and_throw("setsockopt", listener);

struct sockaddr_in inaddr {};
struct sockaddr_in inaddr{};
inaddr.sin_family = AF_INET;
inaddr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
if (bind(listener, reinterpret_cast<sockaddr*>(&inaddr), sizeof(inaddr)) == SOCKET_ERROR)
Expand Down Expand Up @@ -357,14 +357,14 @@ namespace asyncpp::io::detail {
throw std::system_error(std::make_error_code(std::errc::invalid_argument),
"group and interface need to be of the same type");
if (group.is_ipv4()) {
struct ip_mreq mc_req {};
struct ip_mreq mc_req{};
mc_req.imr_multiaddr = group.ipv4().to_sockaddr_in().first.sin_addr;
mc_req.imr_interface = iface.ipv4().to_sockaddr_in().first.sin_addr;
auto res = setsockopt(socket, IPPROTO_IP, IP_ADD_MEMBERSHIP, reinterpret_cast<const char*>(&mc_req),
sizeof(mc_req));
if (res < 0) throw std::system_error(WSAGetLastError(), std::system_category(), "setsockopt failed");
} else if (group.is_ipv6()) {
struct ipv6_mreq mc_req {};
struct ipv6_mreq mc_req{};
mc_req.ipv6mr_multiaddr = group.ipv6().to_sockaddr_in6().first.sin6_addr;
mc_req.ipv6mr_interface = iface.ipv6().to_sockaddr_in6().first.sin6_scope_id;
auto res = setsockopt(socket, IPPROTO_IPV6, IPV6_ADD_MEMBERSHIP, reinterpret_cast<const char*>(&mc_req),
Expand All @@ -381,14 +381,14 @@ namespace asyncpp::io::detail {
throw std::system_error(std::make_error_code(std::errc::invalid_argument),
"group and interface need to be of the same type");
if (group.is_ipv4()) {
struct ip_mreq mc_req {};
struct ip_mreq mc_req{};
mc_req.imr_multiaddr = group.ipv4().to_sockaddr_in().first.sin_addr;
mc_req.imr_interface = iface.ipv4().to_sockaddr_in().first.sin_addr;
auto res = setsockopt(socket, IPPROTO_IP, IP_DROP_MEMBERSHIP, reinterpret_cast<const char*>(&mc_req),
sizeof(mc_req));
if (res < 0) throw std::system_error(WSAGetLastError(), std::system_category(), "setsockopt failed");
} else if (group.is_ipv6()) {
struct ipv6_mreq mc_req {};
struct ipv6_mreq mc_req{};
mc_req.ipv6mr_multiaddr = group.ipv6().to_sockaddr_in6().first.sin6_addr;
mc_req.ipv6mr_interface = iface.ipv6().to_sockaddr_in6().first.sin6_scope_id;
auto res = setsockopt(socket, IPPROTO_IPV6, IPV6_DROP_MEMBERSHIP, reinterpret_cast<const char*>(&mc_req),
Expand Down
2 changes: 1 addition & 1 deletion src/io_engine_select.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ namespace asyncpp::io::detail {
max_fd = (std::max)(e.socket, max_fd);
}
lck.unlock();
struct timeval timeout {};
struct timeval timeout{};
if (!nowait) timeout.tv_sec = 10;
auto res = select(max_fd + 1, &rd_set, &wrt_set, &err_set, &timeout);
if (res < 0) throw std::system_error(errno, std::system_category(), "select failed");
Expand Down
2 changes: 1 addition & 1 deletion src/io_engine_uring.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ namespace asyncpp::io::detail {
std::mutex m_sqe_mtx{};
std::mutex m_cqe_mtx{};
std::atomic<size_t> m_inflight_count{};
struct io_uring m_ring {};
struct io_uring m_ring{};
};

std::unique_ptr<io_engine> create_io_engine_uring() {
Expand Down