Automatic Differentiation
 
Loading...
Searching...
No Matches
compiler_attributes.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_META_COMPILER_ATTRIBUTES_HPP
2#define STAN_MATH_PRIM_META_COMPILER_ATTRIBUTES_HPP
3
4#ifdef __GNUC__
5#ifndef likely
6#define likely(x) __builtin_expect(!!(x), 1)
7#endif
8#ifndef unlikely
9#define unlikely(x) __builtin_expect(!!(x), 0)
10#endif
11#ifdef __has_attribute
12#if __has_attribute(noinline) && __has_attribute(cold)
13#ifndef STAN_COLD_PATH
19#define STAN_COLD_PATH __attribute__((noinline, cold))
20#endif
21#endif
22#endif
23#ifndef STAN_DEPRECATED
24#if __has_attribute(deprecated)
25#define STAN_DEPRECATED __attribute__((deprecated))
26#else
27#define STAN_DEPRECATED
28#endif
29#endif
30
31#endif
32
33#ifndef STAN_COLD_PATH
34#define STAN_COLD_PATH
35#endif
36#ifndef likely
37#define likely(x) x
38#endif
39#ifndef unlikely
40#define unlikely(x) x
41#endif
42#ifndef STAN_DEPRECATED
43#define STAN_DEPRECATED
44#endif
48#ifndef STAN_NO_RANGE_CHECKS_RETURN
52#ifdef STAN_NO_RANGE_CHECKS
53#define STAN_NO_RANGE_CHECKS_RETURN return
54#endif
55#ifndef STAN_NO_RANGE_CHECKS_RETURN
56#define STAN_NO_RANGE_CHECKS_RETURN
57#endif
58#endif
59
60#endif