assert.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * assert.h
  3. *
  4. * Define the assert macro for debug output.
  5. *
  6. * This file is part of the Mingw32 package.
  7. *
  8. * Contributors:
  9. * Created by Colin Peters <[email protected]>
  10. *
  11. * THIS SOFTWARE IS NOT COPYRIGHTED
  12. *
  13. * This source code is offered for use in the public domain. You may
  14. * use, modify or distribute it freely.
  15. *
  16. * This code is distributed in the hope that it will be useful but
  17. * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
  18. * DISCLAIMED. This includes but is not limited to warranties of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  20. *
  21. * $Revision: 1.2 $
  22. * $Author: bellard $
  23. * $Date: 2005/04/17 13:14:29 $
  24. *
  25. */
  26. #ifndef _ASSERT_H_
  27. #define _ASSERT_H_
  28. /* All the headers include this file. */
  29. #include <_mingw.h>
  30. #ifndef RC_INVOKED
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34. #ifdef NDEBUG
  35. /*
  36. * If not debugging, assert does nothing.
  37. */
  38. #define assert(x) ((void)0)
  39. #else /* debugging enabled */
  40. /*
  41. * CRTDLL nicely supplies a function which does the actual output and
  42. * call to abort.
  43. */
  44. void _assert (const char*, const char*, int)
  45. #ifdef __GNUC__
  46. __attribute__ ((noreturn))
  47. #endif
  48. ;
  49. /*
  50. * Definition of the assert macro.
  51. */
  52. #define assert(e) ((e) ? (void)0 : _assert(#e, __FILE__, __LINE__))
  53. #endif /* NDEBUG */
  54. #ifdef __cplusplus
  55. }
  56. #endif
  57. #endif /* Not RC_INVOKED */
  58. #endif /* Not _ASSERT_H_ */