Skip to content

Commit fd6a51b

Browse files
committed
doctest override to avoid warnings
1 parent a9715d2 commit fd6a51b

File tree

3 files changed

+100
-0
lines changed

3 files changed

+100
-0
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
From 5eb20178ba43d7b3fd6dbf97b4d2a0907b59a42a Mon Sep 17 00:00:00 2001
2+
From: Severin Strobl <github@severin-strobl.de>
3+
Date: Wed, 30 Apr 2025 10:34:55 +0200
4+
Subject: [PATCH] Use <version> for libc++ detection on C++20 and beyond (#901)
5+
6+
---
7+
doctest/doctest.h | 8 ++++++--
8+
doctest/parts/doctest_fwd.h | 8 ++++++--
9+
2 files changed, 12 insertions(+), 4 deletions(-)
10+
11+
diff --git a/doctest/doctest.h b/doctest/doctest.h
12+
index 52b4a4aa3..4a1e4a09d 100644
13+
--- a/doctest/doctest.h
14+
+++ b/doctest/doctest.h
15+
@@ -490,13 +490,17 @@ DOCTEST_GCC_SUPPRESS_WARNING_POP
16+
#endif
17+
#endif // DOCTEST_CONFIG_USE_IOSFWD
18+
19+
-// for clang - always include ciso646 (which drags some std stuff) because
20+
-// we want to check if we are using libc++ with the _LIBCPP_VERSION macro in
21+
+// for clang - always include <version> or <ciso646> (which drags some std stuff)
22+
+// because we want to check if we are using libc++ with the _LIBCPP_VERSION macro in
23+
// which case we don't want to forward declare stuff from std - for reference:
24+
// https://github.com/doctest/doctest/issues/126
25+
// https://github.com/doctest/doctest/issues/356
26+
#if DOCTEST_CLANG
27+
+#if DOCTEST_CPLUSPLUS >= 201703L && __has_include(<version>)
28+
+#include <version>
29+
+#else
30+
#include <ciso646>
31+
+#endif
32+
#endif // clang
33+
34+
#ifdef _LIBCPP_VERSION
35+
diff --git a/doctest/parts/doctest_fwd.h b/doctest/parts/doctest_fwd.h
36+
index 20ed9d874..9532c1f3a 100644
37+
--- a/doctest/parts/doctest_fwd.h
38+
+++ b/doctest/parts/doctest_fwd.h
39+
@@ -487,13 +487,17 @@ DOCTEST_GCC_SUPPRESS_WARNING_POP
40+
#endif
41+
#endif // DOCTEST_CONFIG_USE_IOSFWD
42+
43+
-// for clang - always include ciso646 (which drags some std stuff) because
44+
-// we want to check if we are using libc++ with the _LIBCPP_VERSION macro in
45+
+// for clang - always include <version> or <ciso646> (which drags some std stuff)
46+
+// because we want to check if we are using libc++ with the _LIBCPP_VERSION macro in
47+
// which case we don't want to forward declare stuff from std - for reference:
48+
// https://github.com/doctest/doctest/issues/126
49+
// https://github.com/doctest/doctest/issues/356
50+
#if DOCTEST_CLANG
51+
+#if DOCTEST_CPLUSPLUS >= 201703L && __has_include(<version>)
52+
+#include <version>
53+
+#else
54+
#include <ciso646>
55+
+#endif
56+
#endif // clang
57+
58+
#ifdef _LIBCPP_VERSION
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# header-only library
2+
vcpkg_from_github(
3+
OUT_SOURCE_PATH SOURCE_PATH
4+
REPO doctest/doctest
5+
REF "v${VERSION}"
6+
SHA512 d55aae632e6d66add7b65d0e97bde5063cdae7512836f278613af35957c62dbc6b0b0febbe2eb1eddd334a7a5343faca7357a2eeebbf1428cafffeb5d18e610c
7+
HEAD_REF master
8+
PATCHES ciso646-include.patch
9+
)
10+
11+
vcpkg_cmake_configure(
12+
SOURCE_PATH "${SOURCE_PATH}"
13+
DISABLE_PARALLEL_CONFIGURE
14+
OPTIONS
15+
-DDOCTEST_WITH_TESTS=OFF
16+
)
17+
18+
vcpkg_cmake_install()
19+
20+
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/${PORT})
21+
22+
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug" "${CURRENT_PACKAGES_DIR}/lib")
23+
24+
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.txt")
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"name": "doctest",
3+
"version": "2.4.12",
4+
"port-version": 1,
5+
"description": "The fastest feature-rich C++11/14/17/20 single-header testing framework",
6+
"homepage": "https://github.com/doctest/doctest",
7+
"license": "MIT",
8+
"dependencies": [
9+
{
10+
"name": "vcpkg-cmake",
11+
"host": true
12+
},
13+
{
14+
"name": "vcpkg-cmake-config",
15+
"host": true
16+
}
17+
]
18+
}

0 commit comments

Comments
 (0)