Skip to content

Accommodate change in behavior from clang-format 21 to 22#368

Merged
knoepfel merged 1 commit intoFramework-R-D:mainfrom
knoepfel:clang-format-22
Feb 26, 2026
Merged

Accommodate change in behavior from clang-format 21 to 22#368
knoepfel merged 1 commit intoFramework-R-D:mainfrom
knoepfel:clang-format-22

Conversation

@knoepfel
Copy link
Member

With clang-format 22, the AllowShortBlocksOnASingleLine: Always setting makes the following type of change:

diff --git a/phlex/utilities/sleep_for.hpp b/phlex/utilities/sleep_for.hpp
index 4492b8b4..9ade8c61 100644
--- a/phlex/utilities/sleep_for.hpp
+++ b/phlex/utilities/sleep_for.hpp
@@ -7,9 +7,7 @@
 namespace phlex::experimental {
   template <typename T>
   void sleep_for(T duration)
-  {
-    std::this_thread::sleep_for(duration);
-  }
+  { std::this_thread::sleep_for(duration); }

thus strictly enforcing the Always rule. This PR adjusts the setting to:

-AllowShortBlocksOnASingleLine: Always
+AllowShortBlocksOnASingleLine: Empty

thus preserving the original format. This setting should work for both clang-format 21 and 22.

@knoepfel knoepfel merged commit 0c41f6b into Framework-R-D:main Feb 26, 2026
49 checks passed
@knoepfel knoepfel deleted the clang-format-22 branch February 26, 2026 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants