compiler-gcc4.h 1.3 KB

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