clang-format: flush-left goto labels


clang-format is currently lacking an option to specify how to indent
goto labels, they are always outdented one level.

Linux kernel style, OpenBSD style, and many other C projects have the
labels completely flush left, in column 0. The patch below adds
this as "IndentGotoLabels: false". (This indentation style is also
provided by GNU indent and astyle.)

(A less popular, but still common style, is to indent labels always one
space, I don't know how to add that easily.)


diff --git a/docs/ClangFormatStyleOptions.rst b/docs/ClangFormatStyleOptions.rst
index ce6fae1..fb65f4a 100644
--- a/docs/ClangFormatStyleOptions.rst
+++ b/docs/ClangFormatStyleOptions.rst
@@ -343,6 +343,11 @@ the configuration (without a prefix: ``Auto``).
   When ``false``, use the same indentation level as for the switch statement.
   Switch statement body is always indented one level more than case labels.

+**IndentGotoLabels** (``bool``)
+ Indent goto labels.

Looks good. Do you have commit access?

Daniel Jasper <> writes:

Looks good. Do you have commit access?

No, I never even looked at cfe source code before, so please review
thoroughly. :wink: