From 270c0c8ef5f5ada5a7dd02a7697dedcfc0d00272 Mon Sep 17 00:00:00 2001 From: Bradley Dice Date: Wed, 14 May 2025 11:18:57 -0500 Subject: [PATCH] Update to clang 20. --- .pre-commit-config.yaml | 2 +- cpp/src/wholememory/communicator.cpp | 4 ++-- cpp/src/wholememory/file_io.cpp | 6 +++--- cpp/src/wholememory/memory_handle.cpp | 10 ++++------ 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 87a67ad5..63d702c0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -35,7 +35,7 @@ repos: additional_dependencies: - flake8==7.1.1 - repo: https://github.com/pre-commit/mirrors-clang-format - rev: v16.0.6 + rev: v20.1.4 hooks: - id: clang-format types_or: [c, c++, cuda] diff --git a/cpp/src/wholememory/communicator.cpp b/cpp/src/wholememory/communicator.cpp index 34053ad7..517dd5ad 100644 --- a/cpp/src/wholememory/communicator.cpp +++ b/cpp/src/wholememory/communicator.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2024, NVIDIA CORPORATION. + * Copyright (c) 2019-2025, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -481,7 +481,7 @@ void get_boot_id(char* host_id, size_t len) void get_shm_devid(dev_t* shm_dev) { - struct stat statbuf {}; + struct stat statbuf{}; WHOLEMEMORY_CHECK(stat("/dev/shm", &statbuf) == 0); *shm_dev = statbuf.st_dev; } diff --git a/cpp/src/wholememory/file_io.cpp b/cpp/src/wholememory/file_io.cpp index 31b87c14..03a4de20 100644 --- a/cpp/src/wholememory/file_io.cpp +++ b/cpp/src/wholememory/file_io.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2024, NVIDIA CORPORATION. + * Copyright (c) 2019-2025, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,7 +40,7 @@ static bool IsFileExist(const char* filename, int mode) { return access(filename static size_t StatFileSize(const char* filename) { auto filesize = static_cast(-1); - struct stat statbuf {}; + struct stat statbuf{}; if (stat(filename, &statbuf) < 0) { return filesize; } filesize = statbuf.st_size; return filesize; @@ -49,7 +49,7 @@ static size_t StatFileSize(const char* filename) static size_t StatFileBlockSize(const char* filename) { auto blocksize = static_cast(-1); - struct stat statbuf {}; + struct stat statbuf{}; if (stat(filename, &statbuf) < 0) { return blocksize; } blocksize = statbuf.st_blksize; return blocksize; diff --git a/cpp/src/wholememory/memory_handle.cpp b/cpp/src/wholememory/memory_handle.cpp index f5cbd622..2a4d7a94 100644 --- a/cpp/src/wholememory/memory_handle.cpp +++ b/cpp/src/wholememory/memory_handle.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2024, NVIDIA CORPORATION. + * Copyright (c) 2019-2025, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -746,9 +746,7 @@ class continuous_device_wholememory_impl : public wholememory_impl { static int ipc_open_socket(const std::string& name) { int sock = -1; - struct sockaddr_un skt_addr { - 0 - }; + struct sockaddr_un skt_addr{0}; if ((sock = socket(AF_UNIX, SOCK_DGRAM, 0)) < 0) { WHOLEMEMORY_FATAL("IPC failure: Socket creation error."); } @@ -830,7 +828,7 @@ class continuous_device_wholememory_impl : public wholememory_impl { const ipc_sharable_cu_handle& sent_handle, const std::string& dst_name) { - struct msghdr message_header {}; + struct msghdr message_header{}; struct iovec iov[1]; union { @@ -839,7 +837,7 @@ class continuous_device_wholememory_impl : public wholememory_impl { } control_un{}; struct cmsghdr* cmptr; - struct sockaddr_un cliaddr {}; + struct sockaddr_un cliaddr{}; // Construct client address to send this Shareable handle to bzero(&cliaddr, sizeof(cliaddr));