Skip to content

Commit bcc4007

Browse files
committed
Skeleton for applying deprecation warnings
1 parent 715558f commit bcc4007

6 files changed

Lines changed: 34 additions & 0 deletions

File tree

BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ expand_template(
3232
"#cmakedefine CATCH_CONFIG_CPP17_STRING_VIEW": "",
3333
"#cmakedefine CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS": "",
3434
"#cmakedefine CATCH_CONFIG_CPP17_VARIANT": "",
35+
"#cmakedefine CATCH_CONFIG_DEPRECATED_ANNOTATIONS": "",
3536
"#cmakedefine CATCH_CONFIG_DISABLE_EXCEPTIONS_CUSTOM_HANDLER": "",
3637
"#cmakedefine CATCH_CONFIG_DISABLE_EXCEPTIONS": "",
3738
"#cmakedefine CATCH_CONFIG_DISABLE_STRINGIFICATION": "",
@@ -55,6 +56,7 @@ expand_template(
5556
"#cmakedefine CATCH_CONFIG_NO_CPP17_STRING_VIEW": "",
5657
"#cmakedefine CATCH_CONFIG_NO_CPP17_UNCAUGHT_EXCEPTIONS": "",
5758
"#cmakedefine CATCH_CONFIG_NO_CPP17_VARIANT": "",
59+
"#cmakedefine CATCH_CONFIG_NO_DEPRECATED_ANNOTATIONS": "",
5860
"#cmakedefine CATCH_CONFIG_NO_GETENV": "",
5961
"#cmakedefine CATCH_CONFIG_NO_GLOBAL_NEXTAFTER": "",
6062
"#cmakedefine CATCH_CONFIG_NO_POSIX_SIGNALS": "",

CMake/CatchConfigOptions.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ set(_OverridableOptions
4444
"GETENV"
4545
"EXPERIMENTAL_STATIC_ANALYSIS_SUPPORT"
4646
"USE_BUILTIN_CONSTANT_P"
47+
"DEPRECATED_ANNOTATIONS"
4748
)
4849

4950
foreach(OptionName ${_OverridableOptions})

src/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ set(IMPL_HEADERS
8585
${SOURCES_DIR}/internal/catch_debug_console.hpp
8686
${SOURCES_DIR}/internal/catch_debugger.hpp
8787
${SOURCES_DIR}/internal/catch_decomposer.hpp
88+
${SOURCES_DIR}/internal/catch_deprecation_macro.hpp
8889
${SOURCES_DIR}/internal/catch_enforce.hpp
8990
${SOURCES_DIR}/internal/catch_enum_values_registry.hpp
9091
${SOURCES_DIR}/internal/catch_errno_guard.hpp

src/catch2/catch_user_config.hpp.in

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,16 @@
187187
#endif
188188

189189

190+
#cmakedefine CATCH_CONFIG_DEPRECATED_ANNOTATIONS
191+
#cmakedefine CATCH_CONFIG_NO_DEPRECATED_ANNOTATIONS
192+
193+
#if defined( CATCH_CONFIG_DEPRECATED_ANNOTATIONS ) && \
194+
defined( CATCH_CONFIG_NO_DEPRECATED_ANNOTATIONS )
195+
# error Cannot force DEPRECATED_ANNOTATIONS to both ON and OFF
196+
#endif
197+
198+
199+
190200
// ------
191201
// Simple toggle defines
192202
// their value is never used and they cannot be overridden
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
2+
// Copyright Catch2 Authors
3+
// Distributed under the Boost Software License, Version 1.0.
4+
// (See accompanying file LICENSE.txt or copy at
5+
// https://www.boost.org/LICENSE_1_0.txt)
6+
7+
// SPDX-License-Identifier: BSL-1.0
8+
#ifndef CATCH_DEPRECATION_MACRO_HPP_INCLUDED
9+
#define CATCH_DEPRECATION_MACRO_HPP_INCLUDED
10+
11+
#include <catch2/catch_user_config.hpp>
12+
13+
#if !defined( CATCH_CONFIG_NO_DEPRECATED_ANNOTATIONS )
14+
# define DEPRECATED(msg) [[deprecated(msg)]]
15+
#else
16+
# define DEPRECATED(msg)
17+
#endif
18+
19+
#endif // CATCH_DEPRECATION_MACRO_HPP_INCLUDED

src/catch2/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ internal_headers = [
9292
'internal/catch_debug_console.hpp',
9393
'internal/catch_debugger.hpp',
9494
'internal/catch_decomposer.hpp',
95+
'internal/catch_deprecation_macro.hpp',
9596
'internal/catch_enforce.hpp',
9697
'internal/catch_enum_values_registry.hpp',
9798
'internal/catch_errno_guard.hpp',

0 commit comments

Comments
 (0)