diff options
Diffstat (limited to 'gcc/d/dmd/root')
-rw-r--r-- | gcc/d/dmd/root/dcompat.h | 10 | ||||
-rw-r--r-- | gcc/d/dmd/root/optional.h | 4 |
2 files changed, 12 insertions, 2 deletions
diff --git a/gcc/d/dmd/root/dcompat.h b/gcc/d/dmd/root/dcompat.h index 0bc23b7..1a49688 100644 --- a/gcc/d/dmd/root/dcompat.h +++ b/gcc/d/dmd/root/dcompat.h @@ -36,7 +36,7 @@ struct DString : public DArray<const char> }; /// Corresponding C++ type that maps to D size_t -#if __APPLE__ && __i386__ +#if __APPLE__ && (__i386__ || __ppc__) // size_t is 'unsigned long', which makes it mangle differently than D's 'uint' typedef unsigned d_size_t; #elif MARS && DMD_VERSION >= 2079 && DMD_VERSION <= 2081 && \ @@ -49,3 +49,11 @@ typedef unsigned d_size_t; #else typedef size_t d_size_t; #endif + +/// Corresponding C++ type that maps to D bool +#if __APPLE__ && __ppc__ +// bool is defined as an 'int', which does not match same size as D +typedef uint8_t d_bool; +#else +typedef bool d_bool; +#endif diff --git a/gcc/d/dmd/root/optional.h b/gcc/d/dmd/root/optional.h index cc2ee79..353332c 100644 --- a/gcc/d/dmd/root/optional.h +++ b/gcc/d/dmd/root/optional.h @@ -11,6 +11,8 @@ * Coverage: https://codecov.io/gh/dlang/dmd/src/master/src/dmd/root/optional.h */ +#include "dcompat.h" // for d_bool + /// Optional type that is either `empty` or contains a value of type `T` template<typename T> struct Optional final @@ -20,7 +22,7 @@ private: T value; /** whether `value` is set **/ - bool present; + d_bool present; public: /** Creates an `Optional` with the given value **/ |