diff options
author | Davi Arnaut <davi.arnaut@oracle.com> | 2010-10-20 17:02:59 -0200 |
---|---|---|
committer | Davi Arnaut <davi.arnaut@oracle.com> | 2010-10-20 17:02:59 -0200 |
commit | 6997cff45975168618f387e380a3ce62ac93bc8d (patch) | |
tree | 8b9671ed7e4c19f1f97d8f8347422f15f2432a03 /include | |
parent | dc0412d5899538c89a2922406168a5e70ddbceb5 (diff) | |
parent | 3e9c52250a3ab6664c53ea6b3923acfbe8e09e4e (diff) | |
download | mariadb-git-6997cff45975168618f387e380a3ce62ac93bc8d.tar.gz |
Merge of mysql-5.1-bugteam into mysql-5.5-bugteam.
Diffstat (limited to 'include')
-rw-r--r-- | include/my_compiler.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/include/my_compiler.h b/include/my_compiler.h index 1cd46ff4260..c7d334999d0 100644 --- a/include/my_compiler.h +++ b/include/my_compiler.h @@ -32,8 +32,15 @@ /* GNU C/C++ */ #if defined __GNUC__ +/* Convenience macro to test the minimum required GCC version. */ +# define MY_GNUC_PREREQ(maj, min) \ + ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) /* Any after 2.95... */ # define MY_ALIGN_EXT +/* Comunicate to the compiler the unreachability of the code. */ +# if MY_GNUC_PREREQ(4,5) +# define MY_ASSERT_UNREACHABLE() __builtin_unreachable() +# endif /* Microsoft Visual C++ */ #elif defined _MSC_VER @@ -67,7 +74,7 @@ #endif /** - Generic compiler-dependent features. + Generic (compiler-independent) features. */ #ifndef MY_ALIGNOF # ifdef __cplusplus @@ -79,6 +86,10 @@ # endif #endif +#ifndef MY_ASSERT_UNREACHABLE +# define MY_ASSERT_UNREACHABLE() do { assert(0); } while (0) +#endif + /** C++ Type Traits */ |