From de4f610843ae7c7dc62fbd9539a4f5c8c39cb536 Mon Sep 17 00:00:00 2001 From: Henrik Stickann <4376396-Mithradir@users.noreply.gitlab.com> Date: Fri, 15 Apr 2022 14:58:24 +0200 Subject: [PATCH] Adde helper for unreachable code paths --- include/sta/lang.hpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/sta/lang.hpp b/include/sta/lang.hpp index f390b50..00a797e 100644 --- a/include/sta/lang.hpp +++ b/include/sta/lang.hpp @@ -34,4 +34,16 @@ #endif // STA_BKPT +// TODO Check for GCC + +/** + * @brief Helper for silencing compiler warnings in unreachable code locations. + * + * Example: Default of switch handling all cases of enum class + */ +#ifndef STA_UNREACHABLE +# define STA_UNREACHABLE() __builtin_unreachable() +#endif // STA_UNREACHABLE + + #endif // STA_LANG_HPP