diff options
| author | Ricardo M. Correia <[email protected]> | 2012-05-31 19:12:01 +0200 |
|---|---|---|
| committer | Ricardo M. Correia <[email protected]> | 2012-05-31 20:33:14 +0200 |
| commit | 78e851f94f67b56e9baa8a62d6266c6bf979ee9e (patch) | |
| tree | 277a0bfc514fd1cea6fdd97a3fdadb86debdf1eb /src/util.h | |
| parent | Fix signed subtraction overflow in CBigNum::setint64(). (diff) | |
| download | discoin-78e851f94f67b56e9baa8a62d6266c6bf979ee9e.tar.xz discoin-78e851f94f67b56e9baa8a62d6266c6bf979ee9e.zip | |
Fix noinline definition so that it works for more compilers.
Diffstat (limited to 'src/util.h')
| -rw-r--r-- | src/util.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/util.h b/src/util.h index 8e65fa786..0d5221c33 100644 --- a/src/util.h +++ b/src/util.h @@ -43,6 +43,23 @@ static const int64 CENT = 1000000; #define ARRAYLEN(array) (sizeof(array)/sizeof((array)[0])) #define printf OutputDebugStringF +// Unfortunately there's no standard way of preventing a function from being +// inlined, so we define a macro for it. +// +// You should use it like this: +// NOINLINE void function() {...} +#if defined(__GNUC__) +// This also works and will be defined for any compiler implementing gcc +// extensions, such as clang and icc. +#define NOINLINE __attribute__((noinline)) +#elif defined(_MSC_VER) +#define NOINLINE __declspec(noinline) +#else +// We give out a warning because it impacts the correctness of one bignum test. +#warning You should define NOINLINE for your compiler. +#define NOINLINE +#endif + #ifdef snprintf #undef snprintf #endif |