XenevaOS
Loading...
Searching...
No Matches
Macros
build_bug.h File Reference
#include <linux/compiler.h>
Include dependency graph for build_bug.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define BUILD_BUG_ON_ZERO(e, ...)    __BUILD_BUG_ON_ZERO_MSG(e, ##__VA_ARGS__, #e " is true")
 
#define __BUILD_BUG_ON_NOT_POWER_OF_2(n)    BUILD_BUG_ON(((n) & ((n) - 1)) != 0)
 
#define BUILD_BUG_ON_NOT_POWER_OF_2(n)    BUILD_BUG_ON((n) == 0 || (((n) & ((n) - 1)) != 0))
 
#define BUILD_BUG_ON_INVALID(e)   ((void)(sizeof((__force long)(e))))
 
#define BUILD_BUG_ON_MSG(cond, msg)   compiletime_assert(!(cond), msg)
 
#define BUILD_BUG_ON(condition)    BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
 
#define BUILD_BUG()   BUILD_BUG_ON_MSG(1, "BUILD_BUG failed")
 
#define static_assert(expr, ...)   __static_assert(expr, ##__VA_ARGS__, #expr)
 
#define __static_assert(expr, msg, ...)   _Static_assert(expr, msg)
 
#define ASSERT_STRUCT_OFFSET(type, field, expected_offset)
 

Macro Definition Documentation

◆ __BUILD_BUG_ON_NOT_POWER_OF_2

#define __BUILD_BUG_ON_NOT_POWER_OF_2 (   n)     BUILD_BUG_ON(((n) & ((n) - 1)) != 0)

◆ __static_assert

#define __static_assert (   expr,
  msg,
  ... 
)    _Static_assert(expr, msg)

◆ ASSERT_STRUCT_OFFSET

#define ASSERT_STRUCT_OFFSET (   type,
  field,
  expected_offset 
)
Value:
BUILD_BUG_ON_MSG(offsetof(type, field) != (expected_offset), \
"Offset of " #field " in " #type " has changed.")
#define BUILD_BUG_ON_MSG(cond, msg)
#define offsetof(type, member)
Definition kernel.h:177

◆ BUILD_BUG

#define BUILD_BUG ( )    BUILD_BUG_ON_MSG(1, "BUILD_BUG failed")

◆ BUILD_BUG_ON

#define BUILD_BUG_ON (   condition)     BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)

◆ BUILD_BUG_ON_INVALID

#define BUILD_BUG_ON_INVALID (   e)    ((void)(sizeof((__force long)(e))))

◆ BUILD_BUG_ON_MSG

#define BUILD_BUG_ON_MSG (   cond,
  msg 
)    compiletime_assert(!(cond), msg)

◆ BUILD_BUG_ON_NOT_POWER_OF_2

#define BUILD_BUG_ON_NOT_POWER_OF_2 (   n)     BUILD_BUG_ON((n) == 0 || (((n) & ((n) - 1)) != 0))

◆ BUILD_BUG_ON_ZERO

#define BUILD_BUG_ON_ZERO (   e,
  ... 
)     __BUILD_BUG_ON_ZERO_MSG(e, ##__VA_ARGS__, #e " is true")

◆ static_assert

#define static_assert (   expr,
  ... 
)    __static_assert(expr, ##__VA_ARGS__, #expr)