compiler.h 734 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #ifndef _TOOLS_LINUX_COMPILER_H_
  2. #define _TOOLS_LINUX_COMPILER_H_
  3. #ifndef __always_inline
  4. # define __always_inline inline __attribute__((always_inline))
  5. #endif
  6. #define __user
  7. #ifndef __attribute_const__
  8. # define __attribute_const__
  9. #endif
  10. #ifndef __maybe_unused
  11. # define __maybe_unused __attribute__((unused))
  12. #endif
  13. #ifndef __packed
  14. # define __packed __attribute__((__packed__))
  15. #endif
  16. #ifndef __force
  17. # define __force
  18. #endif
  19. #ifndef __weak
  20. # define __weak __attribute__((weak))
  21. #endif
  22. #ifndef likely
  23. # define likely(x) __builtin_expect(!!(x), 1)
  24. #endif
  25. #ifndef unlikely
  26. # define unlikely(x) __builtin_expect(!!(x), 0)
  27. #endif
  28. #define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x))
  29. #endif /* _TOOLS_LINUX_COMPILER_H */