diff --git a/toolchains/macosx-i386/Dockerfile.m4 b/toolchains/macosx-i386/Dockerfile.m4 index ee46a28..2f9b6be 100644 --- a/toolchains/macosx-i386/Dockerfile.m4 +++ b/toolchains/macosx-i386/Dockerfile.m4 @@ -10,6 +10,10 @@ m4_define(`MACOSX_PORTS_ARCH_ARG',`--i386')m4_dnl m4_include(`macosx.m4')m4_dnl # Our compiler is c++11 compliant but our libstdc++ is too old for that -# So far it kind of works but glew needs cstdint -# Please it by providing it +# So far it worked but several fixes are now needed +# glew needs cstdint COPY cstdint ${TARGET_DIR}/SDK/MacOSX`'MACOSX_SDK_VERSION`'.sdk/usr/include/c++/4.2.1/cstdint +# ScummVM needs initializer_list +COPY initializer_list ${TARGET_DIR}/SDK/MacOSX`'MACOSX_SDK_VERSION`'.sdk/usr/include/c++/4.2.1/initializer_list +# nullptr_t is needed in libstdc++ +RUN sed -i -e '/_GLIBCXX_BEGIN_NAMESPACE(std)/a typedef decltype(nullptr) nullptr_t;' ${TARGET_DIR}/SDK/MacOSX`'MACOSX_SDK_VERSION`'.sdk/usr/include/c++/4.2.1/cstddef diff --git a/toolchains/macosx-i386/initializer_list b/toolchains/macosx-i386/initializer_list new file mode 100644 index 0000000..e38da2c --- /dev/null +++ b/toolchains/macosx-i386/initializer_list @@ -0,0 +1,103 @@ +// std::initializer_list support -*- C++ -*- + +// Copyright (C) 2008-2021 Free Software Foundation, Inc. +// +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// GCC is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file initializer_list + * This is a Standard C++ Library header. + */ + +#ifndef _INITIALIZER_LIST +#define _INITIALIZER_LIST + +#pragma GCC system_header + +#pragma GCC visibility push(default) + +#include + +namespace std +{ + /// initializer_list + template + class initializer_list + { + public: + typedef _E value_type; + typedef const _E& reference; + typedef const _E& const_reference; + typedef size_t size_type; + typedef const _E* iterator; + typedef const _E* const_iterator; + + private: + iterator _M_array; + size_type _M_len; + + // The compiler can call a private constructor. + constexpr initializer_list(const_iterator __a, size_type __l) + : _M_array(__a), _M_len(__l) { } + + public: + constexpr initializer_list() noexcept + : _M_array(0), _M_len(0) { } + + // Number of elements. + constexpr size_type + size() const noexcept { return _M_len; } + + // First element. + constexpr const_iterator + begin() const noexcept { return _M_array; } + + // One past the last element. + constexpr const_iterator + end() const noexcept { return begin() + size(); } + }; + + /** + * @brief Return an iterator pointing to the first element of + * the initializer_list. + * @param __ils Initializer list. + * @relates initializer_list + */ + template + constexpr const _Tp* + begin(initializer_list<_Tp> __ils) noexcept + { return __ils.begin(); } + + /** + * @brief Return an iterator pointing to one past the last element + * of the initializer_list. + * @param __ils Initializer list. + * @relates initializer_list + */ + template + constexpr const _Tp* + end(initializer_list<_Tp> __ils) noexcept + { return __ils.end(); } +} + +#pragma GCC visibility pop + +#endif // _INITIALIZER_LIST