From 95dbaebac014b148ea47a3d607e52295bc428224 Mon Sep 17 00:00:00 2001 From: Gerrit Klein Date: Wed, 26 Apr 2023 23:28:18 +0200 Subject: [PATCH] fix: compiler warning `-Wswitch-default` Fixes warning "switch missing default case [-Wswitch-default]" which was observed on gcc 11.3.0 on Ubuntu 22.04 LTS Linux 6.3.0 x86-64. This warning was enabled by the flag `-Wswitch-default` (see: https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wswitch-default) Signed-off-by: Gerrit Klein Signed-off-by: Mathieu Desnoyers Change-Id: Iad356fd94b0b964a49c382c32a7d193b4ad43d35 --- include/rseq/rseq.h | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/include/rseq/rseq.h b/include/rseq/rseq.h index 2e2f41d..0989ef7 100644 --- a/include/rseq/rseq.h +++ b/include/rseq/rseq.h @@ -280,8 +280,9 @@ int rseq_cmpeqv_storev(enum rseq_mo rseq_mo, enum rseq_percpu_mode percpu_mode, return rseq_cmpeqv_storev_relaxed_cpu_id(v, expect, newv, cpu); case RSEQ_PERCPU_MM_CID: return rseq_cmpeqv_storev_relaxed_mm_cid(v, expect, newv, cpu); + default: + return -1; } - return -1; } /* @@ -300,8 +301,9 @@ int rseq_cmpnev_storeoffp_load(enum rseq_mo rseq_mo, enum rseq_percpu_mode percp return rseq_cmpnev_storeoffp_load_relaxed_cpu_id(v, expectnot, voffp, load, cpu); case RSEQ_PERCPU_MM_CID: return rseq_cmpnev_storeoffp_load_relaxed_mm_cid(v, expectnot, voffp, load, cpu); + default: + return -1; } - return -1; } static inline __attribute__((always_inline)) @@ -315,8 +317,9 @@ int rseq_addv(enum rseq_mo rseq_mo, enum rseq_percpu_mode percpu_mode, return rseq_addv_relaxed_cpu_id(v, count, cpu); case RSEQ_PERCPU_MM_CID: return rseq_addv_relaxed_mm_cid(v, count, cpu); + default: + return -1; } - return -1; } #ifdef RSEQ_ARCH_HAS_OFFSET_DEREF_ADDV @@ -335,8 +338,9 @@ int rseq_offset_deref_addv(enum rseq_mo rseq_mo, enum rseq_percpu_mode percpu_mo return rseq_offset_deref_addv_relaxed_cpu_id(ptr, off, inc, cpu); case RSEQ_PERCPU_MM_CID: return rseq_offset_deref_addv_relaxed_mm_cid(ptr, off, inc, cpu); + default: + return -1; } - return -1; } #endif @@ -353,16 +357,18 @@ int rseq_cmpeqv_trystorev_storev(enum rseq_mo rseq_mo, enum rseq_percpu_mode per return rseq_cmpeqv_trystorev_storev_relaxed_cpu_id(v, expect, v2, newv2, newv, cpu); case RSEQ_PERCPU_MM_CID: return rseq_cmpeqv_trystorev_storev_relaxed_mm_cid(v, expect, v2, newv2, newv, cpu); + default: + return -1; } - return -1; case RSEQ_MO_RELEASE: switch (percpu_mode) { case RSEQ_PERCPU_CPU_ID: return rseq_cmpeqv_trystorev_storev_release_cpu_id(v, expect, v2, newv2, newv, cpu); case RSEQ_PERCPU_MM_CID: return rseq_cmpeqv_trystorev_storev_release_mm_cid(v, expect, v2, newv2, newv, cpu); + default: + return -1; } - return -1; default: return -1; } @@ -381,8 +387,9 @@ int rseq_cmpeqv_cmpeqv_storev(enum rseq_mo rseq_mo, enum rseq_percpu_mode percpu return rseq_cmpeqv_cmpeqv_storev_relaxed_cpu_id(v, expect, v2, expect2, newv, cpu); case RSEQ_PERCPU_MM_CID: return rseq_cmpeqv_cmpeqv_storev_relaxed_mm_cid(v, expect, v2, expect2, newv, cpu); + default: + return -1; } - return -1; } static inline __attribute__((always_inline)) @@ -398,16 +405,18 @@ int rseq_cmpeqv_trymemcpy_storev(enum rseq_mo rseq_mo, enum rseq_percpu_mode per return rseq_cmpeqv_trymemcpy_storev_relaxed_cpu_id(v, expect, dst, src, len, newv, cpu); case RSEQ_PERCPU_MM_CID: return rseq_cmpeqv_trymemcpy_storev_relaxed_mm_cid(v, expect, dst, src, len, newv, cpu); + default: + return -1; } - return -1; case RSEQ_MO_RELEASE: switch (percpu_mode) { case RSEQ_PERCPU_CPU_ID: return rseq_cmpeqv_trymemcpy_storev_release_cpu_id(v, expect, dst, src, len, newv, cpu); case RSEQ_PERCPU_MM_CID: return rseq_cmpeqv_trymemcpy_storev_release_mm_cid(v, expect, dst, src, len, newv, cpu); + default: + return -1; } - return -1; default: return -1; } -- 2.34.1