This adds two tools to the ./tools/ subdirectory:
== clang-formatter.sh ==
This is simply a small shell script that can be executed from the top of
the UHD repository, and it will format all files according the the
.clang-format file. It can be executed as such:
$ CLANG_FORMAT=clang-format-14 ./tools/clang-formatter.sh apply
Specifying a clang-format executable is optional, but note that
clang-format 14.0 should be used.
== run-clang-format.py ==
This is a Python script that is a modified version from
https://github.com/gnuradio/clang-format-lint-action/blob/ \
0b0cb14cf220a070d2a8b2610bd74ad1546252a1/run-clang-format.py
It was modified to add --patch-file option.
Alongside this file is a .clang-format-ignore file, which is sourced
from this script. The command can be run as such:
$ ./tools/run-clang-format.py \
--clang-format-executable clang-format-14 \
--extensions c,cpp,h,hpp,hpp.in,ipp \
-r \
--patch-file format.patch \
/path/to/uhd-repo
It will provide both a nice output summary as well as a patch file that
can be consumed with `patch -p0 < format.patch`.