mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-11 05:25:32 +03:00
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.
This commit is contained in:
parent
872cccb8f7
commit
3af59dfed1
Notes:
sideshowbarker
2024-07-19 13:27:40 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/3af59dfed1f
@ -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)
|
||||
|
@ -58,7 +58,7 @@ ASM_OBJS = setjmp.ao crti.ao crtn.ao
|
||||
CPP_OBJS = $(AK_OBJS) $(WIDGETS_OBJS) $(LIBC_OBJS)
|
||||
|
||||
LIBRARY = libc.a
|
||||
DEFINES += -DUSERLAND
|
||||
DEFINES += -DUSERLAND -DSERENITY_LIBC_BUILD
|
||||
|
||||
all: $(LIBRARY) startfiles
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user