From 84326c566af7d20662ee927c2daef0f63ccd3841 Mon Sep 17 00:00:00 2001 From: David Goldblatt Date: Fri, 3 Mar 2017 16:43:47 -0800 Subject: [PATCH] Insert not_reached after an exhaustive switch In the C11 atomics backport, we couldn't use not_reached() in atomic_enum_to_builtin (in atomic_gcc_atomic.h), since atomic.h was hermetic and assert.h wasn't; there was a dependency issue. assert.h is hermetic now, so we can include it. --- include/jemalloc/internal/atomic_gcc_atomic.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/jemalloc/internal/atomic_gcc_atomic.h b/include/jemalloc/internal/atomic_gcc_atomic.h index 3d13b4a6..6b73a14f 100644 --- a/include/jemalloc/internal/atomic_gcc_atomic.h +++ b/include/jemalloc/internal/atomic_gcc_atomic.h @@ -1,6 +1,8 @@ #ifndef JEMALLOC_INTERNAL_ATOMIC_GCC_ATOMIC_H #define JEMALLOC_INTERNAL_ATOMIC_GCC_ATOMIC_H +#include "jemalloc/internal/assert.h" + #define ATOMIC_INIT(...) {__VA_ARGS__} typedef enum { @@ -25,8 +27,8 @@ atomic_enum_to_builtin(atomic_memory_order_t mo) { case atomic_memory_order_seq_cst: return __ATOMIC_SEQ_CST; } - /* Can't actually happen; the switch is exhaustive. */ - return __ATOMIC_SEQ_CST; + /* Can't happen; the switch is exhaustive. */ + not_reached(); } ATOMIC_INLINE void