Previously, we always assumed that local includes are relative to the
parent directory of a file. This effectively banned style-wise
multi-directory subprojects which are not libraries, since there was no
way to cleanly reference local file from a different directory.
This commit relaxes the restrictions by introducing
LOCAL_INCLUDE_ROOT_OVERRIDES. Entry in the set changes root of the
local includes to itself for all files in its subtree.
This adds an alternative Ladybird chrome for macOS using the AppKit
framework. Just about everything needed for normal web browsing has
been implemented. This includes:
* Tabbed, scrollable navigation
* History navigation (back, forward, reload)
* Keyboard / mouse events
* Favicons
* Context menus
* Cookies
* Dialogs (alert, confirm, prompt)
* WebDriver support
This does not include debugging tools like the JavaScript console and
inspector, nor theme support.
The Qt chrome is still used by default. To use the AppKit chrome, set
the ENABLE_QT CMake option to OFF.
Once LibC is installed to the sysroot and its conflicts with libc++
are resolved, including LibC headers in such a way will cause errors
with a modern LLVM-based toolchain.
This is needed to avoid including LibC headers in Lagom builds.
Unfortunately, we cannot rely on the build machine to provide a
fully POSIX-compatible ELF header for Lagom builds, so we have to
use our own.
If a local include does not point to a file in the repository, it should
be a system include instead. This is now checked on every commit.
While this does introduce significant overhead in terms of percentage,
I think that an additional 10ms on huge commits (or less on smaller
commits) are acceptable:
hyperfine -w1 './Meta/check-style.py AK/*.h AK/*.cpp' # Before
Benchmark 1: ./Meta/check-style.py AK/*.h AK/*.cpp
Time (mean ± σ): 20.3 ms ± 0.4 ms [User: 17.1 ms, System: 3.
5 ms]
Range (min … max): 19.5 ms … 21.6 ms 128 runs
hyperfine -w1 './Meta/check-style.py AK/*.h AK/*.cpp' # After
Benchmark 1: ./Meta/check-style.py AK/*.h AK/*.cpp
Time (mean ± σ): 32.3 ms ± 0.4 ms [User: 27.9 ms, System: 4.
4 ms]
Range (min … max): 31.4 ms … 34.9 ms 91 runs
SafeFunction automatically registers its closure memory area in a place
where the JS garbage collector can find it.
This means that you can capture JS::Value and arbitrary pointers into
the GC heap in closures, as long as you're using a SafeFunction, and the
GC will not zap those values!
There's probably some performance impact from this, and there's a lot of
things that could be nicer/smarter about it, but let's build something
that ensures safety first, and we can worry about performance later. :^)
This speeds up the script from about 90ms down to about 10ms, for
reasonably common changesets.
80ms may not feel like much, but it adds up quickly, especially since
we run a dozen scripts during pre-commit.
This moves all code comprehension-related code to a new library,
LibCodeComprehension.
This also moves some types related to code comprehension tasks (such as
autocomplete, find declaration) out of LibGUI and into
LibCodeComprehension.
ISO C requires in section 7.2:
The assert macro is redefined according to the current state of NDEBUG
each time that <assert.h> is included.
Also add tests for `assert` multiple inclusion accordingly.
On my machine, this script took about 3.4 seconds, and was responsible
for essentially all of the time taken by the precommit hook.
The script is a faithful 1:1 reimplementation, even the regexes are
identical. And yet, it takes about 0.02 seconds, making the pre-commit
hook lightning fast again. Apparently python is just faster in this
case.
Fun fact:
- Just reading all ~4000 files took bash about 1.2 seconds
- Checking the license took another 1.8 seconds in total
- Checking for math.h took another 0.4 seconds in total
- Checking for '#pragma once' took another 0.4 seconds in total
The timing is highly load-dependent, so they don't exactly add up to 3.4
seconds. However, it's good enough to determine that bash is no longer
fit for the purpose of this script.