macros.h 590 B

123456789101112131415161718192021222324
  1. #pragma once
  2. #include <util/system/compiler.h>
  3. #if defined(__GNUC__)
  4. #define ATTRIBUTE(args...) __attribute__((args))
  5. #else
  6. #define ATTRIBUTE(...)
  7. #endif
  8. #if defined(__GNUC__) && !defined(__clang__)
  9. #define COLD_BLOCK_BYVALUE [=]() ATTRIBUTE(noinline, cold) {
  10. #define COLD_BLOCK_BYREF [&]() ATTRIBUTE(noinline, cold) {
  11. #define COLD_BLOCK_END \
  12. } \
  13. ();
  14. #else
  15. // Clang does not support gnu-style attributes on lambda functions yet
  16. #define COLD_BLOCK_BYVALUE [=]() {
  17. #define COLD_BLOCK_BYREF [&]() {
  18. #define COLD_BLOCK_END \
  19. } \
  20. ();
  21. #endif