1 #ifndef PROCPS_PROC_PROCPS_H
2 #define PROCPS_PROC_PROCPS_H
3 
4 #ifdef  __cplusplus
5 #define EXTERN_C_BEGIN extern "C" {
6 #define EXTERN_C_END }
7 #else
8 #define EXTERN_C_BEGIN
9 #define EXTERN_C_END
10 #endif
11 
12 #if !defined(restrict) && __STDC_VERSION__ < 199901
13 #if __GNUC__ > 2 || __GNUC_MINOR__ >= 91    // maybe 92 or 95 ?
14 #define restrict __restrict__
15 #else
16 #warning No restrict keyword?
17 #define restrict
18 #endif
19 #endif
20 
21 // since gcc-2.5
22 #define NORETURN __attribute__((__noreturn__))
23 
24 #if __GNUC__ > 2 || __GNUC_MINOR__ >= 96
25 // won't alias anything, and aligned enough for anything
26 #define MALLOC __attribute__ ((__malloc__))
27 // tell gcc what to expect:   if (unlikely(err)) die(err);
28 #define likely(x)       __builtin_expect(!!(x),1)
29 #define unlikely(x)     __builtin_expect(!!(x),0)
30 #define expected(x,y)   __builtin_expect((x),(y))
31 #else
32 #define MALLOC
33 #define likely(x)       (x)
34 #define unlikely(x)     (x)
35 #define expected(x,y)   (x)
36 #endif
37 
38 #endif
39