port.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #pragma once
  2. #include <util/system/platform.h>
  3. // Check platform bitness.
  4. #if !defined(_64_)
  5. #error YT requires 64-bit platform
  6. #endif
  7. #ifndef YT_DISABLE_REF_COUNTED_TRACKING
  8. // This define enables tracking of reference-counted objects to provide
  9. // various insightful information on memory usage and object creation patterns.
  10. #define YT_ENABLE_REF_COUNTED_TRACKING
  11. #endif
  12. // This define enables logging with TRACE level. You can still disable trace logging
  13. // for particular TU by discarding this macro identifier.
  14. #define YT_ENABLE_TRACE_LOGGING
  15. // This define should be used to compile YT with vanilla protobuf instead of patched one.
  16. // #define YT_USE_VANILLA_PROTOBUF
  17. #ifndef NDEBUG
  18. // This define enables thread affinity check -- a user-defined verification ensuring
  19. // that some functions are called from particular threads.
  20. #define YT_ENABLE_THREAD_AFFINITY_CHECK
  21. // This define enables tracking of BIND callbacks location.
  22. #define YT_ENABLE_BIND_LOCATION_TRACKING
  23. // This define enables checking that all required protobuf fields are present
  24. // during serialization.
  25. #define YT_VALIDATE_REQUIRED_PROTO_FIELDS
  26. // Detects deadlocks caused by recursive acquisitions of (non-recursive) spin locks.
  27. #define YT_ENABLE_SPIN_LOCK_OWNERSHIP_TRACKING
  28. #endif
  29. // Configure SSE usage.
  30. #ifdef SSE42_ENABLED
  31. #define YT_USE_SSE42
  32. #endif
  33. #ifdef _win_
  34. // Someone above has defined this by including one of Windows headers.
  35. #undef GetMessage
  36. #undef Yield
  37. // For protobuf-generated files:
  38. // C4125: decimal digit terminates octal escape sequence
  39. #pragma warning (disable: 4125)
  40. // C4505: unreferenced local function has been removed
  41. #pragma warning (disable : 4505)
  42. // C4121: alignment of a member was sensitive to packing
  43. #pragma warning (disable: 4121)
  44. // C4503: decorated name length exceeded, name was truncated
  45. #pragma warning (disable : 4503)
  46. // C4714: function marked as __forceinline not inlined
  47. #pragma warning (disable: 4714)
  48. // C4250: inherits via dominance
  49. #pragma warning (disable: 4250)
  50. #endif
  51. #if defined(__GNUC__) || defined(__clang__)
  52. #define YT_ATTRIBUTE_NO_SANITIZE_ADDRESS __attribute__((no_sanitize_address))
  53. // Prevent GCC from throwing out functions in release builds.
  54. #define YT_ATTRIBUTE_USED __attribute__((used))
  55. #elif defined(_MSC_VER)
  56. #define YT_ATTRIBUTE_NO_SANITIZE_ADDRESS
  57. #define YT_ATTRIBUTE_USED
  58. #else
  59. #error Unsupported compiler
  60. #endif
  61. #if defined(_unix_)
  62. #define YT_ATTRIBUTE_NO_UNIQUE_ADDRESS [[no_unique_address]]
  63. #else
  64. #define YT_ATTRIBUTE_NO_UNIQUE_ADDRESS
  65. #endif