From dad3fd5fd4acc96ca7834e340b4b6ba032ed6547 Mon Sep 17 00:00:00 2001 From: Bruce Richardson Date: Wed, 15 Sep 2021 10:50:36 +0100 Subject: [PATCH] doc: add line continuation note in Meson coding style Add a note for the preference of using "()" rather than "\" for line continuations in Meson. Suggested-by: David Marchand Signed-off-by: Bruce Richardson Reviewed-by: David Marchand --- doc/guides/contributing/coding_style.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/doc/guides/contributing/coding_style.rst b/doc/guides/contributing/coding_style.rst index d648689f10..b27b5fcfdb 100644 --- a/doc/guides/contributing/coding_style.rst +++ b/doc/guides/contributing/coding_style.rst @@ -1024,6 +1024,16 @@ The following guidelines apply to the build system code in meson.build files in * Line continuations should be doubly-indented to ensure visible difference from normal indentation. Any line continuations beyond the first may be singly indented to avoid large amounts of indentation. +* Where a line is split in the middle of a statement, e.g. a multiline `if` statement, + brackets should be used in preference to escaping the line break. + +Example:: + + if (condition1 and condition2 # line breaks inside () need no escaping + and condition3 and condition4) + x = y + endif + * Lists of files or components must be alphabetical unless doing so would cause errors. * Two formats are supported for lists of files or list of components: -- 2.20.1