docs: document clang-format and how to use it
authorEric Engestrom <eric@igalia.com>
Mon, 29 May 2023 10:47:09 +0000 (11:47 +0100)
committerMarge Bot <emma+marge@anholt.net>
Mon, 29 May 2023 11:57:08 +0000 (11:57 +0000)
Signed-off-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23269>

docs/codingstyle.rst

index b7afa1c..0f3a32a 100644 (file)
@@ -8,7 +8,21 @@ of mesa can use different coding style as set in the local EditorConfig
 following is applicable. If the guidelines below don't cover something,
 try following the format of existing, neighboring code.
 
+``clang-format``
+----------------
+
+A growing number of drivers and components are adopting ``clang-format``
+to standardize the formatting and make it easy for everyone to apply it.
+
+You can re-format the code for the components that have opted-in to the
+formatting enforcement (listed in ``.clang-format-include``) by simply
+running ``ninja -C build/ clang-format``.
+
+Most code editors also support automatically formatting code as you
+write it; check your editor or its pluggins to see how to enable this.
+
 Basic formatting guidelines
+---------------------------
 
 -  3-space indentation, no tabs.
 -  Limit lines to 78 or fewer characters. The idea is to prevent line