push_options.hpp 3.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /*
  2. * Copyright (c) 2017-2023 zhllxt
  3. *
  4. * author : zhllxt
  5. * email : 37792738@qq.com
  6. *
  7. * Distributed under the Boost Software License, Version 1.0. (See accompanying
  8. * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  9. */
  10. // No header guard
  11. // the tests trigger deprecation warnings when compiled with msvc in C++17 mode
  12. // warning STL4009: std::allocator<void> is deprecated in C++17
  13. #if defined(_MSVC_LANG) && _MSVC_LANG > 201402
  14. # ifndef _SILENCE_CXX17_ALLOCATOR_VOID_DEPRECATION_WARNING
  15. # define _SILENCE_CXX17_ALLOCATOR_VOID_DEPRECATION_WARNING
  16. # endif
  17. # ifndef _SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING
  18. # define _SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING
  19. # endif
  20. # ifndef _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING
  21. # define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING
  22. # endif
  23. # ifndef _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS
  24. # define _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS
  25. # endif
  26. #endif
  27. #if defined(_MSC_VER)
  28. # pragma warning(push)
  29. # pragma warning(disable:4100) // warning C4100: Unreferenced formal parameters
  30. # pragma warning(disable:4189) // warning C4189: Local variables are initialized but not referenced
  31. # pragma warning(disable:4191) // asio inner : from FARPROC to cancel_io_ex_t is unsafe
  32. # pragma warning(disable:4267) // warning C4267: Convert from size_t to uint32_t may be loss data
  33. # pragma warning(disable:4311)
  34. # pragma warning(disable:4312)
  35. # pragma warning(disable:4505) // Unreferenced local function removed
  36. # pragma warning(disable:4702) // unreachable code
  37. # pragma warning(disable:4996) // warning STL4009: std::allocator<void> is deprecated in C++17
  38. # pragma warning(disable:5054) // Operator '|': deprecated between enumerations of different types
  39. #endif
  40. #if defined(__GNUC__) || defined(__GNUG__)
  41. # pragma GCC diagnostic push
  42. # pragma GCC diagnostic ignored "-Wconversion"
  43. # pragma GCC diagnostic ignored "-Woverflow"
  44. # pragma GCC diagnostic ignored "-Wunused-variable"
  45. # pragma GCC diagnostic ignored "-Wunused-parameter"
  46. # pragma GCC diagnostic ignored "-Wunused-function"
  47. # pragma GCC diagnostic ignored "-Wunused-local-typedefs"
  48. # pragma GCC diagnostic ignored "-Wdeprecated-declarations"
  49. # pragma GCC diagnostic ignored "-Wpedantic"
  50. # pragma GCC diagnostic ignored "-Wmissing-field-initializers"
  51. # if((__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) > 70101)
  52. # pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
  53. # pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
  54. # endif
  55. #endif
  56. #if defined(__clang__)
  57. # pragma clang diagnostic push
  58. # pragma clang diagnostic ignored "-Wconversion"
  59. # pragma clang diagnostic ignored "-Woverflow"
  60. # pragma clang diagnostic ignored "-Wunused-variable"
  61. # pragma clang diagnostic ignored "-Wunused-parameter"
  62. # pragma clang diagnostic ignored "-Wunused-function"
  63. # pragma clang diagnostic ignored "-Wexceptions"
  64. # pragma clang diagnostic ignored "-Wdeprecated-declarations"
  65. # pragma clang diagnostic ignored "-Wunused-private-field"
  66. # pragma clang diagnostic ignored "-Wunused-local-typedef"
  67. # pragma clang diagnostic ignored "-Wunknown-warning-option"
  68. # pragma clang diagnostic ignored "-Wpedantic"
  69. # pragma clang diagnostic ignored "-Wmissing-field-initializers"
  70. # pragma clang diagnostic ignored "-Wimplicit-fallthrough="
  71. # pragma clang diagnostic ignored "-Wunused-but-set-parameter"
  72. # pragma clang diagnostic ignored "-Wmicrosoft-template"
  73. #endif
  74. /*
  75. * see : https://github.com/retf/Boost.Application/pull/40
  76. */
  77. #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(_WIN64) || \
  78. defined(_WINDOWS_) || defined(__WINDOWS__) || defined(__TOS_WIN__)
  79. # ifndef _WIN32_WINNT
  80. # if __has_include(<winsdkver.h>)
  81. # include <winsdkver.h>
  82. # define _WIN32_WINNT _WIN32_WINNT_WIN7
  83. # endif
  84. # if __has_include(<SDKDDKVer.h>)
  85. # include <SDKDDKVer.h>
  86. # endif
  87. # endif
  88. # if __has_include(<crtdbg.h>)
  89. # include <crtdbg.h>
  90. # endif
  91. #endif