Browse Source

parser-inc: Add some missing C++11/14/17/20 stdlib stubs

rdb 4 years ago
parent
commit
180a902978

+ 9 - 0
dtool/src/parser-inc/bit

@@ -0,0 +1,9 @@
+#pragma once
+
+namespace std {
+  enum class endian {
+    little,
+    big,
+    native,
+  };
+};

+ 11 - 0
dtool/src/parser-inc/condition_variable

@@ -0,0 +1,11 @@
+#pragma once
+
+namespace std {
+  class condition_variable;
+  class condition_variable_any;
+
+  enum class cv_status {
+    no_timeout,
+    timeout,
+  };
+}

+ 31 - 0
dtool/src/parser-inc/coroutine

@@ -0,0 +1,31 @@
+#pragma once
+
+namespace std {
+  template<class R, class... ArgTypes>
+  struct coroutine_traits;
+
+  template<class Promise = void>
+  struct coroutine_handle;
+
+  template<class T> struct hash;
+  template<class P> struct hash<coroutine_handle<P>>;
+
+  struct noop_coroutine_promise;
+
+  template<> struct coroutine_handle<noop_coroutine_promise>;
+  using noop_coroutine_handle = coroutine_handle<noop_coroutine_promise>;
+
+  noop_coroutine_handle noop_coroutine() noexcept;
+
+  struct suspend_never {
+    constexpr bool await_ready() const noexcept { return true; }
+    constexpr void await_suspend(coroutine_handle<>) const noexcept {}
+    constexpr void await_resume() const noexcept {}
+  };
+
+  struct suspend_always {
+    constexpr bool await_ready() const noexcept { return false; }
+    constexpr void await_suspend(coroutine_handle<>) const noexcept {}
+    constexpr void await_resume() const noexcept {}
+  };
+}

+ 9 - 0
dtool/src/parser-inc/forward_list

@@ -0,0 +1,9 @@
+#pragma once
+
+#include <compare>
+#include <initializer_list>
+
+namespace std {
+  template<class T> struct allocator;
+  template<class T, class Allocator = allocator<T>> class forward_list;
+}

+ 27 - 0
dtool/src/parser-inc/future

@@ -0,0 +1,27 @@
+#pragma once
+
+namespace std {
+  enum class future_status {
+    ready,
+    timeout,
+    deferred
+  };
+
+  class future_error;
+
+  template<class R> class promise;
+  template<class R> class promise<R&>;
+  template<> class promise<void>;
+
+  template<class R> class future;
+  template<class R> class future<R&>;
+  template<> class future<void>;
+
+  template<class R> class shared_future;
+  template<class R> class shared_future<R&>;
+  template<> class shared_future<void>;
+
+  template<class> class packaged_task;
+  template<class R, class... ArgTypes>
+    class packaged_task<R(ArgTypes...)>;
+}

+ 1 - 0
dtool/src/parser-inc/mutex

@@ -22,6 +22,7 @@ namespace std {
   inline constexpr adopt_lock_t adopt_lock {};
 
   template<class Mutex> class lock_guard;
+  template<class... MutexTypes> class scoped_lock;
   template<class Mutex> class unique_lock;
 
   struct once_flag;

+ 10 - 0
dtool/src/parser-inc/new

@@ -1,5 +1,7 @@
 #pragma once
 
+#include <stdtypedefs.h>
+
 namespace std {
   class bad_alloc;
   class bad_array_new_length;
@@ -10,4 +12,12 @@ namespace std {
   extern const nothrow_t nothrow;
 
   using new_handler = void (*)();
+
+  inline constexpr size_t hardware_destructive_interference_size;
+  inline constexpr size_t hardware_constructive_interference_size;
+
+  struct destroying_delete_t {
+    explicit destroying_delete_t() = default;
+  };
+  inline constexpr destroying_delete_t destroying_delete {};
 }

+ 7 - 0
dtool/src/parser-inc/shared_mutex

@@ -0,0 +1,7 @@
+#pragma once
+
+namespace std {
+  class shared_mutex;
+  class shared_timed_mutex;
+  template<class Mutex> class shared_lock;
+}

+ 21 - 0
dtool/src/parser-inc/thread

@@ -0,0 +1,21 @@
+#pragma once
+
+#include <compare>
+
+namespace std {
+  class thread {
+  public:
+    class id;
+  };
+
+  class jthread {
+  public:
+    using id = thread::id;
+  };
+
+  template<class T> struct hash;
+  template<> struct hash<thread::id>;
+
+  namespace this_thread {
+  }
+}

+ 19 - 0
dtool/src/parser-inc/type_traits

@@ -14,6 +14,9 @@ namespace std {
   typedef integral_constant<bool, true> true_type;
   typedef integral_constant<bool, false> false_type;
 
+  template<bool B>
+  using bool_constant = integral_constant<bool, B>;
+
   template<class T, class U>
   struct is_same : std::false_type {};
 
@@ -86,6 +89,9 @@ namespace std {
   template<class T, class U>
   struct is_convertible : integral_constant<bool, __is_convertible_to(T, U)> {};
 
+  template<class T>
+  struct is_aggregate;
+
   template<class T> struct add_cv { typedef const volatile T type; };
   template<class T> struct add_const { typedef const T type; };
   template<class T> struct add_volatile { typedef volatile T type; };
@@ -93,4 +99,17 @@ namespace std {
   template<class T> struct add_lvalue_reference { typedef T &type; };
   template<class T> struct add_rvalue_reference { typedef T &&type; };
   template<class T> struct add_pointer { typedef T *type; };
+
+  constexpr bool is_constant_evaluated() noexcept;
+
+  template<class T>
+  struct type_identity {
+    using type = T;
+  };
+
+  template<class T>
+  using type_identity_t = typename type_identity<T>::type;
+
+  template<class...>
+  using void_t = void;
 }