From bfaf253f094896c448291f67d5dfd7465602b036 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Mon, 31 Aug 2026 14:20:37 +0000 Subject: [PATCH] Guard the disabled tests with a macro rather than #if 0 Clang-Tidy's readability-avoid-unconditional-preprocessor-if rejects a literal #if 0. Use a macro that is never defined instead, which the check does not look at. Still temporary, and reverted together with the previous commit. Signed-off-by: Niels Lohmann --- tests/src/unit-custom-array-type.cpp | 5 +++-- tests/src/unit-custom-binary-type.cpp | 5 +++-- tests/src/unit-custom-object-type.cpp | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/tests/src/unit-custom-array-type.cpp b/tests/src/unit-custom-array-type.cpp index be25469b0..f10455f15 100644 --- a/tests/src/unit-custom-array-type.cpp +++ b/tests/src/unit-custom-array-type.cpp @@ -19,8 +19,9 @@ // TEMPORARY: this translation unit is disabled to narrow down an AppVeyor // failure on MSVC 2015/2017 whose build log this environment cannot reach. -// The guard is removed again as soon as the cause is known. -#if 0 +// The macro is deliberately never defined; the guard is removed again as soon +// as the cause is known. +#ifdef JSON_BISECT_CUSTOM_CONTAINER_TESTS namespace { diff --git a/tests/src/unit-custom-binary-type.cpp b/tests/src/unit-custom-binary-type.cpp index e7191b296..b7718a769 100644 --- a/tests/src/unit-custom-binary-type.cpp +++ b/tests/src/unit-custom-binary-type.cpp @@ -23,8 +23,9 @@ // TEMPORARY: this translation unit is disabled to narrow down an AppVeyor // failure on MSVC 2015/2017 whose build log this environment cannot reach. -// The guard is removed again as soon as the cause is known. -#if 0 +// The macro is deliberately never defined; the guard is removed again as soon +// as the cause is known. +#ifdef JSON_BISECT_CUSTOM_CONTAINER_TESTS namespace { diff --git a/tests/src/unit-custom-object-type.cpp b/tests/src/unit-custom-object-type.cpp index 5bf12797f..ef1abface 100644 --- a/tests/src/unit-custom-object-type.cpp +++ b/tests/src/unit-custom-object-type.cpp @@ -19,8 +19,9 @@ // TEMPORARY: this translation unit is disabled to narrow down an AppVeyor // failure on MSVC 2015/2017 whose build log this environment cannot reach. -// The guard is removed again as soon as the cause is known. -#if 0 +// The macro is deliberately never defined; the guard is removed again as soon +// as the cause is known. +#ifdef JSON_BISECT_CUSTOM_CONTAINER_TESTS namespace {