Skip to content

Commit 3c78ca0

Browse files
author
Howard Hinnant
committed
Partial Windows port by Ruben Van Boxem
llvm-svn: 140328
1 parent f9b785f commit 3c78ca0

File tree

10 files changed

+433
-5
lines changed

10 files changed

+433
-5
lines changed

libcxx/CREDITS.TXT

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,7 @@ D: Initial regex prototype
2424
N: David Chisnall
2525
E: theraven at theravensnest dot org
2626
D: FreeBSD port and libcxxrt support.
27+
28+
N: Ruben Van Boxem
29+
E: vanboxem dot ruben at gmail dot com
30+
D: Initial Windows patches.

libcxx/include/__config

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@
5050
#ifdef _WIN32
5151
# define _LIBCPP_LITTLE_ENDIAN 1
5252
# define _LIBCPP_BIG_ENDIAN 0
53+
// Compiler intrinsics (GCC or MSVC)
54+
# if (defined(_MSC_VER) && _MSC_VER >= 1400) || (__GNUC__ >= 4 && __GNUC_MINOR__ > 3)
55+
# define _LIBCP_HAS_IS_BASE_OF
56+
# endif
5357
#endif // _WIN32
5458

5559
#if !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
@@ -164,6 +168,10 @@ typedef __char32_t char32_t;
164168
#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
165169
#endif
166170

171+
#if __has_feature(is_base_of)
172+
# define _LIBCP_HAS_IS_BASE_OF
173+
#endif
174+
167175
// Objective-C++ features (opt-in)
168176
#if __has_feature(objc_arc)
169177
#define _LIBCPP_HAS_OBJC_ARC

libcxx/include/__locale

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@
1919
#include <cstdint>
2020
#include <cctype>
2121
#include <locale.h>
22-
#include <xlocale.h>
22+
#if _WIN32
23+
# include <support/win32/locale.h>
24+
#else // _WIN32
25+
# include <xlocale.h>
26+
#endif // _WIN32
2327

2428
#pragma GCC system_header
2529

@@ -314,7 +318,19 @@ public:
314318
static const mask punct = _ISpunct;
315319
static const mask xdigit = _ISxdigit;
316320
static const mask blank = _ISblank;
317-
#else // __GLIBC__
321+
#elif _WIN32
322+
typedef unsigned __int32 mask;
323+
static const mask space = _SPACE;
324+
static const mask print = _BLANK|_PUNCT|_ALPHA|_DIGIT;
325+
static const mask cntrl = _CONTROL;
326+
static const mask upper = _UPPER;
327+
static const mask lower = _LOWER;
328+
static const mask alpha = _ALPHA;
329+
static const mask digit = _DIGIT;
330+
static const mask punct = _PUNCT;
331+
static const mask xdigit = _HEX;
332+
static const mask blank = _BLANK;
333+
#else // __GLIBC__ || _WIN32
318334
#if __APPLE__
319335
typedef __uint32_t mask;
320336
#elif __FreeBSD__
@@ -330,7 +346,7 @@ public:
330346
static const mask punct = _CTYPE_P;
331347
static const mask xdigit = _CTYPE_X;
332348
static const mask blank = _CTYPE_B;
333-
#endif // __GLIBC__
349+
#endif // __GLIBC__ || _WIN32
334350
static const mask alnum = alpha | digit;
335351
static const mask graph = alnum | punct;
336352

libcxx/include/cerrno

Lines changed: 316 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,320 @@ const int __elast2 = 105;
7272

7373
#endif // !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
7474

