Bug 1277372 - Remove unused "mozilla/TypeTraits.h" r=sergesanspaille

Differential Revision: https://phabricator.services.mozilla.com/D174129
This commit is contained in:
Andi-Bogdan Postelnicu 2023-04-17 13:50:11 +00:00
parent bf2bb59367
commit 79e171fd9f
8 changed files with 0 additions and 162 deletions

View File

@ -624,10 +624,6 @@ Miscellaneous
- xpcom/ds/TimeStamp.h
- ``std::chrono::time_point``
-
* -
- mozilla/TypeTraits.h
- ``<type_traits>``
-
* -
- mozilla/PodOperations.h
-

View File

@ -4,8 +4,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* Helpers to manipulate function types that don't fit in TypeTraits.h */
#ifndef mozilla_FunctionTypeTraits_h
#define mozilla_FunctionTypeTraits_h

View File

@ -4,8 +4,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* Helpers to manipulate integer types that don't fit in TypeTraits.h */
#ifndef mozilla_IntegerTypeTraits_h
#define mozilla_IntegerTypeTraits_h

View File

@ -1,107 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* Template-based metaprogramming and type-testing facilities. */
#ifndef mozilla_TypeTraits_h
#define mozilla_TypeTraits_h
#include "mozilla/Types.h"
#include <type_traits>
#include <utility>
/*
* These traits are approximate copies of the traits and semantics from C++11's
* <type_traits> header. Don't add traits not in that header! When all
* platforms provide that header, we can convert all users and remove this one.
*/
namespace mozilla {
/* 20.9.4 Unary type traits [meta.unary] */
/* 20.9.4.3 Type properties [meta.unary.prop] */
/**
* Traits class for identifying POD types. Until C++11 there's no automatic
* way to detect PODs, so for the moment this is done manually. Users may
* define specializations of this class that inherit from std::true_type and
* std::false_type (or equivalently std::integral_constant<bool, true or
* false>, or conveniently from mozilla::IsPod for composite types) as needed to
* ensure correct IsPod behavior.
*/
template <typename T>
struct IsPod : public std::false_type {};
template <>
struct IsPod<char> : std::true_type {};
template <>
struct IsPod<signed char> : std::true_type {};
template <>
struct IsPod<unsigned char> : std::true_type {};
template <>
struct IsPod<short> : std::true_type {};
template <>
struct IsPod<unsigned short> : std::true_type {};
template <>
struct IsPod<int> : std::true_type {};
template <>
struct IsPod<unsigned int> : std::true_type {};
template <>
struct IsPod<long> : std::true_type {};
template <>
struct IsPod<unsigned long> : std::true_type {};
template <>
struct IsPod<long long> : std::true_type {};
template <>
struct IsPod<unsigned long long> : std::true_type {};
template <>
struct IsPod<bool> : std::true_type {};
template <>
struct IsPod<float> : std::true_type {};
template <>
struct IsPod<double> : std::true_type {};
template <>
struct IsPod<wchar_t> : std::true_type {};
template <>
struct IsPod<char16_t> : std::true_type {};
template <typename T>
struct IsPod<T*> : std::true_type {};
namespace detail {
struct DoIsDestructibleImpl {
template <typename T, typename = decltype(std::declval<T&>().~T())>
static std::true_type test(int);
template <typename T>
static std::false_type test(...);
};
template <typename T>
struct IsDestructibleImpl : public DoIsDestructibleImpl {
typedef decltype(test<T>(0)) Type;
};
} // namespace detail
/**
* IsDestructible determines whether a type has a public destructor.
*
* struct S0 {}; // Implicit default destructor.
* struct S1 { ~S1(); };
* class C2 { ~C2(); }; // private destructor.
*
* mozilla::IsDestructible<S0>::value is true;
* mozilla::IsDestructible<S1>::value is true;
* mozilla::IsDestructible<C2>::value is false.
*/
template <typename T>
struct IsDestructible : public detail::IsDestructibleImpl<T>::Type {};
} /* namespace mozilla */
#endif /* mozilla_TypeTraits_h */

View File

@ -115,7 +115,6 @@ EXPORTS.mozilla = [
"ToString.h",
"TypedEnumBits.h",
"Types.h",
"TypeTraits.h",
"UniquePtr.h",
"UniquePtrExtensions.h",
"Unused.h",

View File

@ -1,44 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include <type_traits>
#include "mozilla/TypeTraits.h"
using mozilla::IsDestructible;
class PublicDestructible {
public:
~PublicDestructible();
};
class PrivateDestructible {
private:
~PrivateDestructible();
};
class TrivialDestructible {};
static_assert(IsDestructible<PublicDestructible>::value,
"public destructible class is destructible");
static_assert(!IsDestructible<PrivateDestructible>::value,
"private destructible class is not destructible");
static_assert(IsDestructible<TrivialDestructible>::value,
"trivial destructible class is destructible");
/*
* Android's broken [u]intptr_t inttype macros are broken because its PRI*PTR
* macros are defined as "ld", but sizeof(long) is 8 and sizeof(intptr_t)
* is 4 on 32-bit Android. We redefine Android's PRI*PTR macros in
* IntegerPrintfMacros.h and assert here that our new definitions match the
* actual type sizes seen at compile time.
*/
#if defined(ANDROID) && !defined(__LP64__)
static_assert(std::is_same_v<int, intptr_t>,
"emulated PRI[di]PTR definitions will be wrong");
static_assert(std::is_same_v<unsigned int, uintptr_t>,
"emulated PRI[ouxX]PTR definitions will be wrong");
#endif
int main() { return 0; }

View File

@ -63,7 +63,6 @@ CppUnitTests(
"TestTemplateLib",
"TestTextUtils",
"TestTypedEnum",
"TestTypeTraits",
"TestUniquePtr",
"TestVariant",
"TestVector",

View File

@ -85,7 +85,6 @@ skip-if = os != 'win'
[TestTemplateLib]
[TestTextUtils]
[TestThreadSafeWeakPtr]
[TestTypeTraits]
[TestTypedEnum]
[TestUniquePtr]
[TestUtf8]