From d3c1c626f569e5aa58085425924cca45927b6199 Mon Sep 17 00:00:00 2001 From: peterbell10 Date: Sun, 4 Feb 2018 23:07:12 +0000 Subject: Deal with covered switches consistently (#4161) * Fixes a number of ": not all control paths return a value" warnings on MSVC. * Introduces the UNREACHABLE global macro and uses it instead of conditionally compiled switch defaults. * Move cNBTParseErrorCategory from FastNBT.h into FastNBT.cpp to prevent bad calls to message() --- src/Globals.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/Globals.h') diff --git a/src/Globals.h b/src/Globals.h index e48c6dbfe..e37f6dc60 100644 --- a/src/Globals.h +++ b/src/Globals.h @@ -352,6 +352,9 @@ template class SizeChecker; #define assert_test(x) ( !!(x) || (assert(!#x), exit(1), 0)) #endif +/** Use to mark code that should be impossible to reach. */ +#define UNREACHABLE(x) do { FLOGERROR("Hit unreachable code: {0}, file {1}, line {2}", #x, __FILE__, __LINE__); PrintStackTrace(); std::terminate(); } while (false) + -- cgit v1.2.3