Use <type_traits> unconditionally

Don't use or even mention tr1/type_traits any more.
This commit is contained in:
Vadim Zeitlin 2022-10-11 00:13:15 +02:00
parent 583a426a37
commit a0ae0cd316
10 changed files with 1 additions and 84 deletions

View file

@ -579,10 +579,6 @@ endif()
check_cxx_symbol_exists(round math.h HAVE_ROUND)
# Check includes
if(NOT MSVC_VERSION LESS 1600)
check_include_file_cxx(tr1/type_traits HAVE_TR1_TYPE_TRAITS)
check_include_file_cxx(type_traits HAVE_TYPE_TRAITS)
endif()
check_include_file(fcntl.h HAVE_FCNTL_H)
check_include_file(langinfo.h HAVE_LANGINFO_H)
check_include_file(sched.h HAVE_SCHED_H)

View file

@ -778,16 +778,6 @@
*/
#cmakedefine HAVE_TR1_UNORDERED_SET 1
/*
* Define if your compiler has <tr1/type_traits>
*/
#cmakedefine HAVE_TR1_TYPE_TRAITS 1
/*
* Define if your compiler has <type_traits>
*/
#cmakedefine HAVE_TYPE_TRAITS 1
/*
* Define if the compiler supports simple visibility declarations.
*/

2
configure vendored
View file

@ -24732,8 +24732,6 @@ $as_echo "#define HAVE_STD_UNORDERED_MAP 1" >>confdefs.h
$as_echo "#define HAVE_STD_UNORDERED_SET 1" >>confdefs.h
$as_echo "#define HAVE_TYPE_TRAITS 1" >>confdefs.h

View file

@ -1882,7 +1882,6 @@ fi
AC_DEFINE(HAVE_STD_UNORDERED_MAP)
AC_DEFINE(HAVE_STD_UNORDERED_SET)
AC_DEFINE(HAVE_TYPE_TRAITS)
dnl check for atomic operations builtins for wx/atomic.h:
WX_ATOMIC_BUILTINS

View file

@ -315,9 +315,6 @@ typedef short int WXTYPE;
/* for consistency with wxStatic/DynamicCast defined in wx/object.h */
#define wxConstCast(obj, className) const_cast<className *>(obj)
#ifndef HAVE_TYPE_TRAITS
#define HAVE_TYPE_TRAITS
#endif
#ifndef HAVE_STD_UNORDERED_MAP
#define HAVE_STD_UNORDERED_MAP
#endif

View file

@ -26,7 +26,6 @@
#if !defined(__has_include)
#define HAVE_TR1_UNORDERED_MAP 1
#define HAVE_TR1_UNORDERED_SET 1
#define HAVE_TR1_TYPE_TRAITS 1
#endif
#define HAVE_GCC_ATOMIC_BUILTINS 1
#endif

View file

@ -18,15 +18,7 @@
#include "wx/buffer.h"
#include "wx/unichar.h"
#if defined(HAVE_TYPE_TRAITS)
#include <type_traits>
#elif defined(HAVE_TR1_TYPE_TRAITS)
#ifdef __VISUALC__
#include <type_traits>
#else
#include <tr1/type_traits>
#endif
#endif
#include <type_traits>
class WXDLLIMPEXP_FWD_BASE wxCStrData;
class WXDLLIMPEXP_FWD_BASE wxString;
@ -342,8 +334,6 @@ struct wxFormatStringArgumentFinder<wxWCharBuffer>
#endif // wxDEBUG_LEVEL/!wxDEBUG_LEVEL
#if defined(HAVE_TYPE_TRAITS) || defined(HAVE_TR1_TYPE_TRAITS)
// Note: this type is misnamed, so that the error message is easier to
// understand (no error happens for enums, because the IsEnum=true case is
// specialized).
@ -359,33 +349,10 @@ struct wxFormatStringSpecifierNonPodType<true>
template<typename T>
struct wxFormatStringSpecifier
{
#ifdef HAVE_TYPE_TRAITS
typedef std::is_enum<T> is_enum;
#elif defined HAVE_TR1_TYPE_TRAITS
typedef std::tr1::is_enum<T> is_enum;
#endif
enum { value = wxFormatStringSpecifierNonPodType<is_enum::value>::value };
};
#else // !HAVE_(TR1_)TYPE_TRAITS
template<typename T>
struct wxFormatStringSpecifier
{
// We can't detect enums without is_enum, so the only thing we can
// do is to accept unknown types. However, the only acceptable unknown
// types still are enums, which are promoted to ints, so return Arg_Int
// here. This will at least catch passing of non-POD types through ... at
// runtime.
//
// Furthermore, if the compiler doesn't have partial template
// specialization, we didn't cover pointers either.
enum { value = wxFormatString::Arg_Int };
};
#endif // HAVE_TR1_TYPE_TRAITS/!HAVE_TR1_TYPE_TRAITS
template<typename T>
struct wxFormatStringSpecifier<T*>
{

View file

@ -778,16 +778,6 @@
*/
#undef HAVE_TR1_UNORDERED_SET
/*
* Define if your compiler has <tr1/type_traits>
*/
#undef HAVE_TR1_TYPE_TRAITS
/*
* Define if your compiler has <type_traits>
*/
#undef HAVE_TYPE_TRAITS
/*
* Define if the compiler supports simple visibility declarations.
*/

View file

@ -844,16 +844,6 @@ typedef pid_t GPid;
*/
#undef HAVE_TR1_UNORDERED_SET
/*
* Define if your compiler has <tr1/type_traits>
*/
#undef HAVE_TR1_TYPE_TRAITS
/*
* Define if your compiler has <type_traits>
*/
#undef HAVE_TYPE_TRAITS
/*
* Define if the compiler supports simple visibility declarations.
*/

View file

@ -243,15 +243,6 @@ TEST_CASE("ArgsValidation", "[wxString][vararg][error]")
WX_ASSERT_FAILS_WITH_ASSERT( wxString::Format("foo%n", ptr) );
WX_ASSERT_FAILS_WITH_ASSERT( wxString::Format("foo%i%n", 42, &swritten) );
// the following test (correctly) fails at compile-time with <type_traits>
#if !defined(HAVE_TYPE_TRAITS) && !defined(HAVE_TR1_TYPE_TRAITS)
wxObject obj;
WX_ASSERT_FAILS_WITH_ASSERT( wxString::Format("%s", obj) );
wxObject& ref = obj;
WX_ASSERT_FAILS_WITH_ASSERT( wxString::Format("%s", ref) );
#endif
// %c should accept integers too
wxString::Format("%c", 80);
wxString::Format("%c", wxChar(80) + wxChar(1));