[Openvpn-devel,3/3] dev-tools: Avoid uncrustify mangling MAC_FMT macro

Message ID 20220420121322.42732-3-openvpn@sf.lists.topphemmelig.net
State Accepted
Headers show
Series [Openvpn-devel,1/3] dev-tools: Remove no longer needed openvpn-plugin.h.in patching | expand

Commit Message

David Sommerseth April 20, 2022, 2:13 a.m. UTC
From: David Sommerseth <davids@openvpn.net>

The MAC_FMT in src/openvpn/misc.h need to be formatted strictly, and
uncrustify does not fully grasp the current code.  So we tell it to not
touch it.

Signed-off-by: David Sommerseth <davids@openvpn.net>
 src/openvpn/misc.h | 2 ++
 1 file changed, 2 insertions(+)


Gert Doering April 20, 2022, 9:30 p.m. UTC | #1
Acked-by: Gert Doering <gert@greenie.muc.de>

As pointed out, I do not like this particular macro and the _STRINGIFY()
stuff, and it seems uncrustify agrees with me :-) - but until we can 
find a volunteer to make that code nicer on the eyes, this will at least
avoid uncrustify breaking it.

As this is just C level comments, nothing needed to be tested.

Your patch has been applied to the master branch.

commit 9febbcbbcf3b1a786a1e77145d30a43eb7996dc4
Author: David Sommerseth
Date:   Wed Apr 20 14:13:22 2022 +0200

     dev-tools: Avoid uncrustify mangling MAC_FMT macro

     Signed-off-by: David Sommerseth <davids@openvpn.net>
     Acked-by: Gert Doering <gert@greenie.muc.de>
     Message-Id: <20220420121322.42732-3-openvpn@sf.lists.topphemmelig.net>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg24121.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>

kind regards,

Gert Doering


diff --git a/src/openvpn/misc.h b/src/openvpn/misc.h
index 7970b60d..d8a15650 100644
--- a/src/openvpn/misc.h
+++ b/src/openvpn/misc.h
@@ -212,7 +212,9 @@  struct buffer
 prepend_dir(const char *dir, const char *path, struct gc_arena *gc);
 #define _STRINGIFY(S) #S
+/* *INDENT-OFF* - uncrustify need to ignore this macro */
 #define MAC_FMT _STRINGIFY(%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx)
+/* *INDENT-ON* */
 #define MAC_PRINT_ARG(_mac) _mac[0], _mac[1], _mac[2],  \
         _mac[3], _mac[4], _mac[5]
 #define MAC_SCAN_ARG(_mac) &_mac[0], &_mac[1], &_mac[2], \