bug.h 857 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #ifndef _ASM_GENERIC_BUG_H
  2. #define _ASM_GENERIC_BUG_H
  3. #include <linux/compiler.h>
  4. #ifdef CONFIG_BUG
  5. #ifndef HAVE_ARCH_BUG
  6. #define BUG() do { \
  7. printk("BUG: failure at %s:%d/%s()!\n", __FILE__, __LINE__, __FUNCTION__); \
  8. panic("BUG!"); \
  9. } while (0)
  10. #endif
  11. #ifndef HAVE_ARCH_BUG_ON
  12. #define BUG_ON(condition) do { if (unlikely((condition)!=0)) BUG(); } while(0)
  13. #endif
  14. #ifndef HAVE_ARCH_WARN_ON
  15. #define WARN_ON(condition) do { \
  16. if (unlikely((condition)!=0)) { \
  17. printk("BUG: warning at %s:%d/%s()\n", __FILE__, __LINE__, __FUNCTION__); \
  18. dump_stack(); \
  19. } \
  20. } while (0)
  21. #endif
  22. #else /* !CONFIG_BUG */
  23. #ifndef HAVE_ARCH_BUG
  24. #define BUG()
  25. #endif
  26. #ifndef HAVE_ARCH_BUG_ON
  27. #define BUG_ON(condition) do { if (condition) ; } while(0)
  28. #endif
  29. #ifndef HAVE_ARCH_WARN_ON
  30. #define WARN_ON(condition) do { if (condition) ; } while(0)
  31. #endif
  32. #endif
  33. #endif