csr_assert.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* ***** BEGIN LICENSE BLOCK *****
  3. * Version: GPL 2.0
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License. You should have
  7. * received a copy of the GPL license along with this program; if you
  8. * did not, you can find it at http://www.gnu.org/
  9. *
  10. * Software distributed under the License is distributed on an "AS IS" basis,
  11. * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12. * for the specific language governing rights and limitations under the
  13. * License.
  14. *
  15. * The Original Code is Coreseek.com code.
  16. *
  17. * Copyright (C) 2007-2008. All Rights Reserved.
  18. *
  19. * Author:
  20. * Li monan <li.monan@gmail.com>
  21. *
  22. * ***** END LICENSE BLOCK ***** */
  23. #ifndef _CSR_ASSERT_H_
  24. #define _CSR_ASSERT_H_
  25. /* Modified to dump core, rather than exit. May/85 RNS */
  26. #ifdef __cplusplus
  27. extern "C" {
  28. #endif
  29. void AssertionFailed(char *file, int line);
  30. #ifdef _ASSERT
  31. #undef _ASSERT
  32. #define _ASSERT(ex) \
  33. do { \
  34. if (!(ex)) AssertionFailed(__FILE__, __LINE__); \
  35. } while (0);
  36. #else
  37. #define _ASSERT(ex)
  38. #endif // _DEBUG
  39. #ifdef __cplusplus
  40. };
  41. #endif
  42. #endif