diff options
| author | Martin Hořeňovský | 2020-12-28 20:29:05 +0100 |
|---|---|---|
| committer | Martin Hořeňovský | 2020-12-28 20:51:49 +0100 |
| commit | 1d269211bd603d4a50c44b741617db754b790e23 (patch) | |
| tree | 6cad64fdc1bc4d944ea9aa09d5b55db1b07ea692 /src/catch2/internal | |
| parent | 0acb371b9200140ed958d60b86cbb95663ee93bd (diff) | |
| download | catch3-1d269211bd603d4a50c44b741617db754b790e23.tar.gz | |
Split CATCH_CONFIG_WCHAR into its own header
Part of #2041
Diffstat (limited to 'src/catch2/internal')
| -rw-r--r-- | src/catch2/internal/catch_compiler_capabilities.hpp | 9 | ||||
| -rw-r--r-- | src/catch2/internal/catch_config_wchar.hpp | 33 | ||||
| -rw-r--r-- | src/catch2/internal/catch_main.cpp | 1 |
3 files changed, 34 insertions, 9 deletions
diff --git a/src/catch2/internal/catch_compiler_capabilities.hpp b/src/catch2/internal/catch_compiler_capabilities.hpp index e8de815b..b98921ae 100644 --- a/src/catch2/internal/catch_compiler_capabilities.hpp +++ b/src/catch2/internal/catch_compiler_capabilities.hpp @@ -186,11 +186,6 @@ # define CATCH_INTERNAL_CONFIG_EXCEPTIONS_ENABLED #endif -//////////////////////////////////////////////////////////////////////////////// -// DJGPP -#ifdef __DJGPP__ -# define CATCH_INTERNAL_CONFIG_NO_WCHAR -#endif // __DJGPP__ //////////////////////////////////////////////////////////////////////////////// // Embarcadero C++Build @@ -273,10 +268,6 @@ #if defined(CATCH_INTERNAL_CONFIG_POSIX_SIGNALS) && !defined(CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS) && !defined(CATCH_CONFIG_NO_POSIX_SIGNALS) && !defined(CATCH_CONFIG_POSIX_SIGNALS) # define CATCH_CONFIG_POSIX_SIGNALS #endif -// This is set by default, because we assume that compilers with no wchar_t support are just rare exceptions. -#if !defined(CATCH_INTERNAL_CONFIG_NO_WCHAR) && !defined(CATCH_CONFIG_NO_WCHAR) && !defined(CATCH_CONFIG_WCHAR) -# define CATCH_CONFIG_WCHAR -#endif #if !defined(CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING) && !defined(CATCH_CONFIG_NO_CPP11_TO_STRING) && !defined(CATCH_CONFIG_CPP11_TO_STRING) # define CATCH_CONFIG_CPP11_TO_STRING diff --git a/src/catch2/internal/catch_config_wchar.hpp b/src/catch2/internal/catch_config_wchar.hpp new file mode 100644 index 00000000..fb64daf2 --- /dev/null +++ b/src/catch2/internal/catch_config_wchar.hpp @@ -0,0 +1,33 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 + +/** \file + * Wrapper for the WCHAR configuration option + * + * We want to support platforms that do not provide `wchar_t`, so we + * sometimes have to disable providing wchar_t overloads through Catch2, + * e.g. the StringMaker specialization for `std::wstring`. + */ + +#ifndef CATCH_CONFIG_WCHAR_HPP_INCLUDED +#define CATCH_CONFIG_WCHAR_HPP_INCLUDED + +// We assume that WCHAR should be enabled by default, and only disabled +// for a shortlist (so far only DJGPP) of compilers. + +#if defined(__DJGPP__) +# define CATCH_INTERNAL_CONFIG_NO_WCHAR +#endif // __DJGPP__ + +#if !defined( CATCH_INTERNAL_CONFIG_NO_WCHAR ) && \ + !defined( CATCH_CONFIG_NO_WCHAR ) && \ + !defined( CATCH_CONFIG_WCHAR ) +# define CATCH_CONFIG_WCHAR +#endif + +#endif // CATCH_CONFIG_WCHAR_HPP_INCLUDED diff --git a/src/catch2/internal/catch_main.cpp b/src/catch2/internal/catch_main.cpp index b80bae0b..940ac3bc 100644 --- a/src/catch2/internal/catch_main.cpp +++ b/src/catch2/internal/catch_main.cpp @@ -7,6 +7,7 @@ // SPDX-License-Identifier: BSL-1.0 #include <catch2/catch_session.hpp> #include <catch2/internal/catch_compiler_capabilities.hpp> +#include <catch2/internal/catch_config_wchar.hpp> #include <catch2/internal/catch_leak_detector.hpp> #include <catch2/internal/catch_platform.hpp> |