compiler-gcc.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /* Never include this file directly. Include <linux/compiler.h> instead. */
  2. /*
  3. * Common definitions for all gcc versions go here.
  4. */
  5. /* Optimization barrier */
  6. /* The "volatile" is due to gcc bugs */
  7. #define barrier() __asm__ __volatile__("": : :"memory")
  8. /* This macro obfuscates arithmetic on a variable address so that gcc
  9. shouldn't recognize the original var, and make assumptions about it */
  10. /*
  11. * Versions of the ppc64 compiler before 4.1 had a bug where use of
  12. * RELOC_HIDE could trash r30. The bug can be worked around by changing
  13. * the inline assembly constraint from =g to =r, in this particular
  14. * case either is valid.
  15. */
  16. #define RELOC_HIDE(ptr, off) \
  17. ({ unsigned long __ptr; \
  18. __asm__ ("" : "=r"(__ptr) : "0"(ptr)); \
  19. (typeof(ptr)) (__ptr + (off)); })
  20. /* &a[0] degrades to a pointer: a different type from an array */
  21. #define __must_be_array(a) \
  22. BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(typeof(a), typeof(&a[0])))
  23. #define inline inline __attribute__((always_inline))
  24. #define __inline__ __inline__ __attribute__((always_inline))
  25. #define __inline __inline __attribute__((always_inline))
  26. #define __deprecated __attribute__((deprecated))
  27. #define __packed __attribute__((packed))
  28. #define __weak __attribute__((weak))
  29. #define __naked __attribute__((naked))
  30. #define __noreturn __attribute__((noreturn))
  31. #define __pure __attribute__((pure))
  32. #define __aligned(x) __attribute__((aligned(x)))
  33. #define __printf(a,b) __attribute__((format(printf,a,b)))
  34. #define noinline __attribute__((noinline))
  35. #define __attribute_pure__ __attribute__((pure))
  36. #define __attribute_const__ __attribute__((__const__))
  37. #define __maybe_unused __attribute__((unused))