From f4b67cde8ae24fdaac70071f793f5c8d0010d959 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20=C4=90or=C4=91evi=C4=87?= Date: Tue, 7 Apr 2020 06:14:08 +0200 Subject: [PATCH] =?UTF-8?q?Update=20C=20coding=20conventions=20to=20match?= =?UTF-8?q?=20.clang-format=20config=20for=20i=E2=80=A6=20(#8717)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update C coding conventions to match current .clang-format config for indenting PP directives * Make indenting guideline clearer --- docs/coding_conventions_c.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/coding_conventions_c.md b/docs/coding_conventions_c.md index 16e28b28849..f4e359611b7 100644 --- a/docs/coding_conventions_c.md +++ b/docs/coding_conventions_c.md @@ -20,11 +20,11 @@ Most of our style is pretty easy to pick up on, but right now it's not entirely * We accept both forms of preprocessor if's: `#ifdef DEFINED` and `#if defined(DEFINED)` * If you are not sure which to prefer use the `#if defined(DEFINED)` form. * Do not change existing code from one style to the other, except when moving to a multiple condition `#if`. - * Do not put whitespace between `#` and `if`. - * When deciding how (or if) to indent directives keep these points in mind: - * Readability is more important than consistency. - * Follow the file's existing style. If the file is mixed follow the style that makes sense for the section you are modifying. - * When choosing to indent you can follow the indention level of the surrounding C code, or preprocessor directives can have their own indent level. Choose the style that best communicates the intent of your code. +* When deciding how (or if) to indent preprocessor directives, keep these points in mind: + * Readability is more important than consistency. + * Follow the file's existing style. If the file is mixed, follow the style that makes sense for the section you are modifying. + * When indenting, keep the hash at the start of the line and add whitespace between `#` and `if`, starting with 4 spaces after the `#`. + * You can follow the indention level of the surrounding C code, or preprocessor directives can have their own indentation levels. Choose the style that best communicates the intent of your code. Here is an example for easy reference: