]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/d/dmd/root/dcompat.h
d: Merge upstream dmd 48d704f08
[thirdparty/gcc.git] / gcc / d / dmd / root / dcompat.h
1
2 /* Copyright (C) 1999-2020 by The D Language Foundation, All Rights Reserved
3 * written by Walter Bright
4 * http://www.digitalmars.com
5 * Distributed under the Boost Software License, Version 1.0.
6 * http://www.boost.org/LICENSE_1_0.txt
7 * https://github.com/dlang/dmd/blob/master/src/dmd/root/dcompat.h
8 */
9
10 #pragma once
11
12 #include "dsystem.h"
13
14 /// Represents a D [ ] array
15 template<typename T>
16 struct DArray
17 {
18 size_t length;
19 T *ptr;
20 };
21
22 /// Corresponding C++ type that maps to D size_t
23 #if __APPLE__ && __i386__
24 // size_t is 'unsigned long', which makes it mangle differently than D's 'uint'
25 typedef unsigned d_size_t;
26 #elif MARS && DMD_VERSION >= 2079 && DMD_VERSION <= 2081 && \
27 __APPLE__ && __SIZEOF_SIZE_T__ == 8
28 // DMD versions between 2.079 and 2.081 mapped D ulong to uint64_t on OS X.
29 typedef uint64_t d_size_t;
30 #else
31 typedef size_t d_size_t;
32 #endif