compiler-gcc4.h 1.2 KB

1234567891011121314151617181920212223242526272829303132
  1. #ifndef __LINUX_COMPILER_H
  2. #error "Please don't include <linux/compiler-gcc4.h> directly, include <linux/compiler.h> instead."
  3. #endif
  4. #define __used __attribute__((__used__))
  5. #define __must_check __attribute__((warn_unused_result))
  6. #define __compiler_offsetof(a,b) __builtin_offsetof(a,b)
  7. #define __always_inline inline __attribute__((always_inline))
  8. /*
  9. * A trick to suppress uninitialized variable warning without generating any
  10. * code
  11. */
  12. #define uninitialized_var(x) x = x
  13. #if __GNUC_MINOR__ >= 3
  14. /* Mark functions as cold. gcc will assume any path leading to a call
  15. to them will be unlikely. This means a lot of manual unlikely()s
  16. are unnecessary now for any paths leading to the usual suspects
  17. like BUG(), printk(), panic() etc. [but let's keep them for now for
  18. older compilers]
  19. Early snapshots of gcc 4.3 don't support this and we can't detect this
  20. in the preprocessor, but we can live with this because they're unreleased.
  21. Maketime probing would be overkill here.
  22. gcc also has a __attribute__((__hot__)) to move hot functions into
  23. a special section, but I don't see any sense in this right now in
  24. the kernel context */
  25. #define __cold __attribute__((__cold__))
  26. #endif