aboutsummaryrefslogtreecommitdiff
path: root/libstd-modules/std-core.mxx
blob: d723320c8ca5fd2f8ac9487a78ad7a5c6f064d25 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
// file      : libstd-modules/std-core.mxx -*- C++ -*-
// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
// license   : MIT; see accompanying LICENSE file

// For some standard library implementations we need to pre-include certain
// headers to prevent their exporting.

#include <libstd-modules/std-detect.hxx>

#if   defined(_MSC_VER)
/*
#  include <io.h>
#  include <time.h>
#  include <stdlib.h>
#  include <string.h>
#  include <locale.h> // struct tm;
*/
#elif defined(__GLIBCXX__)
#  include <time.h>
#  include <errno.h>
#  include <wchar.h>          // struct tm forward declaration.
#  include <stdio.h>
#  include <stdlib.h>
#  include <string.h>
#  include <strings.h>
#  include <sys/types.h>
#  include <ext/atomicity.h>  // Names with internal linkage.
#elif defined(_LIBCPP_VERSION)
#endif

export module std.core;

export
{
  // These are defined in <bits/c++config.h> which we have pre-included.
  //
#ifdef __GLIBCXX__
  namespace std
  {
    typedef __SIZE_TYPE__         size_t;
    typedef __PTRDIFF_TYPE__      ptrdiff_t;
    typedef decltype(nullptr)     nullptr_t;
  }
#endif

#include <cstddef>
#include <cstdint>
#include <cstdlib>

#include <utility>
#include <type_traits>

#include <exception>
#include <stdexcept>
#include <system_error>

#include <new>
#include <memory>

#include <limits>
#include <ctime>
#include <atomic>
#include <chrono>
#include <bitset>
}

export
{
#include <iterator>
#include <algorithm>
#include <functional>

#include <string>
#include <cstring> // @@ Not in the proposal.

#include <array>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <stack>
}

#if defined(_MSC_VER) || defined(__clang__)
export
{
#include <cctype>
#include <locale>
#include <clocale>

#include <iosfwd>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <fstream>

#ifndef __GLIBCXX__
#  include <iostream>
#else
// Contents of <iostream> without static __ioinit.
//
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
  extern istream cin;
  extern ostream cout;
  extern ostream cerr;
  extern ostream clog;

  static inline ios_base::Init __ioinit;
_GLIBCXX_END_NAMESPACE_VERSION
}
#endif
}
#endif

// std.threading
//
export
{
#include <mutex>
#include <shared_mutex>
#include <condition_variable>
#include <thread>
}