[gnutls-devel] GnuTLS | build: switch to using clang-format instead of GNU indent (!1727)

Read-only notification of GnuTLS library development activities gnutls-devel at lists.gnutls.org
Thu Mar 16 03:02:02 CET 2023



Daiki Ueno created a merge request: https://gitlab.com/gnutls/gnutls/-/merge_requests/1727

Project:Branches: dueno/gnutls:wip/dueno/clang-format to gnutls/gnutls:master
Author:   Daiki Ueno




GNU indent yields weird output when using the Linux kernel coding
style as in the below examples, which affects code readability.

- Too long lines cause unexpected indentation:
  ```c
  			if (!
  			    (priv->flags &
  			     GNUTLS_PKCS11_OBJ_FLAG_RETRIEVE_DISTRUSTED)
  && (priv->flags & GNUTLS_PKCS11_OBJ_FLAG_OVERWRITE_TRUSTMOD_EXT)
  && data.size > 0) {
  ```

- Unary operators (`-` and `+`) after a type cast 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, but all the occurrences
  are replaced with that style

This switches to using clang-format instead, with the configuration
used in the Linux kernel as of commit
596ff4a09b8981790e15572e8e7bc904df5835e7:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/.clang-format


## Checklist
 * [ ] Commits have `Signed-off-by:` with name/author being identical to the commit author
 * [ ] Code modified for feature
 * [ ] Test suite updated with functionality tests
 * [ ] Test suite updated with negative tests
 * [ ] Documentation updated / NEWS entry present (for non-trivial changes)
 * [ ] CI timeout is 2h or higher (see Settings/CICD/General pipelines/Timeout)

## Reviewer's checklist:
 * [ ] Any issues marked for closing are addressed
 * [ ] There is a test suite reasonably covering new functionality or modifications
 * [ ] Function naming, parameters, return values, types, etc., are consistent and according to `CONTRIBUTION.md`
 * [ ] This feature/change has adequate documentation added
 * [ ] No obvious mistakes in the code

-- 
Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/gnutls/-/merge_requests/1727
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/20230316/83c4afe3/attachment-0001.html>


More information about the Gnutls-devel mailing list