diff options
author | swarmer <swarmer@yandex-team.com> | 2023-12-13 23:12:17 +0300 |
---|---|---|
committer | swarmer <swarmer@yandex-team.com> | 2023-12-14 00:53:11 +0300 |
commit | bd109f0363431e600753848af39402c6e09e007a (patch) | |
tree | 3a84bcf54e42387e0bff51cadf40285777f8be7b | |
parent | fba7d3f86a840240afd37301f6ee97a316fe1576 (diff) | |
download | ydb-bd109f0363431e600753848af39402c6e09e007a.tar.gz |
finer check of lifetimebound attribute support
Fix warnings when compiling with old CUDA SDKs.
-rw-r--r-- | util/system/compiler.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/util/system/compiler.h b/util/system/compiler.h index 0eac0715a6..720ae0dc61 100644 --- a/util/system/compiler.h +++ b/util/system/compiler.h @@ -659,8 +659,14 @@ Y_FORCE_INLINE void DoNotOptimizeAway(const T&) = delete; * The compiler may produce compile-time warning if it is able to detect that * an object or reference refers to another object with a shorter lifetime. */ -#if defined(__clang__) - #define Y_LIFETIME_BOUND [[clang::lifetimebound]] +#if defined(__clang__) && defined(__cplusplus) && defined(__has_cpp_attribute) + #if defined(__CUDACC__) && !Y_CUDA_AT_LEAST(11, 0) + #define Y_LIFETIME_BOUND + #elif __has_cpp_attribute(clang::lifetimebound) + #define Y_LIFETIME_BOUND [[clang::lifetimebound]] + #else + #define Y_LIFETIME_BOUND + #endif #else #define Y_LIFETIME_BOUND #endif |