This task adds configuration and migration script, to evaluate moving to clang-format.
Usage
To run the migration:
make format
Or to only operate on certain paths:
make format PATHS="intern/cycles source/creator"
Migration TODO's
Migration scripts.
- Check clang-format version is >= 6.0.
- make format for windows make.bat
Although windows users will likely use MSVC's built-in clang-format. - make format could only format modified files
Better default for developers) perhaps make format-all runs on all files.
Pre Migration cleanup.
- Some header guards are not the first pre-processor lines in the file causing them not to be detected, causing all preprocessor arguments to be indented. rB5681631109852d1037cddafd60f39552f8ba3bbf
Search for #\s+define\s+.*_H__\b after formatting to see issues.
- Tabs in string literals should be replaced with \t or converted to spaces.
This way we can avoid tabs in C/C++ source, expanding all tabs to spaces when migrating.
- source/blender/nodes/NOD_static_types.h gives unusable indentation (disable formatting for this file? or add ; after each DefNode). rBb389bb5ef8aedb65313ac61188246461bc03d22a
- blender/python/generic/bgl.c macro use causes a lot of indentation. rB0373ff5e9c30f01717678b5265df3501891ce5e5
Clang-format TODO's
Where clang-format doesn't produce acceptable output.
- intern/clog/CLG_log.h header guard detection fails, caused by __func__ workaround, needs investigation, seereport https://bugs.llvm.org/show_bug.cgi?id=40288 rB302970b7a5e9b6510f58d786501542e162140d2e
Notes
- the clang-format script will eventually be moved into source/tools/utils.