port.h 2.5 KB

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