seL4/libsel4/include/sel4/macros.h
Adrian Danis 436c216d0e libsel4: Make enum padding types one less in value so that they are INT_MAX
Having the padding types as INT_MAX + 1 means C++ compilers will end up using
a signed 64 bit integer, as that is the only type that can have a value that
large, as well as the negative values our enums typically contain
2014-10-31 09:16:07 +11:00

30 lines
719 B
C

/*
* Copyright 2014, NICTA
*
* This software may be distributed and modified according to the terms of
* the BSD 2-Clause license. Note that NO WARRANTY is provided.
* See "LICENSE_BSD2.txt" for details.
*
* @TAG(NICTA_BSD)
*/
#ifndef __LIBSEL4_MACROS_H
#define __LIBSEL4_MACROS_H
/*
* Some compilers attempt to pack enums into the smallest possible type.
* For ABI compatability with the kernel, we need to ensure they remain
* the same size as an 'int'.
*/
#define SEL4_FORCE_LONG_ENUM(type) \
_enum_pad_ ## type = (1U << ((sizeof(int)*8) - 1)) - 1
#ifndef CONST
#define CONST __attribute__((__const__))
#endif
#ifndef PURE
#define PURE __attribute__((__pure__))
#endif
#endif