75+
// supply errno values likely to be missing, particularly on Windows
76+
77+
#ifndef EAFNOSUPPORT
78+
#define EAFNOSUPPORT 9901
79+
#endif
80+
81+
#ifndef EADDRINUSE
82+
#define EADDRINUSE 9902
83+
#endif
84+
85+
#ifndef EADDRNOTAVAIL
86+
#define EADDRNOTAVAIL 9903
87+
#endif
88+
89+
#ifndef EISCONN
90+
#define EISCONN 9904
91+
#endif
92+
93+
#ifndef EBADMSG
94+
#define EBADMSG 9905
95+
#endif
96+
97+
#ifndef ECONNABORTED
98+
#define ECONNABORTED 9906
99+
#endif
100+
101+
#ifndef EALREADY
102+
#define EALREADY 9907
103+
#endif
104+
105+
#ifndef ECONNREFUSED
106+
#define ECONNREFUSED 9908
107+
#endif
108+
109+
#ifndef ECONNRESET
110+
#define ECONNRESET 9909
111+
#endif
112+
113+
#ifndef EDESTADDRREQ
114+
#define EDESTADDRREQ 9910
115+
#endif
116+
117+
#ifndef EHOSTUNREACH
118+
#define EHOSTUNREACH 9911
119+
#endif
120+
121+
#ifndef EIDRM
122+
#define EIDRM 9912
123+
#endif
124+
125+
#ifndef EMSGSIZE
126+
#define EMSGSIZE 9913
127+
#endif
128+
129+
#ifndef ENETDOWN
130+
#define ENETDOWN 9914
131+
#endif
132+
133+
#ifndef ENETRESET
134+
#define ENETRESET 9915
135+
#endif
136+
137+
#ifndef ENETUNREACH
138+
#define ENETUNREACH 9916
139+
#endif
140+
141+
#ifndef ENOBUFS
142+
#define ENOBUFS 9917
143+
#endif
144+
145+
#ifndef ENOLINK
146+
#define ENOLINK 9918
147+
#endif
148+
149+
#ifndef ENODATA
150+
#define ENODATA 9919
151+
#endif
152+
153+
#ifndef ENOMSG
154+
#define ENOMSG 9920
155+
#endif
156+
157+
#ifndef ENOPROTOOPT
158+
#define ENOPROTOOPT 9921
159+
#endif
160+
161+
#ifndef ENOSR
162+
#define ENOSR 9922
163+
#endif
164+
165+
#ifndef ENOTSOCK
166+
#define ENOTSOCK 9923
167+
#endif
168+
169+
#ifndef ENOSTR
170+
#define ENOSTR 9924
171+
#endif
172+
173+
#ifndef ENOTCONN
174+
#define ENOTCONN 9925
175+
#endif
176+
177+
#ifndef ENOTSUP
178+
#define ENOTSUP 9926
179+
#endif
180+
181+
#ifndef ECANCELED
182+
#define ECANCELED 9927
183+
#endif
184+
185+
#ifndef EINPROGRESS
186+
#define EINPROGRESS 9928
187+
#endif
188+
189+
#ifndef EOPNOTSUPP
190+
#define EOPNOTSUPP 9929
191+
#endif
192+
193+
#ifndef EWOULDBLOCK
194+
#define EWOULDBLOCK 9930
195+
#endif
196+
197+
#ifndef EOWNERDEAD
198+
#define EOWNERDEAD 9931
199+
#endif
200+
201+
#ifndef EPROTO
202+
#define EPROTO 9932
203+
#endif
204+
205+
#ifndef EPROTONOSUPPORT
206+
#define EPROTONOSUPPORT 9933
207+
#endif
208+
209+
#ifndef ENOTRECOVERABLE
210+
#define ENOTRECOVERABLE 9934
211+
#endif
212+
213+
#ifndef ETIME
214+
#define ETIME 9935
215+
#endif
216+
217+
#ifndef ETXTBSY
218+
#define ETXTBSY 9936
219+
#endif
220+
221+
#ifndef ETIMEDOUT
222+
#define ETIMEDOUT 9938
223+
#endif
224+
225+
#ifndef ELOOP
226+
#define ELOOP 9939
227+
#endif
228+
229+
#ifndef EOVERFLOW
230+
#define EOVERFLOW 9940
231+
#endif
232+
233+
#ifndef EPROTOTYPE
234+
#define EPROTOTYPE 9941
235+
#endif
236+
237+
#ifndef ENOSYS
238+
#define ENOSYS 9942
239+
#endif
240+
241+
#ifndef EINVAL
242+
#define EINVAL 9943
243+
#endif
244+
245+
#ifndef ERANGE
246+
#define ERANGE 9944
247+
#endif
248+
249+
#ifndef EILSEQ
250+
#define EILSEQ 9945
251+
#endif
252+
253+
// Windows Mobile doesn't appear to define these:
254+
255+
#ifndef E2BIG
256+
#define E2BIG 9946
257+
#endif
258+
259+
#ifndef EDOM
260+
#define EDOM 9947
261+
#endif
262+
263+
#ifndef EFAULT
264+
#define EFAULT 9948
265+
#endif
266+
267+
#ifndef EBADF
268+
#define EBADF 9949
269+
#endif
270+
271+
#ifndef EPIPE
272+
#define EPIPE 9950
273+
#endif
274+
275+
#ifndef EXDEV
276+
#define EXDEV 9951
277+
#endif
278+
279+
#ifndef EBUSY
280+
#define EBUSY 9952
281+
#endif
282+
283+
#ifndef ENOTEMPTY
284+
#define ENOTEMPTY 9953
285+
#endif
286+
287+
#ifndef ENOEXEC
288+
#define ENOEXEC 9954
289+
#endif
290+
291+
#ifndef EEXIST
292+
#define EEXIST 9955
293+
#endif
294+
295+
#ifndef EFBIG
296+
#define EFBIG 9956
297+
#endif
298+
299+
#ifndef ENAMETOOLONG
300+
#define ENAMETOOLONG 9957
301+
#endif
302+
303+
#ifndef ENOTTY
304+
#define ENOTTY 9958
305+
#endif
306+
307+
#ifndef EINTR
308+
#define EINTR 9959
309+
#endif
310+
311+
#ifndef ESPIPE
312+
#define ESPIPE 9960
313+
#endif
314+
315+
#ifndef EIO
316+
#define EIO 9961
317+
#endif
318+
319+
#ifndef EISDIR
320+
#define EISDIR 9962
321+
#endif
322+
323+
#ifndef ECHILD
324+
#define ECHILD 9963
325+
#endif
326+
327+
#ifndef ENOLCK
328+
#define ENOLCK 9964
329+
#endif
330+
331+
#ifndef ENOSPC
332+
#define ENOSPC 9965
333+
#endif
334+
335+
#ifndef ENXIO
336+
#define ENXIO 9966
337+
#endif
338+
339+
#ifndef ENODEV
340+
#define ENODEV 9967
341+
#endif
342+
343+
#ifndef ENOENT
344+
#define ENOENT 9968
345+
#endif
346+
347+
#ifndef ESRCH
348+
#define ESRCH 9969
349+
#endif
350+
351+
#ifndef ENOTDIR
352+
#define ENOTDIR 9970
353+
#endif
354+
355+
#ifndef ENOMEM
356+
#define ENOMEM 9971
357+
#endif
358+
359+
#ifndef EPERM
360+
#define EPERM 9972
361+
#endif
362+
363+
#ifndef EACCES
364+
#define EACCES 9973
365+
#endif
366+
367+
#ifndef EROFS
368+
#define EROFS 9974
369+
#endif
370+
371+
#ifndef EDEADLK
372+
#define EDEADLK 9975
373+
#endif
374+
375+
#ifndef EAGAIN
376+
#define EAGAIN 9976
377+
#endif
378+
379+
#ifndef ENFILE
380+
#define ENFILE 9977
381+
#endif
382+
383+
#ifndef EMFILE
384+
#define EMFILE 9978
385+
#endif
386+
387+
#ifndef EMLINK
388+
#define EMLINK 9979
389+
#endif
390+
75391
#endif // _LIBCPP_CERRNO

0 commit comments

Comments
 (0)