diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2017-09-01 11:33:45 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2017-09-01 11:33:45 +0300 |
commit | 4e1fa7f63da580c1e0e4256bc4af3c02cdc51939 (patch) | |
tree | 6ac1589c98dbf15a465365f4f16a09da51ea8c48 /include/my_compiler.h | |
parent | ff81faf670e083e1da4f3e7bce33fe9104410b2c (diff) | |
parent | 2f3968d98f8d90a9a9747e5b89c8f07efc6732e8 (diff) | |
download | mariadb-git-4e1fa7f63da580c1e0e4256bc4af3c02cdc51939.tar.gz |
Merge bb-10.2-ext into 10.3
Diffstat (limited to 'include/my_compiler.h')
-rw-r--r-- | include/my_compiler.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/include/my_compiler.h b/include/my_compiler.h index 833eedbf7c4..fbb4b959e8d 100644 --- a/include/my_compiler.h +++ b/include/my_compiler.h @@ -146,6 +146,29 @@ struct my_aligned_storage #define MY_ALIGNED(size) #endif +#ifdef __GNUC__ +# define ATTRIBUTE_NORETURN __attribute__((noreturn)) +# if MY_GNUC_PREREQ(4,3) +/** Starting with GCC 4.3, the "cold" attribute is used to inform the +compiler that a function is unlikely executed. The function is +optimized for size rather than speed and on many targets it is placed +into special subsection of the text section so all cold functions +appears close together improving code locality of non-cold parts of +program. The paths leading to call of cold functions within code are +marked as unlikely by the branch prediction mechanism. optimize a +rarely invoked function for size instead for speed. */ +# define ATTRIBUTE_COLD __attribute__((cold)) +# endif +#elif defined _WIN32 +# define ATTRIBUTE_NORETURN __declspec(noreturn) +#else +# define ATTRIBUTE_NORETURN /* empty */ +#endif + +#ifndef ATTRIBUTE_COLD +# define ATTRIBUTE_COLD /* empty */ +#endif + #include <my_attribute.h> #endif /* MY_COMPILER_INCLUDED */ |