[gnutls-devel] GnuTLS | Indent code? (#1419)

Read-only notification of GnuTLS library development activities gnutls-devel at lists.gnutls.org
Sun Nov 6 22:46:06 CET 2022




Daiki Ueno commented:


> Ah right, yes 'make indent' and 'make syntax-check' requires a bootstrapped build, and I can see why we want something that works without that. A script 'devel/indent-code'?

Sounds good to me. An alternative would be to introduce a new CI stage before `bootstrap` to do syntax checks, so even if it still requires bootstrap, subsequent stages are not executed if it fails.

> I'm not familiar with clang-format, how does it interact here?

Just adding some data points: the Linux kernel has this [guidance](https://www.kernel.org/doc/html/latest/process/clang-format.html) and also provides a [.clang-format](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/.clang-format?id=9d24322e887b6a3d3f9f9c3e76937a646102c8c1) file. NSS (not using the same rule) has this [pre-commit](https://hg.mozilla.org/projects/nss/file/b7e45ee99b4db92e23fcf37806ad3e28a8a13c8a/coreconf/precommit.clang-format.sh).

It seems clang-format is much slower than GNU indent:
```console
% cd lib
% cp .../linux/.clang-format .

% time find . -name "*.[ch]" -exec indent -ppi1 -linux {} \;
find . -name "*.[ch]" -exec indent -ppi1 -linux {} \;  0.69s user 1.39s system 96% cpu 2.152 total

% time find . -name "*.[ch]" -exec clang-format -i {} \;
find . -name "*.[ch]" -exec clang-format -i {} \;  12.48s user 7.93s system 98% cpu 20.667 total
```

-- 
Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/gnutls/-/issues/1419#note_1161601298
You're receiving this email because of your account on gitlab.com.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gnupg.org/pipermail/gnutls-devel/attachments/20221106/d39dd775/attachment-0001.html>


More information about the Gnutls-devel mailing list