From 7d1336469a2b21a1d65cbf47647379f23fd037e9 Mon Sep 17 00:00:00 2001 From: Jia Zhang Date: Sat, 28 Oct 2017 02:14:01 -0400 Subject: [PATCH 2/4] gc-libgcrypt: fix undefined enum type in switch statement -Werror=switch causes the following build failure due to using the undefined enum value: lib/gc-libgcrypt.c: In function 'gc_hash_open': lib/gc-libgcrypt.c:317:5: error: case value '0' not in enumerated type 'Gc_hash_mode {aka enum Gc_hash_mode}' [-Werror=switch] case 0: ^~~~ In order to fix this issue, define GC_NULL and refer it instead of 0. * lib/gc.h: Define GC_NULL as a place holder for hash mode. * lib/gc-libgcrypt.c: Use GC_NULL. --- lib/gc-libgcrypt.c | 2 +- lib/gc.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/gc-libgcrypt.c b/lib/gc-libgcrypt.c index c2f806f90..7106e5974 100644 --- a/lib/gc-libgcrypt.c +++ b/lib/gc-libgcrypt.c @@ -314,7 +314,7 @@ gc_hash_open (Gc_hash hash, Gc_hash_mode mode, gc_hash_handle * outhandle) switch (mode) { - case 0: + case GC_NULL: gcrymode = 0; break; diff --git a/lib/gc.h b/lib/gc.h index ebda3b992..e65ba49a3 100644 --- a/lib/gc.h +++ b/lib/gc.h @@ -54,7 +54,8 @@ typedef enum Gc_hash Gc_hash; enum Gc_hash_mode { - GC_HMAC = 1 + GC_NULL, + GC_HMAC }; typedef enum Gc_hash_mode Gc_hash_mode; -- 2.14.1