summaryrefslogtreecommitdiff
path: root/AK/Vector.h
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-06-28 20:58:41 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-06-28 20:58:41 +0200
commit3af59dfed1f0e6203cea3a6e5cdaa3bac7d72d31 (patch)
tree22785194b412c569f49c06515a6841fb95402e4e /AK/Vector.h
parent872cccb8f7c66a5461e0a8e11926e381fa7832be (diff)
downloadserenity-3af59dfed1f0e6203cea3a6e5cdaa3bac7d72d31.zip
AK: We can't use std::initializer_list in LibC builds.
The LibC build is a bit complicated, since the toolchain depends on it. During the toolchain bootstrap, after we've built parts of GCC, we have to stop and build Serenity's LibC, so that the rest of GCC can use it. This means that during that specific LibC build, we don't yet have access to things like std::initializer_list. For now we solve this by defining SERENITY_LIBC_BUILD during the LibC build and excluding the Vector/initializer_list support inside LibC.
Diffstat (limited to 'AK/Vector.h')
-rw-r--r--AK/Vector.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/AK/Vector.h b/AK/Vector.h
index 2ed2dc7bfc..1ae11d6cab 100644
--- a/AK/Vector.h
+++ b/AK/Vector.h
@@ -3,7 +3,13 @@
#include <AK/Assertions.h>
#include <AK/StdLibExtras.h>
#include <AK/kmalloc.h>
+
+// NOTE: We can't include <initializer_list> during the toolchain bootstrap,
+// since it's part of libstdc++, and libstdc++ depends on LibC.
+// For this reason, we don't support Vector(initializer_list) in LibC.
+#ifndef SERENITY_LIBC_BUILD
#include <initializer_list>
+#endif
#ifndef __serenity__
#include <new>
@@ -65,12 +71,14 @@ public:
clear();
}
+#ifndef SERENITY_LIBC_BUILD
Vector(std::initializer_list<T> list)
{
ensure_capacity(list.size());
for (auto& item : list)
unchecked_append(item);
}
+#endif
Vector(Vector&& other)
: m_size(other.m_size)