From fad0d51322e8d67083c5c9c18fed8d1196f3982f Mon Sep 17 00:00:00 2001 From: Mingxin Wang Date: Mon, 9 Jun 2025 02:12:26 +0000 Subject: [PATCH] Update format --- .clang-format | 7 + .github/workflows/bvt-clang.yml | 5 +- include/proxy/proxy.h | 2 +- include/proxy/proxy_fmt.h | 2 +- include/proxy/v4/proxy.h | 1834 ++++++++++++++++++------------- include/proxy/v4/proxy.ixx | 50 +- include/proxy/v4/proxy_fmt.h | 51 +- include/proxy/v4/proxy_macros.h | 354 +++--- 8 files changed, 1295 insertions(+), 1010 deletions(-) create mode 100644 .clang-format diff --git a/.clang-format b/.clang-format new file mode 100644 index 00000000..5113c807 --- /dev/null +++ b/.clang-format @@ -0,0 +1,7 @@ +--- +BasedOnStyle: LLVM + +AllowShortIfStatementsOnASingleLine: WithoutElse +BreakTemplateDeclarations: Yes +IndentWrappedFunctionNames: true +PointerAlignment: Left diff --git a/.github/workflows/bvt-clang.yml b/.github/workflows/bvt-clang.yml index 63b6026a..03643e9e 100644 --- a/.github/workflows/bvt-clang.yml +++ b/.github/workflows/bvt-clang.yml @@ -18,7 +18,7 @@ jobs: wget https://apt.llvm.org/llvm.sh chmod +x llvm.sh sudo ./llvm.sh 20 - sudo apt install libc++-20-dev + sudo apt install libc++-20-dev clang-format-20 - name: check compiler version run: | @@ -27,6 +27,9 @@ jobs: - name: build and run test with clang 20 run: | cmake -B build -GNinja -DCMAKE_C_COMPILER=clang-20 -DCMAKE_CXX_COMPILER=clang++-20 -DCMAKE_CXX_FLAGS="-stdlib=libc++" -DCMAKE_CXX_STANDARD=23 -DCMAKE_BUILD_TYPE=Release -DPROXY_BUILD_MODULES=TRUE + mapfile -t FILES < <(find include -type f \( -name '*.h' -o -name '*.ixx' -o -name '*.cpp' \)) + echo "Running clang-format on ${#FILES[@]} files" + clang-format-20 --dry-run --Werror "${FILES[@]}" cmake --build build -j ctest --test-dir build -j mkdir build/drop diff --git a/include/proxy/proxy.h b/include/proxy/proxy.h index 665e2829..a216e342 100644 --- a/include/proxy/proxy.h +++ b/include/proxy/proxy.h @@ -6,4 +6,4 @@ #include "v4/proxy.h" // IWYU pragma: export -#endif // _MSFT_PROXY_ +#endif // _MSFT_PROXY_ diff --git a/include/proxy/proxy_fmt.h b/include/proxy/proxy_fmt.h index 0c9532ee..56435354 100644 --- a/include/proxy/proxy_fmt.h +++ b/include/proxy/proxy_fmt.h @@ -6,4 +6,4 @@ #include "v4/proxy_fmt.h" // IWYU pragma: export -#endif // _MSFT_PROXY_FMT_ +#endif // _MSFT_PROXY_FMT_ diff --git a/include/proxy/v4/proxy.h b/include/proxy/v4/proxy.h index 0badc9da..3925740c 100644 --- a/include/proxy/v4/proxy.h +++ b/include/proxy/v4/proxy.h @@ -6,11 +6,11 @@ #include "proxy_macros.h" +#include #include +#include #include #include -#include -#include #include #include #include @@ -24,13 +24,13 @@ #include #if __has_include() #include -#endif // __has_include() -#endif // __STDC_HOSTED__ +#endif // __has_include() +#endif // __STDC_HOSTED__ #if __cpp_rtti >= 199711L #include #include -#endif // __cpp_rtti >= 199711L +#endif // __cpp_rtti >= 199711L #if __has_cpp_attribute(msvc::no_unique_address) #define ___PRO_NO_UNIQUE_ADDRESS_ATTRIBUTE msvc::no_unique_address @@ -40,20 +40,24 @@ #error Proxy requires C++20 attribute no_unique_address. #endif -// `___PRO4_THROW` is used inside `proxy_fmt.h`, +// `___PRO4_THROW` is used inside `proxy_fmt.h`, // hence it's not `#undef`-ed at the end. #if __cpp_exceptions >= 199711L #define ___PRO4_THROW(...) throw __VA_ARGS__ #else #define ___PRO4_THROW(...) std::abort() -#endif // __cpp_exceptions >= 199711L +#endif // __cpp_exceptions >= 199711L namespace pro::inline v4 { namespace details { -struct applicable_traits { static constexpr bool applicable = true; }; -struct inapplicable_traits { static constexpr bool applicable = false; }; +struct applicable_traits { + static constexpr bool applicable = true; +}; +struct inapplicable_traits { + static constexpr bool applicable = false; +}; template