From ac46a2ade2857e6659bd89b047e552e6b782d84f Mon Sep 17 00:00:00 2001 From: Vitaly Zaitsev Date: Dec 03 2022 15:05:20 +0000 Subject: Backported upstream patch with pointer compare fixes. --- diff --git a/doctest-pointers-compare-fix.patch b/doctest-pointers-compare-fix.patch new file mode 100644 index 0000000..050383b --- /dev/null +++ b/doctest-pointers-compare-fix.patch @@ -0,0 +1,661 @@ +From 1d0edf4d4c0219e3b5250518621d1029f3b79037 Mon Sep 17 00:00:00 2001 +From: Sprite +Date: Tue, 27 Sep 2022 18:56:30 +0800 +Subject: [PATCH 01/11] Explicitly convert pointer in `filldata::fill` + +--- + doctest/doctest.h | 2 +- + doctest/parts/doctest_fwd.h | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/doctest/doctest.h b/doctest/doctest.h +index aa2724c73..52076b751 100644 +--- a/doctest/doctest.h ++++ b/doctest/doctest.h +@@ -1163,7 +1163,7 @@ DOCTEST_MSVC_SUPPRESS_WARNING_POP + template + struct filldata { + static void fill(std::ostream* stream, const T* in) { +- filldata::fill(stream, in); ++ filldata::fill(stream, reinterpret_cast(in)); + } + }; + } +diff --git a/doctest/parts/doctest_fwd.h b/doctest/parts/doctest_fwd.h +index 090a10e1b..2881c4722 100644 +--- a/doctest/parts/doctest_fwd.h ++++ b/doctest/parts/doctest_fwd.h +@@ -1160,7 +1160,7 @@ DOCTEST_MSVC_SUPPRESS_WARNING_POP + template + struct filldata { + static void fill(std::ostream* stream, const T* in) { +- filldata::fill(stream, in); ++ filldata::fill(stream, reinterpret_cast(in)); + } + }; + } + +From 571bf36564c6bdc243dbef1ca30eb2fe78c3a2ce Mon Sep 17 00:00:00 2001 +From: Salvage <29021710+Saalvage@users.noreply.github.com> +Date: Sat, 1 Oct 2022 17:07:47 +0200 +Subject: [PATCH 02/11] Add regression test + +--- + doctest/doctest.h | 2 ++ + doctest/parts/doctest_fwd.h | 2 ++ + examples/all_features/stringification.cpp | 12 ++++++++++++ + examples/all_features/test_output/filter_2.txt | 2 +- + examples/all_features/test_output/filter_2_xml.txt | 3 ++- + .../test_output/no_multi_lane_atomics.txt | 4 ++-- + .../all_features/test_output/no_multithreading.txt | 4 ++-- + examples/all_features/test_output/std_headers.txt | 4 ++-- + .../all_features/test_output/stringification.cpp.txt | 4 ++-- + .../test_output/stringification.cpp_junit.txt | 3 ++- + .../test_output/stringification.cpp_xml.txt | 7 +++++-- + 11 files changed, 34 insertions(+), 13 deletions(-) + +diff --git a/doctest/doctest.h b/doctest/doctest.h +index 84d8bf0fe..28a58dbfb 100644 +--- a/doctest/doctest.h ++++ b/doctest/doctest.h +@@ -1163,7 +1163,9 @@ DOCTEST_MSVC_SUPPRESS_WARNING_POP + + template + struct filldata { ++DOCTEST_MSVC_SUPPRESS_WARNING_WITH_PUSH(4180) + static void fill(std::ostream* stream, const T* in) { ++DOCTEST_MSVC_SUPPRESS_WARNING_POP + filldata::fill(stream, reinterpret_cast(in)); + } + }; +diff --git a/doctest/parts/doctest_fwd.h b/doctest/parts/doctest_fwd.h +index 24d327cc9..ff948678d 100644 +--- a/doctest/parts/doctest_fwd.h ++++ b/doctest/parts/doctest_fwd.h +@@ -1160,7 +1160,9 @@ DOCTEST_MSVC_SUPPRESS_WARNING_POP + + template + struct filldata { ++DOCTEST_MSVC_SUPPRESS_WARNING_WITH_PUSH(4180) + static void fill(std::ostream* stream, const T* in) { ++DOCTEST_MSVC_SUPPRESS_WARNING_POP + filldata::fill(stream, reinterpret_cast(in)); + } + }; +diff --git a/examples/all_features/stringification.cpp b/examples/all_features/stringification.cpp +index a9518a3d2..b59d657e5 100644 +--- a/examples/all_features/stringification.cpp ++++ b/examples/all_features/stringification.cpp +@@ -248,3 +248,15 @@ TEST_CASE("a test case that registers an exception translator for int and then t + + throw_if(true, 5); + } ++ ++static void function() { } ++ ++TEST_CASE("pointer comparisons") { ++ auto a = new int(); ++ auto b = a; ++ CHECK(a == b); ++ CHECK_EQ(a, b); ++ ++ void (*functionPointer)() = &function; ++ CHECK(&function == functionPointer); ++} +diff --git a/examples/all_features/test_output/filter_2.txt b/examples/all_features/test_output/filter_2.txt +index a523bf4ad..40a745ac8 100644 +--- a/examples/all_features/test_output/filter_2.txt ++++ b/examples/all_features/test_output/filter_2.txt +@@ -1,6 +1,6 @@ + [doctest] run with "--help" for options + =============================================================================== +-[doctest] test cases: 0 | 0 passed | 0 failed | 104 skipped ++[doctest] test cases: 0 | 0 passed | 0 failed | 105 skipped + [doctest] assertions: 0 | 0 passed | 0 failed | + [doctest] Status: SUCCESS! + Program code. +diff --git a/examples/all_features/test_output/filter_2_xml.txt b/examples/all_features/test_output/filter_2_xml.txt +index 648addd6a..b152f4b25 100644 +--- a/examples/all_features/test_output/filter_2_xml.txt ++++ b/examples/all_features/test_output/filter_2_xml.txt +@@ -109,6 +109,7 @@ + + + ++ + + + +@@ -148,6 +149,6 @@ + + + +- ++ + + Program code. +diff --git a/examples/all_features/test_output/no_multi_lane_atomics.txt b/examples/all_features/test_output/no_multi_lane_atomics.txt +index 1ebce1495..87fa818a7 100644 +--- a/examples/all_features/test_output/no_multi_lane_atomics.txt ++++ b/examples/all_features/test_output/no_multi_lane_atomics.txt +@@ -925,7 +925,7 @@ TEST CASE: without a funny name: + subcases.cpp(0): MESSAGE: Nooo + + =============================================================================== +-[doctest] test cases: 84 | 33 passed | 51 failed | +-[doctest] assertions: 230 | 110 passed | 120 failed | ++[doctest] test cases: 85 | 34 passed | 51 failed | ++[doctest] assertions: 233 | 113 passed | 120 failed | + [doctest] Status: FAILURE! + Program code. +diff --git a/examples/all_features/test_output/no_multithreading.txt b/examples/all_features/test_output/no_multithreading.txt +index 1ebce1495..87fa818a7 100644 +--- a/examples/all_features/test_output/no_multithreading.txt ++++ b/examples/all_features/test_output/no_multithreading.txt +@@ -925,7 +925,7 @@ TEST CASE: without a funny name: + subcases.cpp(0): MESSAGE: Nooo + + =============================================================================== +-[doctest] test cases: 84 | 33 passed | 51 failed | +-[doctest] assertions: 230 | 110 passed | 120 failed | ++[doctest] test cases: 85 | 34 passed | 51 failed | ++[doctest] assertions: 233 | 113 passed | 120 failed | + [doctest] Status: FAILURE! + Program code. +diff --git a/examples/all_features/test_output/std_headers.txt b/examples/all_features/test_output/std_headers.txt +index 1ebce1495..87fa818a7 100644 +--- a/examples/all_features/test_output/std_headers.txt ++++ b/examples/all_features/test_output/std_headers.txt +@@ -925,7 +925,7 @@ TEST CASE: without a funny name: + subcases.cpp(0): MESSAGE: Nooo + + =============================================================================== +-[doctest] test cases: 84 | 33 passed | 51 failed | +-[doctest] assertions: 230 | 110 passed | 120 failed | ++[doctest] test cases: 85 | 34 passed | 51 failed | ++[doctest] assertions: 233 | 113 passed | 120 failed | + [doctest] Status: FAILURE! + Program code. +diff --git a/examples/all_features/test_output/stringification.cpp.txt b/examples/all_features/test_output/stringification.cpp.txt +index ba4a024da..7299f6c2b 100644 +--- a/examples/all_features/test_output/stringification.cpp.txt ++++ b/examples/all_features/test_output/stringification.cpp.txt +@@ -90,7 +90,7 @@ TEST CASE: a test case that registers an exception translator for int and then + stringification.cpp(0): ERROR: test case THREW exception: 5 + + =============================================================================== +-[doctest] test cases: 5 | 2 passed | 3 failed | +-[doctest] assertions: 22 | 9 passed | 13 failed | ++[doctest] test cases: 6 | 3 passed | 3 failed | ++[doctest] assertions: 25 | 12 passed | 13 failed | + [doctest] Status: FAILURE! + Program code. +diff --git a/examples/all_features/test_output/stringification.cpp_junit.txt b/examples/all_features/test_output/stringification.cpp_junit.txt +index dbfe572fe..772cc0c36 100644 +--- a/examples/all_features/test_output/stringification.cpp_junit.txt ++++ b/examples/all_features/test_output/stringification.cpp_junit.txt +@@ -1,6 +1,6 @@ + + +- ++ + + + +@@ -96,6 +96,7 @@ CHECK( "a" == doctest::Contains("aaa") ) is NOT correct! + 5 + + ++ + + + Program code. +diff --git a/examples/all_features/test_output/stringification.cpp_xml.txt b/examples/all_features/test_output/stringification.cpp_xml.txt +index ecec476fc..f5949ca02 100644 +--- a/examples/all_features/test_output/stringification.cpp_xml.txt ++++ b/examples/all_features/test_output/stringification.cpp_xml.txt +@@ -206,8 +206,11 @@ + + + ++ ++ ++ + +- +- ++ ++ + + Program code. + +From 0a00707df1a8d2fd0ec36605359b40a54a999ba7 Mon Sep 17 00:00:00 2001 +From: Salvage <29021710+Saalvage@users.noreply.github.com> +Date: Sat, 1 Oct 2022 18:43:02 +0200 +Subject: [PATCH 03/11] Increase standard compliance + +--- + doctest/doctest.h | 10 ++++++++-- + doctest/parts/doctest_fwd.h | 10 ++++++++-- + examples/all_features/stringification.cpp | 8 ++++++-- + 3 files changed, 22 insertions(+), 6 deletions(-) + +diff --git a/doctest/doctest.h b/doctest/doctest.h +index 28a58dbfb..c018d5b08 100644 +--- a/doctest/doctest.h ++++ b/doctest/doctest.h +@@ -1163,12 +1163,18 @@ DOCTEST_MSVC_SUPPRESS_WARNING_POP + + template + struct filldata { +-DOCTEST_MSVC_SUPPRESS_WARNING_WITH_PUSH(4180) + static void fill(std::ostream* stream, const T* in) { +-DOCTEST_MSVC_SUPPRESS_WARNING_POP + filldata::fill(stream, reinterpret_cast(in)); + } + }; ++ ++ template ++ struct filldata { ++ static void fill(std::ostream* stream, T(*in)(Args...)) { ++ if (in) { *stream << in; } ++ else { *stream << "nullptr"; } ++ } ++ }; + } + + struct DOCTEST_INTERFACE Approx +diff --git a/doctest/parts/doctest_fwd.h b/doctest/parts/doctest_fwd.h +index ff948678d..655158b8b 100644 +--- a/doctest/parts/doctest_fwd.h ++++ b/doctest/parts/doctest_fwd.h +@@ -1160,12 +1160,18 @@ DOCTEST_MSVC_SUPPRESS_WARNING_POP + + template + struct filldata { +-DOCTEST_MSVC_SUPPRESS_WARNING_WITH_PUSH(4180) + static void fill(std::ostream* stream, const T* in) { +-DOCTEST_MSVC_SUPPRESS_WARNING_POP + filldata::fill(stream, reinterpret_cast(in)); + } + }; ++ ++ template ++ struct filldata { ++ static void fill(std::ostream* stream, T(*in)(Args...)) { ++ if (in) { *stream << in; } ++ else { *stream << "nullptr"; } ++ } ++ }; + } + + struct DOCTEST_INTERFACE Approx +diff --git a/examples/all_features/stringification.cpp b/examples/all_features/stringification.cpp +index b59d657e5..1e68d3043 100644 +--- a/examples/all_features/stringification.cpp ++++ b/examples/all_features/stringification.cpp +@@ -250,13 +250,17 @@ TEST_CASE("a test case that registers an exception translator for int and then t + } + + static void function() { } ++static int*** function2() { return nullptr; } + + TEST_CASE("pointer comparisons") { +- auto a = new int(); +- auto b = a; ++ int i = 42; ++ int* a = &i; ++ int* b = a; ++ + CHECK(a == b); + CHECK_EQ(a, b); + + void (*functionPointer)() = &function; + CHECK(&function == functionPointer); ++ CHECK(&function2 == &function2); + } + +From eb4eda86f3c1efb8da1410ae141bab423ea2ef9f Mon Sep 17 00:00:00 2001 +From: Salvage <29021710+Saalvage@users.noreply.github.com> +Date: Sat, 1 Oct 2022 18:51:28 +0200 +Subject: [PATCH 04/11] Collect test output + +--- + examples/all_features/test_output/stringification.cpp.txt | 2 +- + .../all_features/test_output/stringification.cpp_junit.txt | 2 +- + examples/all_features/test_output/stringification.cpp_xml.txt | 4 ++-- + 3 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/examples/all_features/test_output/stringification.cpp.txt b/examples/all_features/test_output/stringification.cpp.txt +index 7299f6c2b..7bdc99a21 100644 +--- a/examples/all_features/test_output/stringification.cpp.txt ++++ b/examples/all_features/test_output/stringification.cpp.txt +@@ -91,6 +91,6 @@ stringification.cpp(0): ERROR: test case THREW exception: 5 + + =============================================================================== + [doctest] test cases: 6 | 3 passed | 3 failed | +-[doctest] assertions: 25 | 12 passed | 13 failed | ++[doctest] assertions: 26 | 13 passed | 13 failed | + [doctest] Status: FAILURE! + Program code. +diff --git a/examples/all_features/test_output/stringification.cpp_junit.txt b/examples/all_features/test_output/stringification.cpp_junit.txt +index 772cc0c36..696470eb9 100644 +--- a/examples/all_features/test_output/stringification.cpp_junit.txt ++++ b/examples/all_features/test_output/stringification.cpp_junit.txt +@@ -1,6 +1,6 @@ + + +- ++ + + + +diff --git a/examples/all_features/test_output/stringification.cpp_xml.txt b/examples/all_features/test_output/stringification.cpp_xml.txt +index f5949ca02..86a3b4d9f 100644 +--- a/examples/all_features/test_output/stringification.cpp_xml.txt ++++ b/examples/all_features/test_output/stringification.cpp_xml.txt +@@ -207,10 +207,10 @@ + + + +- ++ + + +- ++ + + + Program code. + +From f74987b0d276fb26f2ac9dc2b91d120d9e468586 Mon Sep 17 00:00:00 2001 +From: Salvage <29021710+Saalvage@users.noreply.github.com> +Date: Sat, 1 Oct 2022 18:52:00 +0200 +Subject: [PATCH 05/11] Collect test output + +--- + examples/all_features/test_output/no_multi_lane_atomics.txt | 2 +- + examples/all_features/test_output/no_multithreading.txt | 2 +- + examples/all_features/test_output/std_headers.txt | 2 +- + 3 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/examples/all_features/test_output/no_multi_lane_atomics.txt b/examples/all_features/test_output/no_multi_lane_atomics.txt +index 87fa818a7..6c78e50a9 100644 +--- a/examples/all_features/test_output/no_multi_lane_atomics.txt ++++ b/examples/all_features/test_output/no_multi_lane_atomics.txt +@@ -926,6 +926,6 @@ subcases.cpp(0): MESSAGE: Nooo + + =============================================================================== + [doctest] test cases: 85 | 34 passed | 51 failed | +-[doctest] assertions: 233 | 113 passed | 120 failed | ++[doctest] assertions: 234 | 114 passed | 120 failed | + [doctest] Status: FAILURE! + Program code. +diff --git a/examples/all_features/test_output/no_multithreading.txt b/examples/all_features/test_output/no_multithreading.txt +index 87fa818a7..6c78e50a9 100644 +--- a/examples/all_features/test_output/no_multithreading.txt ++++ b/examples/all_features/test_output/no_multithreading.txt +@@ -926,6 +926,6 @@ subcases.cpp(0): MESSAGE: Nooo + + =============================================================================== + [doctest] test cases: 85 | 34 passed | 51 failed | +-[doctest] assertions: 233 | 113 passed | 120 failed | ++[doctest] assertions: 234 | 114 passed | 120 failed | + [doctest] Status: FAILURE! + Program code. +diff --git a/examples/all_features/test_output/std_headers.txt b/examples/all_features/test_output/std_headers.txt +index 87fa818a7..6c78e50a9 100644 +--- a/examples/all_features/test_output/std_headers.txt ++++ b/examples/all_features/test_output/std_headers.txt +@@ -926,6 +926,6 @@ subcases.cpp(0): MESSAGE: Nooo + + =============================================================================== + [doctest] test cases: 85 | 34 passed | 51 failed | +-[doctest] assertions: 233 | 113 passed | 120 failed | ++[doctest] assertions: 234 | 114 passed | 120 failed | + [doctest] Status: FAILURE! + Program code. + +From e557751b19c8d598e3bb4f2b3f4cc0b33eef2cd6 Mon Sep 17 00:00:00 2001 +From: Salvage <29021710+Saalvage@users.noreply.github.com> +Date: Sat, 1 Oct 2022 20:19:20 +0200 +Subject: [PATCH 06/11] Fix warnings + +--- + doctest/doctest.h | 12 ++++-------- + doctest/parts/doctest_fwd.h | 12 ++++-------- + 2 files changed, 8 insertions(+), 16 deletions(-) + +diff --git a/doctest/doctest.h b/doctest/doctest.h +index c018d5b08..00a2ca745 100644 +--- a/doctest/doctest.h ++++ b/doctest/doctest.h +@@ -1163,16 +1163,12 @@ DOCTEST_MSVC_SUPPRESS_WARNING_POP + + template + struct filldata { ++DOCTEST_MSVC_SUPPRESS_WARNING_WITH_PUSH(4180) + static void fill(std::ostream* stream, const T* in) { ++DOCTEST_MSVC_SUPPRESS_WARNING_POP ++DOCTEST_CLANG_SUPPRESS_WARNING_WITH_PUSH("-Wmicrosoft-cast") + filldata::fill(stream, reinterpret_cast(in)); +- } +- }; +- +- template +- struct filldata { +- static void fill(std::ostream* stream, T(*in)(Args...)) { +- if (in) { *stream << in; } +- else { *stream << "nullptr"; } ++DOCTEST_CLANG_SUPPRESS_WARNING_POP + } + }; + } +diff --git a/doctest/parts/doctest_fwd.h b/doctest/parts/doctest_fwd.h +index 655158b8b..0e0690606 100644 +--- a/doctest/parts/doctest_fwd.h ++++ b/doctest/parts/doctest_fwd.h +@@ -1160,16 +1160,12 @@ DOCTEST_MSVC_SUPPRESS_WARNING_POP + + template + struct filldata { ++DOCTEST_MSVC_SUPPRESS_WARNING_WITH_PUSH(4180) + static void fill(std::ostream* stream, const T* in) { ++DOCTEST_MSVC_SUPPRESS_WARNING_POP ++DOCTEST_CLANG_SUPPRESS_WARNING_WITH_PUSH("-Wmicrosoft-cast") + filldata::fill(stream, reinterpret_cast(in)); +- } +- }; +- +- template +- struct filldata { +- static void fill(std::ostream* stream, T(*in)(Args...)) { +- if (in) { *stream << in; } +- else { *stream << "nullptr"; } ++DOCTEST_CLANG_SUPPRESS_WARNING_POP + } + }; + } + +From 1bf47132a732c875fb63b9e85717d7d765378407 Mon Sep 17 00:00:00 2001 +From: Salvage <29021710+Saalvage@users.noreply.github.com> +Date: Sat, 1 Oct 2022 20:29:08 +0200 +Subject: [PATCH 07/11] Add GCC workaround + +--- + doctest/parts/doctest_fwd.h | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/doctest/parts/doctest_fwd.h b/doctest/parts/doctest_fwd.h +index 0e0690606..c7bbd644c 100644 +--- a/doctest/parts/doctest_fwd.h ++++ b/doctest/parts/doctest_fwd.h +@@ -1164,6 +1164,9 @@ DOCTEST_MSVC_SUPPRESS_WARNING_WITH_PUSH(4180) + static void fill(std::ostream* stream, const T* in) { + DOCTEST_MSVC_SUPPRESS_WARNING_POP + DOCTEST_CLANG_SUPPRESS_WARNING_WITH_PUSH("-Wmicrosoft-cast") ++#if DOCTEST_GCC ++ __extension__ ++#endif + filldata::fill(stream, reinterpret_cast(in)); + DOCTEST_CLANG_SUPPRESS_WARNING_POP + } + +From ef13b2de9ea9c86c0743f6a20fc302a26379552f Mon Sep 17 00:00:00 2001 +From: Salvage <29021710+Saalvage@users.noreply.github.com> +Date: Sat, 1 Oct 2022 20:55:42 +0200 +Subject: [PATCH 08/11] Update doctest.h + +--- + doctest/doctest.h | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/doctest/doctest.h b/doctest/doctest.h +index 00a2ca745..313860b05 100644 +--- a/doctest/doctest.h ++++ b/doctest/doctest.h +@@ -1167,6 +1167,9 @@ DOCTEST_MSVC_SUPPRESS_WARNING_WITH_PUSH(4180) + static void fill(std::ostream* stream, const T* in) { + DOCTEST_MSVC_SUPPRESS_WARNING_POP + DOCTEST_CLANG_SUPPRESS_WARNING_WITH_PUSH("-Wmicrosoft-cast") ++#if DOCTEST_GCC ++ __extension__ ++#endif + filldata::fill(stream, reinterpret_cast(in)); + DOCTEST_CLANG_SUPPRESS_WARNING_POP + } + +From 9deb249cdadab89b6e969828944a53e4d46768d6 Mon Sep 17 00:00:00 2001 +From: Salvage <29021710+Saalvage@users.noreply.github.com> +Date: Sat, 1 Oct 2022 21:21:23 +0200 +Subject: [PATCH 09/11] Move __extension__ + +--- + doctest/doctest.h | 5 +++-- + doctest/parts/doctest_fwd.h | 5 +++-- + 2 files changed, 6 insertions(+), 4 deletions(-) + +diff --git a/doctest/doctest.h b/doctest/doctest.h +index 313860b05..09aaf2053 100644 +--- a/doctest/doctest.h ++++ b/doctest/doctest.h +@@ -1167,10 +1167,11 @@ DOCTEST_MSVC_SUPPRESS_WARNING_WITH_PUSH(4180) + static void fill(std::ostream* stream, const T* in) { + DOCTEST_MSVC_SUPPRESS_WARNING_POP + DOCTEST_CLANG_SUPPRESS_WARNING_WITH_PUSH("-Wmicrosoft-cast") ++ filldata::fill(stream, + #if DOCTEST_GCC +- __extension__ ++ __extension__ + #endif +- filldata::fill(stream, reinterpret_cast(in)); ++ reinterpret_cast(in)); + DOCTEST_CLANG_SUPPRESS_WARNING_POP + } + }; +diff --git a/doctest/parts/doctest_fwd.h b/doctest/parts/doctest_fwd.h +index c7bbd644c..59032dc58 100644 +--- a/doctest/parts/doctest_fwd.h ++++ b/doctest/parts/doctest_fwd.h +@@ -1164,10 +1164,11 @@ DOCTEST_MSVC_SUPPRESS_WARNING_WITH_PUSH(4180) + static void fill(std::ostream* stream, const T* in) { + DOCTEST_MSVC_SUPPRESS_WARNING_POP + DOCTEST_CLANG_SUPPRESS_WARNING_WITH_PUSH("-Wmicrosoft-cast") ++ filldata::fill(stream, + #if DOCTEST_GCC +- __extension__ ++ __extension__ + #endif +- filldata::fill(stream, reinterpret_cast(in)); ++ reinterpret_cast(in)); + DOCTEST_CLANG_SUPPRESS_WARNING_POP + } + }; + +From deba53defa90681ff0b41f65520b2445d2cbd8c7 Mon Sep 17 00:00:00 2001 +From: Salvage <29021710+Saalvage@users.noreply.github.com> +Date: Sat, 1 Oct 2022 22:57:53 +0200 +Subject: [PATCH 10/11] Use different workaround + +--- + doctest/doctest.h | 8 +++++--- + doctest/parts/doctest_fwd.h | 8 +++++--- + 2 files changed, 10 insertions(+), 6 deletions(-) + +diff --git a/doctest/doctest.h b/doctest/doctest.h +index 09aaf2053..5b500c9e2 100644 +--- a/doctest/doctest.h ++++ b/doctest/doctest.h +@@ -1168,10 +1168,12 @@ DOCTEST_MSVC_SUPPRESS_WARNING_WITH_PUSH(4180) + DOCTEST_MSVC_SUPPRESS_WARNING_POP + DOCTEST_CLANG_SUPPRESS_WARNING_WITH_PUSH("-Wmicrosoft-cast") + filldata::fill(stream, +-#if DOCTEST_GCC +- __extension__ ++#if DOCTEST_GCC == 0 || DOCTEST_GCC >= DOCTEST_COMPILER(4, 9, 0) ++ reinterpret_cast(in) ++#else ++ *reinterpret_cast(&in) + #endif +- reinterpret_cast(in)); ++ ); + DOCTEST_CLANG_SUPPRESS_WARNING_POP + } + }; +diff --git a/doctest/parts/doctest_fwd.h b/doctest/parts/doctest_fwd.h +index 59032dc58..09a53cb2c 100644 +--- a/doctest/parts/doctest_fwd.h ++++ b/doctest/parts/doctest_fwd.h +@@ -1165,10 +1165,12 @@ DOCTEST_MSVC_SUPPRESS_WARNING_WITH_PUSH(4180) + DOCTEST_MSVC_SUPPRESS_WARNING_POP + DOCTEST_CLANG_SUPPRESS_WARNING_WITH_PUSH("-Wmicrosoft-cast") + filldata::fill(stream, +-#if DOCTEST_GCC +- __extension__ ++#if DOCTEST_GCC == 0 || DOCTEST_GCC >= DOCTEST_COMPILER(4, 9, 0) ++ reinterpret_cast(in) ++#else ++ *reinterpret_cast(&in) + #endif +- reinterpret_cast(in)); ++ ); + DOCTEST_CLANG_SUPPRESS_WARNING_POP + } + }; + +From 02c6bed9b37bb8fbeedf98de730ba732fbe0c4d4 Mon Sep 17 00:00:00 2001 +From: Salvage <29021710+Saalvage@users.noreply.github.com> +Date: Sat, 1 Oct 2022 23:08:56 +0200 +Subject: [PATCH 11/11] Add missing const qualifier + +--- + doctest/doctest.h | 2 +- + doctest/parts/doctest_fwd.h | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/doctest/doctest.h b/doctest/doctest.h +index 5b500c9e2..c0c240425 100644 +--- a/doctest/doctest.h ++++ b/doctest/doctest.h +@@ -1171,7 +1171,7 @@ DOCTEST_CLANG_SUPPRESS_WARNING_WITH_PUSH("-Wmicrosoft-cast") + #if DOCTEST_GCC == 0 || DOCTEST_GCC >= DOCTEST_COMPILER(4, 9, 0) + reinterpret_cast(in) + #else +- *reinterpret_cast(&in) ++ *reinterpret_cast(&in) + #endif + ); + DOCTEST_CLANG_SUPPRESS_WARNING_POP +diff --git a/doctest/parts/doctest_fwd.h b/doctest/parts/doctest_fwd.h +index 09a53cb2c..4b2218763 100644 +--- a/doctest/parts/doctest_fwd.h ++++ b/doctest/parts/doctest_fwd.h +@@ -1168,7 +1168,7 @@ DOCTEST_CLANG_SUPPRESS_WARNING_WITH_PUSH("-Wmicrosoft-cast") + #if DOCTEST_GCC == 0 || DOCTEST_GCC >= DOCTEST_COMPILER(4, 9, 0) + reinterpret_cast(in) + #else +- *reinterpret_cast(&in) ++ *reinterpret_cast(&in) + #endif + ); + DOCTEST_CLANG_SUPPRESS_WARNING_POP diff --git a/doctest.spec b/doctest.spec index a75f53f..2e465ad 100644 --- a/doctest.spec +++ b/doctest.spec @@ -8,6 +8,8 @@ Summary: Feature-rich header-only C++ testing framework License: MIT URL: https://github.com/doctest/%{name} Source0: %{url}/archive/refs/tags/v%{version}.tar.gz +# https://github.com/doctest/doctest/pull/699 +Patch100: %{name}-pointers-compare-fix.patch BuildRequires: gcc-c++ BuildRequires: cmake3