From d48a4eb581aa09cc147a73e066db54ec65aa4a43 Mon Sep 17 00:00:00 2001 From: Nigel Tao Date: Fri, 5 Jun 2020 13:26:32 +1000 Subject: [PATCH] Add dumbindent comment about `extern "C"` --- lib/dumbindent/dumbindent.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/dumbindent/dumbindent.go b/lib/dumbindent/dumbindent.go index e9b6662b..5ac12410 100644 --- a/lib/dumbindent/dumbindent.go +++ b/lib/dumbindent/dumbindent.go @@ -85,6 +85,10 @@ func Format(src []byte) (dst []byte, retErr error) { } // Preprocessor lines (#ifdef, #pragma, etc) are never indented. + // + // The '{' and '}' for an `extern "C"` are also special cased not to + // change indentation inside the block. This assumes that the closing + // brace is followed by a `// extern "C"` comment. if (line[0] == '#') || ((line[0] == 'e') && bytes.HasPrefix(line, externC)) || ((line[0] == '}') && bytes.HasSuffix(line, externC)) {