你可以从Linux内核源码中获取.clang-format文件作为参考,并进行必要的调整。Linux内核源码的.clang-format文件通常位于源码树的根目录下。 示例配置(基于Linux内核风格): yaml BasedOnStyle: LLVM IndentWidth: 8 UseTab: Never BreakBeforeBraces: Attach AllowShortIfStatementsOnASingleLine: false ColumnLimit: 80 ...
A style similar to the Linux Kernel style: CopyBasedOnStyle: LLVM IndentWidth: 8 UseTab: Always BreakBeforeBraces: Linux AllowShortIfStatementsOnASingleLine: false IndentCaseLabels: false The result is (imagine that tabs are used for indentation here): Copyvoid test() { switch (x) { case...
上面的例子只是写来测试,要看clang-format的格式化效果,直接在github上看对应项目的代码即可,比如Linux kernel。 uncrustify这工具现在在github维护,也是比较活跃,但我没见过用这个工具格式化的项目,而且上面也给出了格式化的效果,这里就不再测试了。 astyle在sourceforge上,更新并不频繁,格式化选项比较少,比如说没有提...
2 changes: 1 addition & 1 deletion 2 clang/docs/ClangFormatStyleOptions.rst Original file line numberDiff line numberDiff line change @@ -5730,7 +5730,7 @@ Examples === A style similar to the `Linux Kernel style <https://www.kernel.org/doc/Documentation/CodingStyle>`_: <https://...
Add .clang-format style from linux kernel to allow easier style formatting for developers that do not use uncrustify. You can call "clang-format -style=file -i my_src.c" within the repo to in-place fix the style. Signed-off-by: Håkon Alseth <haal@nordicsemi.no>master...
Cpp11BracedListStyle: false DerivePointerAlignment: false DisableFormat: false ExperimentalAutoDetectBinPacking: false #FixNamespaceComments: false # Unknown to clang-format-4.0 # Taken from: # git grep -h '^#define [^[:space:]]*for_each[^[:space:]]*(' include/ \ # | sed ...
Cloud Kernel 是龙蜥操作系统(Anolis OS)内核,目前已经达到 600 多万部署规模. 它基于Linux社区主线稳定版. 致力于打造更稳定, 更可靠, 更安全, 特性更丰富, 性能更优化的 Linux 系统内核. 为 Anolis OS 以及下游生态合作 OS 发行版提供坚实的内核支持, 更好的支撑和扩展上
另外,clang-format不能指定配置文件的路径,而我不喜欢把这些文件和源代码文件放在一起,为此还写了个批量格式化的脚本。上面的例子只是写来测试,要看clang-format的格式化效果,直接在github上看对应项目的代码即可,比如Linux kernel。 uncrustify这工具现在在github维护,也是比较活跃,但我没见过用这个工具格式化的项目,而且...
Saved searches Use saved searches to filter your results more quickly Cancel Create saved search Sign in Sign up Reseting focus {{ message }} RadxaMitchell / kernel Public forked from radxa/kernel Notifications You must be signed in to change notification settings Fork 0 Star ...
Taken almost verbatim from the .clang-format file in the Linux kernel. Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>Loading branch information ojeda authored and gitster committed Jun 4, 2019 1 parent 74583d8 commit fc7e...