1 | /* |
1 | /* |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
3 | * |
3 | * |
4 | * Copyright (©) 2009,2010,2011 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
4 | * Copyright (©) 2009,2010,2011,2012 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * |
5 | * |
6 | * Deliantra is free software: you can redistribute it and/or modify it under |
6 | * Deliantra is free software: you can redistribute it and/or modify it under |
7 | * the terms of the Affero GNU General Public License as published by the |
7 | * the terms of the Affero GNU General Public License as published by the |
8 | * Free Software Foundation, either version 3 of the License, or (at your |
8 | * Free Software Foundation, either version 3 of the License, or (at your |
9 | * option) any later version. |
9 | * option) any later version. |
… | |
… | |
29 | # define attribute(attrlist) __attribute__(attrlist) |
29 | # define attribute(attrlist) __attribute__(attrlist) |
30 | #else |
30 | #else |
31 | # define attribute(attrlist) |
31 | # define attribute(attrlist) |
32 | #endif |
32 | #endif |
33 | |
33 | |
34 | #if GCC_VERSION(3,0) |
34 | #if GCC_VERSION(3,1) |
35 | # define is_constant(c) __builtin_constant_p (c) |
35 | # define is_constant(c) __builtin_constant_p (c) |
36 | # define expect(expr,value) __builtin_expect ((expr),(value)) |
36 | # define expect(expr,value) __builtin_expect ((expr),(value)) |
37 | # define prefetch(addr,rw,locality) __builtin_prefetch (addr, rw, locality) |
37 | # define prefetch(addr,rw,locality) __builtin_prefetch (addr, rw, locality) |
38 | # define noinline __attribute__((__noinline__)) |
38 | # define noinline __attribute__((__noinline__)) |
39 | #else |
39 | #else |
… | |
… | |
50 | #endif |
50 | #endif |
51 | |
51 | |
52 | #define func_const attribute ((const)) |
52 | #define func_const attribute ((const)) |
53 | #define func_pure attribute ((pure)) |
53 | #define func_pure attribute ((pure)) |
54 | #define func_hot attribute ((hot)) // 4.x |
54 | #define func_hot attribute ((hot)) // 4.x |
55 | #define func_cold attribute ((cold) // 4.x |
55 | #define func_cold attribute ((cold)) // 4.x |
56 | |
56 | |
57 | #if GCC_VERSION(4,5) |
57 | #if GCC_VERSION(4,5) |
58 | # define unreachable() __builtin_unreachable () |
58 | # define unreachable() __builtin_unreachable () |
59 | #else |
59 | #else |
60 | // this seems to work fine, but gcc always emits a warning for it :/ |
60 | // this seems to work fine, but gcc always emits a warning for it :/ |