[Openvpn-devel,v1] clang-format: Add missing InsertBraces: true

Message ID 20260216123026.3310-1-gert@greenie.muc.de
State New
Headers show
Series [Openvpn-devel,v1] clang-format: Add missing InsertBraces: true | expand

Commit Message

Gert Doering Feb. 16, 2026, 12:30 p.m. UTC
From: Frank Lichtenheld <frank@lichtenheld.com>

This takes care to add missing braces in
case of one-line if-statements or loops.

Apparently we never tested this specific error
and we had no existing cases in the code when
we did the reformat. Noticed this during a code
review.

Change-Id: Idb1e96a4d0a618089db4290c5980d192985b5d29
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1529
---

This change was reviewed on Gerrit and approved by at least one
developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1529
This mail reflects revision 1 of this Change.

Acked-by according to Gerrit (reflected above):
Gert Doering <gert@greenie.muc.de>

Comments

Gert Doering Feb. 16, 2026, 2:33 p.m. UTC | #1
Yeah.  Interesting that this seems to be one the few things where
"not set" means "leave either formatting alone" - so, since the existing
code base was already clean wrt braces, nobody noticed... good catch.

Your patch has been applied to the master and release/2.7 branch
(the coding style is identical, so the formatting rules also need to be).

commit 344f13fcdfc159277e7ba7d28e23537d718e7cef (master)
commit 6edd5fee44fd0c2b1b338e90b329054db6313c90 (release/2.7)
Author: Frank Lichtenheld
Date:   Mon Feb 16 13:30:20 2026 +0100

     clang-format: Add missing InsertBraces: true

     Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
     Acked-by: Gert Doering <gert@greenie.muc.de>
     Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1529
     Message-Id: <20260216123026.3310-1-gert@greenie.muc.de>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35635.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering

Patch

diff --git a/.clang-format b/.clang-format
index 1cce4c3..cbec0a4 100644
--- a/.clang-format
+++ b/.clang-format
@@ -31,6 +31,7 @@ 
 IndentGotoLabels: false
 IndentWidth: '4'
 IndentWrappedFunctionNames: false
+InsertBraces: true
 KeepEmptyLinesAtTheStartOfBlocks: false
 MaxEmptyLinesToKeep: '2'
 PointerAlignment: Right