-# This configuration should work with Clang-Format 11 and higher.
+# This configuration should work with Clang-Format 18 and higher.
---
Language: Cpp
BasedOnStyle: LLVM
style](https://llvm.org/docs/CodingStandards.html) with some exceptions. Run
`make format` (or `ninja format` if you use Ninja) to format changes according
to ccache's code style. Or even better: set up your editor to run
-`<ccache-top-dir>/misc/clang-format` (or any other Clang-Format version 11
+`<ccache-top-dir>/misc/clang-format` (or any other Clang-Format version 18
binary) automatically when saving. Newer Clang-Format versions likely also work
fine.
misc_dir="$(dirname "$0")"
clang_format_exe="${misc_dir}/.clang-format-exe"
-clang_format_version=11
-clang_format_release=master-1d7ec53d
+clang_format_version=18
+clang_format_release=master-2da3e7b
url_prefix="https://github.com/muttleyxd/clang-tools-static-binaries/releases/download/${clang_format_release}/clang-format-${clang_format_version}_"
if [ ! -x "$clang_format_exe" ]; then
case "$(uname -s | tr '[:upper:]' '[:lower:]')" in
*mingw*|*cygwin*|*msys*)
url_suffix=windows-amd64.exe
- checksum=7167f201acbd8ff06a7327d14db0d8a169393384bbc42873bb8277b788cc4469
+ checksum=4c7c29320e7b17901fa39ad7068b309756c121b83e4008669711e55dd4459793
;;
*darwin*)
url_suffix=macosx-amd64
- checksum=0cab857e66aa9ed9ea00eee3c94bfc91a2d72ab440327e15784852cf94b1814b
+ checksum=aebb3bc3f6fa286373e03c096ae0a6408d37e8f837b43cdbda6f6203ba2bbb14
;;
*linux*)
url_suffix=linux-amd64
- checksum=a9d76e3275823ea308bc2e4d2a6e3cc693f38c29d891f1d74cb0e1553e698dea
+ checksum=d126ba919b7913cd352ca669c669024c0edac3e93311d9a52a45bffb6169f4de
;;
*)
echo "Error: Please set CLANG_FORMAT to clang-format version $clang_format_version" >&2
if ! command -v sha256sum >/dev/null; then
echo "Warning: sha256sum not found, not verifying clang-format integrity" >&2
elif ! echo "$checksum $clang_format_exe.tmp" | sha256sum --status -c -; then
- echo "Error: Bad checksum of downloaded clang-format" >&2
+ echo "Error: Bad checksum of downloaded clang-format: expected ${checksum}, actual $(sha256sum ${clang_format_exe}.tmp | awk '{print $1}')" >&2
exit 1
fi
} // namespace
-#define FIELD(id, ...) \
- { \
- Statistic::id, #id, __VA_ARGS__ \
- }
+#define FIELD(id, ...) {Statistic::id, #id, __VA_ARGS__}
const StatisticsField k_statistics_fields[] = {
// Field "none" intentionally omitted.
url.port().empty()
? DEFAULT_PORT
: static_cast<uint32_t>(util::value_or_throw<core::Fatal>(
- util::parse_unsigned(url.port(), 1, 65535, "port")));
+ util::parse_unsigned(url.port(), 1, 65535, "port")));
ASSERT(url.path().empty() || url.path()[0] == '/');
LOG("Redis connecting to {}:{} (connect timeout {} ms)",
const uint32_t db_number =
!db ? 0
: static_cast<uint32_t>(
- util::value_or_throw<core::Fatal>(util::parse_unsigned(
- *db, 0, std::numeric_limits<uint32_t>::max(), "db number")));
+ util::value_or_throw<core::Fatal>(util::parse_unsigned(
+ *db, 0, std::numeric_limits<uint32_t>::max(), "db number")));
if (db_number != 0) {
LOG("Redis SELECT {}", db_number);
-// Copyright (C) 2021-2024 Joel Rosdahl and other contributors
+// Copyright (C) 2021-2025 Joel Rosdahl and other contributors
//
// See doc/AUTHORS.adoc for a complete list of contributors.
//
# endif
# ifndef S_ISREG
-# define S_ISREG(m) (((m)&S_IFMT) == S_IFREG)
+# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
# endif
# ifndef S_ISDIR
-# define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR)
+# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
# endif
# ifndef S_ISFIFO
-# define S_ISFIFO(m) (((m)&S_IFMT) == S_IFIFO)
+# define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
# endif
# ifndef S_ISCHR
-# define S_ISCHR(m) (((m)&S_IFMT) == S_IFCHR)
+# define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
# endif
# ifndef S_ISLNK
-# define S_ISLNK(m) (((m)&S_IFMT) == S_IFLNK)
+# define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
# endif
# ifndef S_ISBLK
-# define S_ISBLK(m) (((m)&S_IFMT) == S_IFBLK)
+# define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
# endif
# include <direct.h>
# include <process.h>
# define NOMINMAX 1
# define WIN32_NO_STATUS
-// clang-format off
# include <winsock2.h> // struct timeval
// windows must be included after winsock2
// https://stackoverflow.com/questions/1372480/c-redefinition-header-files-winsock2-h
// bccrypt must go after windows.h
// https://stackoverflow.com/questions/57472787/compile-errors-when-using-c-and-bcrypt-header
# include <bcrypt.h> // NTSTATUS
-// clang-format on
# undef WIN32_NO_STATUS
# include <ntstatus.h>
return *this;
}
- explicit operator bool() const
+ explicit
+ operator bool() const
{
return m_handle != INVALID_HANDLE_VALUE;
}
TestContext::TestContext()
: m_test_dir(util::value_or_throw<core::Error>(
- fs::current_path(), "Failed to retrieve current directory"))
+ fs::current_path(), "Failed to retrieve current directory"))
{
if (m_test_dir.parent_path().filename() != "testdir") {
throw core::Error("TestContext instantiated outside test directory");