[Openvpn-devel,3/3] windows: list all enum values in switch block

Message ID 20210501130640.9330-4-a@unstable.cc
State Accepted
Headers show
Series windows: kill a couple of warnings | expand

Commit Message

Antonio Quartulli May 1, 2021, 3:06 a.m. UTC
From: Antonio Quartulli <antonio@openvpn.net>

A switch block in interactive.c is missing the _undo_type_max value
of the neum set, thus triggering a compiler warning.

Due to the logic, this value cannot really be assigned to the variable
being examinated, however, add the missing enum value to silence
the warning.

Fixes:

interactive.c: In function ‘Undo’:
interactive.c:1561:13: warning: enumeration value ‘_undo_type_max’ not handled in switch [-Wswitch]
 1561 |             switch (type)
      |             ^~~~~~

Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
---
 src/openvpnserv/interactive.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Arne Schwabe May 2, 2021, 2:14 a.m. UTC | #1
Am 01.05.21 um 15:06 schrieb Antonio Quartulli:
> From: Antonio Quartulli <antonio@openvpn.net>
> 
> A switch block in interactive.c is missing the _undo_type_max value
> of the neum set, thus triggering a compiler warning.
> 
> Due to the logic, this value cannot really be assigned to the variable
> being examinated, however, add the missing enum value to silence
> the warning.
> 
> Fixes:
> 
> interactive.c: In function ‘Undo’:
> interactive.c:1561:13: warning: enumeration value ‘_undo_type_max’ not handled in switch [-Wswitch]
>  1561 |             switch (type)
>       |             ^~~~~~
> 
>

Acked-By: Arne Schwabe <arne@rfc2549.org>
Gert Doering May 2, 2021, 10:40 a.m. UTC | #2
Your patch has been applied to the master branch.

commit f20c377c65f499595939f8a0910f7d7b062b6894
Author: Antonio Quartulli
Date:   Sat May 1 15:06:40 2021 +0200

     windows: list all enum values in switch block

     Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
     Acked-by: Arne Schwabe <arne@rfc2549.org>
     Message-Id: <20210501130640.9330-4-a@unstable.cc>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22267.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering

Patch

diff --git a/src/openvpnserv/interactive.c b/src/openvpnserv/interactive.c
index ed83d2a3..efd0bc4f 100644
--- a/src/openvpnserv/interactive.c
+++ b/src/openvpnserv/interactive.c
@@ -1594,6 +1594,9 @@  Undo(undo_lists_t *lists)
                                              interface_data->metric_v6);
                     }
                     break;
+                case _undo_type_max:
+                    /* unreachable */
+                    break;
             }
 
             /* Remove from the list and free memory */