From b61c9cde910980d61f30b3ffc58a1682c2ad0a41 Mon Sep 17 00:00:00 2001 From: Eric Engestrom Date: Mon, 29 May 2023 11:47:09 +0100 Subject: [PATCH] docs: document clang-format and how to use it Signed-off-by: Eric Engestrom Part-of: --- docs/codingstyle.rst | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docs/codingstyle.rst b/docs/codingstyle.rst index b7afa1c..0f3a32a 100644 --- a/docs/codingstyle.rst +++ b/docs/codingstyle.rst @@ -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 -- 2.7.4