procps/proc/procps.h
2002-12-09 07:53:09 +00:00

39 lines
945 B
C

#ifndef PROCPS_PROC_PROCPS_H
#define PROCPS_PROC_PROCPS_H
#ifdef __cplusplus
#define EXTERN_C_BEGIN extern "C" {
#define EXTERN_C_END }
#else
#define EXTERN_C_BEGIN
#define EXTERN_C_END
#endif
#if !defined(restrict) && __STDC_VERSION__ < 199901
#if __GNUC__ > 2 || __GNUC_MINOR__ >= 91 // maybe 92 or 95 ?
#define restrict __restrict__
#else
#warning No restrict keyword?
#define restrict
#endif
#endif
// since gcc-2.5
#define NORETURN __attribute__((__noreturn__))
#if __GNUC__ > 2 || __GNUC_MINOR__ >= 96
// won't alias anything, and aligned enough for anything
#define MALLOC __attribute__ ((__malloc__))
// tell gcc what to expect: if(unlikely(err)) die(err);
#define likely(x) __builtin_expect(!!(x),1)
#define unlikely(x) __builtin_expect(!!(x),0)
#define expected(x,y) __builtin_expect((x),(y))
#else
#define MALLOC
#define likely(x) (x)
#define unlikely(x) (x)
#define expected(x,y) (x)
#endif
#endif