diff options
| author | swarmer <[email protected]> | 2025-08-05 01:56:41 +0300 |
|---|---|---|
| committer | swarmer <[email protected]> | 2025-08-05 02:11:02 +0300 |
| commit | 24c1e08593d85ab866a1d74210c9c254597b0ec6 (patch) | |
| tree | 14a6690e189bceed2c2476fee9eec59eec7853fb /library/cpp/yt/string/string.cpp | |
| parent | e77b4d80c8ccd96ebe59d7440efd0df0ab89f7eb (diff) | |
Y_HAS_CPP_ATTRIBUTE macro
The new macro `Y_HAS_CPP_ATTRIBUTE` simplifies the check for C++ attribute support by handling nested `#if defined(__has_cpp_attribute)` checks.
Before:
```cpp
#if defined(__has_cpp_attribute)
#if __has_cpp_attribute(attribute_name)
// use
#else
// fallback
#endif
#else
// fallback
#endif
```
After:
```cpp
#if Y_HAS_CPP_ATTRIBUTE(attribute_name)
// use
#else
// fallback
#endif
```
The new macro also allows checking C++ attributes when compiling C code without raising errors related to different tokenization rules in these languages. Of course, such a test always returns `0` when compiling source code in C.
Also, rename `Y_HAVE_ATTRIBUTE` to `Y_HAS_ATTRIBUTE` for consistency.
commit_hash:9c12fe5d0e6a570d7f11910704c0a9b05d100434
Diffstat (limited to 'library/cpp/yt/string/string.cpp')
0 files changed, 0 insertions, 0 deletions
