Portability.hh 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. * Portability.hh
  3. *
  4. * Copyright 2001, LifeLine Networks BV (www.lifeline.nl). All rights reserved.
  5. * Copyright 2001, Bastiaan Bakker. All rights reserved.
  6. *
  7. * See the COPYING file for the terms of usage and distribution.
  8. */
  9. #ifndef _LOG4CPP_PORTABILITY_HH
  10. #define _LOG4CPP_PORTABILITY_HH
  11. #if defined (_MSC_VER) || defined(__BORLANDC__)
  12. # if defined (LOG4CPP_STLPORT_AND_BOOST_BUILD)
  13. # include <log4cpp/config-win32-stlport-boost.h>
  14. # else
  15. # include <log4cpp/config-win32.h>
  16. # endif
  17. #ifdef MSVC_MEMORY_LEAK_CHECK
  18. #define _CRTDBG_MAP_ALLOC
  19. #include <stdlib.h>
  20. #include <crtdbg.h>
  21. #ifdef _DEBUG
  22. #ifndef DBG_NEW
  23. #define DBG_NEW new ( _NORMAL_BLOCK , __FILE__ , __LINE__ )
  24. #define new DBG_NEW
  25. #endif
  26. #endif // _DEBUG
  27. #endif // MSVC_MEMORY_LEAK_CHECK
  28. #else
  29. #if defined(__OPENVMS__)
  30. # include <log4cpp/config-openvms.h>
  31. #else
  32. # if defined(__MINGW32__)
  33. # include <log4cpp/config-MinGW32.h>
  34. # else
  35. # include <log4cpp/config.h>
  36. # endif
  37. #endif
  38. #endif
  39. #include <log4cpp/Export.hh>
  40. #if defined(_MSC_VER)
  41. # pragma warning( disable : 4786 ) // 255 char debug symbol limit
  42. # pragma warning( disable : 4290 ) // throw specifier not implemented
  43. # pragma warning( disable : 4251 ) // "class XXX should be exported"
  44. #endif
  45. #ifdef __APPLE__
  46. # include <sstream>
  47. #else
  48. # ifndef LOG4CPP_HAVE_SSTREAM
  49. # include <strstream>
  50. namespace std {
  51. class LOG4CPP_EXPORT ostringstream : public ostrstream {
  52. public:
  53. std::string str();
  54. };
  55. };
  56. # endif // LOG4CPP_HAVE_SSTREAM
  57. #endif // _APPLE_
  58. // Support both modern and deprecated compilers, supplying different c++language constructs via macros
  59. #if defined(__cplusplus) && (__cplusplus >= 201103L)
  60. #define LOG4CPP_UNIQUE_PTR unique_ptr
  61. #define LOG4CPP_UNIQUE_PTR_MOVE(ptr) std::move(ptr)
  62. #else
  63. #define LOG4CPP_UNIQUE_PTR auto_ptr
  64. #define LOG4CPP_UNIQUE_PTR_MOVE(ptr) ptr
  65. #endif //__cplusplus
  66. #if defined(__cplusplus) && (__cplusplus >= 201703L)
  67. #define LOG4CPP_NOTHROW noexcept
  68. #else
  69. #define LOG4CPP_NOTHROW throw()
  70. #endif //__cplusplus
  71. #endif //_LOG4CPP_PORTABILITY_HH