From: arighi Date: Mon, 29 Mar 2010 14:11:21 +0000 (+0000) Subject: introduce UNREACHABLE() macro. X-Git-Tag: 2.5.0~607 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=4daefac32ad5a2198f911584f1e5abea001d6062;p=bertos.git introduce UNREACHABLE() macro. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@3300 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/bertos/cfg/compiler.h b/bertos/cfg/compiler.h index 5cacf1dc..bd60c6e7 100644 --- a/bertos/cfg/compiler.h +++ b/bertos/cfg/compiler.h @@ -190,6 +190,10 @@ #define DEPRECATED __attribute__((__deprecated__)) #endif + #if GNUC_PREREQ(4,5) + #define UNREACHABLE() __builtin_unreachable() + #endif + #ifndef __cplusplus #define ASSERT_TYPE_EQUAL(var1, var2) \ STATIC_ASSERT(__builtin_types_compatible_p(typeof(var1), typeof(var2))) @@ -323,6 +327,9 @@ #define MEMORY_BARRIER /* nothing */ #warning No memory barrier defined for select compiler. If you use the kernel check it. #endif +#ifndef UNREACHABLE +#define UNREACHABLE() for (;;) +#endif /* Misc definitions */