[gnutls-devel] GnuTLS | Indent code? (#1419)
Read-only notification of GnuTLS library development activities
gnutls-devel at lists.gnutls.org
Wed Mar 15 00:30:09 CET 2023
Daiki Ueno commented:
Having used this feature for a while, I realized that automatic code formatting really improves productivity.
On the other hand, the results are sometimes hard to read:
- Too long lines cause unexpected indentation: https://gitlab.com/gnutls/gnutls/-/blob/1351f3e8e3a0a454613b9d686c948912a3928df6/lib/pkcs11.c#L4249
```c
if (!
(priv->flags &
GNUTLS_PKCS11_OBJ_FLAG_RETRIEVE_DISTRUSTED)
&& (priv->flags & GNUTLS_PKCS11_OBJ_FLAG_OVERWRITE_TRUSTMOD_EXT)
&& data.size > 0) {
```
- Unary operators (`-`, `+`) after a type case are not recognized properly: `(time_t)-1` becomes `(time-t) - 1`
- Long conditionals are wrapped *before* binary operators, such as `&&` or `||`. This is not mandatory in the [style](https://www.kernel.org/doc/html/latest/process/coding-style.html)
Running clang-format with the [configuration](https://github.com/torvalds/linux/blob/master/.clang-format) for the Linux kernel produces (IMO) a better output. Although it takes a bit more processing time, `xargs -P` makes it acceptable level.
--
Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/gnutls/-/issues/1419#note_1314309697
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/20230314/e85558a7/attachment-0001.html>
More information about the Gnutls-devel
mailing list