diff options
| author | Martin Hořeňovský | 2025-10-03 22:15:23 +0200 |
|---|---|---|
| committer | Martin Hořeňovský | 2025-10-03 22:15:27 +0200 |
| commit | 8219ed79f29420c89748ae5eb8810946cefd491d (patch) | |
| tree | 2914b693378776d0098222dda8074a4d5d46b2cf /src | |
| parent | b3fb4b9feafcd8d91c5cb510a4775143fdbef02f (diff) | |
| download | catch3-8219ed79f29420c89748ae5eb8810946cefd491d.tar.gz | |
Add CATCH_ATTR_LIFETIMEBOUND macro polyfill over lifetimebound attr
Diffstat (limited to 'src')
| -rw-r--r-- | src/CMakeLists.txt | 1 | ||||
| -rw-r--r-- | src/catch2/catch_all.hpp | 1 | ||||
| -rw-r--r-- | src/catch2/internal/catch_lifetimebound.hpp | 24 | ||||
| -rw-r--r-- | src/catch2/meson.build | 1 |
4 files changed, 27 insertions, 0 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1e3af147..554346f4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -98,6 +98,7 @@ set(IMPL_HEADERS ${SOURCES_DIR}/internal/catch_jsonwriter.hpp ${SOURCES_DIR}/internal/catch_lazy_expr.hpp ${SOURCES_DIR}/internal/catch_leak_detector.hpp + ${SOURCES_DIR}/internal/catch_lifetimebound.hpp ${SOURCES_DIR}/internal/catch_list.hpp ${SOURCES_DIR}/internal/catch_logical_traits.hpp ${SOURCES_DIR}/internal/catch_message_info.hpp diff --git a/src/catch2/catch_all.hpp b/src/catch2/catch_all.hpp index 2417d856..3dc4609e 100644 --- a/src/catch2/catch_all.hpp +++ b/src/catch2/catch_all.hpp @@ -79,6 +79,7 @@ #include <catch2/internal/catch_jsonwriter.hpp> #include <catch2/internal/catch_lazy_expr.hpp> #include <catch2/internal/catch_leak_detector.hpp> +#include <catch2/internal/catch_lifetimebound.hpp> #include <catch2/internal/catch_list.hpp> #include <catch2/internal/catch_logical_traits.hpp> #include <catch2/internal/catch_message_info.hpp> diff --git a/src/catch2/internal/catch_lifetimebound.hpp b/src/catch2/internal/catch_lifetimebound.hpp new file mode 100644 index 00000000..8114dc70 --- /dev/null +++ b/src/catch2/internal/catch_lifetimebound.hpp @@ -0,0 +1,24 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 + +#ifndef CATCH_LIFETIMEBOUND_HPP_INCLUDED +#define CATCH_LIFETIMEBOUND_HPP_INCLUDED + +#if !defined( __has_cpp_attribute ) +# define CATCH_ATTR_LIFETIMEBOUND +#elif __has_cpp_attribute( msvc::lifetimebound ) +# define CATCH_ATTR_LIFETIMEBOUND [[msvc::lifetimebound]] +#elif __has_cpp_attribute( clang::lifetimebound ) +# define CATCH_ATTR_LIFETIMEBOUND [[clang::lifetimebound]] +#elif __has_cpp_attribute( lifetimebound ) +# define CATCH_ATTR_LIFETIMEBOUND [[lifetimebound]] +#else +# define CATCH_ATTR_LIFETIMEBOUND +#endif + +#endif // CATCH_LIFETIMEBOUND_HPP_INCLUDED diff --git a/src/catch2/meson.build b/src/catch2/meson.build index 60f7777a..273e330f 100644 --- a/src/catch2/meson.build +++ b/src/catch2/meson.build @@ -105,6 +105,7 @@ internal_headers = [ 'internal/catch_jsonwriter.hpp', 'internal/catch_lazy_expr.hpp', 'internal/catch_leak_detector.hpp', + 'internal/catch_lifetimebound.hpp', 'internal/catch_list.hpp', 'internal/catch_logical_traits.hpp', 'internal/catch_message_info.hpp', |