You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
libexopt/include/exopt.h

47 lines
981 B

#ifndef _EXOPT_H
#define _EXOPT_H
#define _EO__OPT_OLD_ASSUME //XXX: __attribute__((gnu::assume(X))) fails to build
#define _EXOPT_INTERNAL_PREFIX _exopt__
#ifdef __cplusplus
# define _exopt__cpp 1
# define _exopt__c 1
extern "C" {
#else
# define _exopt__cpp 0
# define _exopt__c 1
#endif
#define _EO_PASTE_(x,y) x##y
#define _EO_PASTE(x,y) _EO_PASTE_(x,y)
#define _EO(X) _EO_PASTE(_EXOPT_INTERNAL_PREFIX, X)
#define _exopt__internal __attribute__((visibility("internal")))
#define _exopt__readonly __attribute__((__pure__))
#define _exopt__pure __attribute__((__const__))
#ifdef _EO__OPT_OLD_ASSUME
# define _EO_ASSUME(X) ({ if(! (X)) __builtin_unreachable(); })
#endif
#if _EO(cpp)
# ifndef _EO_ASSUME
# define _EO_ASSUME(X) [[gnu::assume(X)]]
# endif
# define _exopt__restrict __restrict__
#else
# ifndef _EO_ASSUME
# define _EO_ASSUME(X) __attribute__((assume(X)))
# endif
# define _exopt__restrict restrict
#endif
#ifdef __cplusplus
}
#endif
#endif /* _EXOPT_H */