[Openvpn-devel,v3] Add more "intentional fallthrough" comments

Message ID 20250228170232.322186-1-frank@lichtenheld.com
State Accepted
Headers show
Series [Openvpn-devel,v3] Add more "intentional fallthrough" comments | expand

Commit Message

Frank Lichtenheld Feb. 28, 2025, 5:02 p.m. UTC
To make it easier to exclude them from compiler
warnings.

Based on the existing comment in init.c

Change-Id: I925accd8267f94ecfd9ccea85bae965dc2a10208
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
---

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/+/864
This mail reflects revision 3 of this Change.

Acked-by according to Gerrit (reflected above):
Arne Schwabe <arne-openvpn@rfc2549.org>

Comments

Gert Doering March 5, 2025, 6:56 a.m. UTC | #1
Thanks for this.  Helping the compiler see the intentions vs. a forgotten
"break" is a good long-term strategy, I'd say :-)

Your patch has been applied to the master branch.

commit fed37d003d9cbc9e7c3ea5fdd0f0a287f4cee538
Author: Frank Lichtenheld
Date:   Fri Feb 28 18:02:32 2025 +0100

     Add more 'intentional fallthrough' comments

     Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
     Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
     Message-Id: <20250228170232.322186-1-frank@lichtenheld.com>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg30990.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering

Patch

diff --git a/src/openvpn/list.c b/src/openvpn/list.c
index 69f1510..6987def 100644
--- a/src/openvpn/list.c
+++ b/src/openvpn/list.c
@@ -437,34 +437,44 @@ 
     {
         case 11:
             c += ((uint32_t) k[10] << 24);
+        /* Intentional [[fallthrough]]; */
 
         case 10:
             c += ((uint32_t) k[9] << 16);
+        /* Intentional [[fallthrough]]; */
 
         case 9:
             c += ((uint32_t) k[8] << 8);
+        /* Intentional [[fallthrough]]; */
 
         /* the first byte of c is reserved for the length */
         case 8:
             b += ((uint32_t) k[7] << 24);
+        /* Intentional [[fallthrough]]; */
 
         case 7:
             b += ((uint32_t) k[6] << 16);
+        /* Intentional [[fallthrough]]; */
 
         case 6:
             b += ((uint32_t) k[5] << 8);
+        /* Intentional [[fallthrough]]; */
 
         case 5:
             b += k[4];
+        /* Intentional [[fallthrough]]; */
 
         case 4:
             a += ((uint32_t) k[3] << 24);
+        /* Intentional [[fallthrough]]; */
 
         case 3:
             a += ((uint32_t) k[2] << 16);
+        /* Intentional [[fallthrough]]; */
 
         case 2:
             a += ((uint32_t) k[1] << 8);
+        /* Intentional [[fallthrough]]; */
 
         case 1:
             a += k[0];
diff --git a/src/openvpn/push.c b/src/openvpn/push.c
index ddad109..914f520 100644
--- a/src/openvpn/push.c
+++ b/src/openvpn/push.c
@@ -98,6 +98,7 @@ 
 
             case AR_INTERACT:
                 ssl_purge_auth(false);
+            /* Intentional [[fallthrough]]; */
 
             case AR_NOINTERACT:
                 /* SOFT-SIGTUSR1 -- Auth failure error */