except.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/except.h
  3. // Purpose: C++ exception related stuff
  4. // Author: Vadim Zeitlin
  5. // Modified by:
  6. // Created: 17.09.2003
  7. // Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org>
  8. // Licence: wxWindows licence
  9. ///////////////////////////////////////////////////////////////////////////////
  10. #ifndef _WX_EXCEPT_H_
  11. #define _WX_EXCEPT_H_
  12. #include "wx/defs.h"
  13. // ----------------------------------------------------------------------------
  14. // macros working whether wxUSE_EXCEPTIONS is 0 or 1
  15. // ----------------------------------------------------------------------------
  16. // even if the library itself was compiled with exceptions support, the user
  17. // code using it might be compiling with a compiler switch disabling them in
  18. // which cases we shouldn't use try/catch in the headers -- this results in
  19. // compilation errors in e.g. wx/scopeguard.h with at least g++ 4
  20. #if !wxUSE_EXCEPTIONS || \
  21. (defined(__GNUG__) && !defined(__EXCEPTIONS))
  22. #ifndef wxNO_EXCEPTIONS
  23. #define wxNO_EXCEPTIONS
  24. #endif
  25. #endif
  26. #ifdef wxNO_EXCEPTIONS
  27. #define wxTRY
  28. #define wxCATCH_ALL(code)
  29. #else // do use exceptions
  30. #define wxTRY try
  31. #define wxCATCH_ALL(code) catch ( ... ) { code }
  32. #endif // wxNO_EXCEPTIONS/!wxNO_EXCEPTIONS
  33. #endif // _WX_EXCEPT_H_