Commit Graph

13 Commits

Author SHA1 Message Date
Ben Wiederhake
560133a0c6 Everywhere: Remove unused DeprecatedString includes 2023-04-09 22:00:54 +02:00
MacDue
f8bdb584f8 LibDeviceTree: Use unchecked_append() in path parsing
try_append() checks if the vector should increase capacity and if
so grows the vector. unchecked_append() verifies the vector already
has enough capacity, and will never grow the vector.
2023-02-24 23:56:37 +01:00
Linus Groh
69f0339bac Revert "LibDeviceTree: Propagate try_append() errors while parsing paths"
This reverts commit f064f5f36e.

As Andrew points out, this append is not actually fallible in practice,
since the loop is terminated once the vector size reaches its inline
capacity.

https://github.com/SerenityOS/serenity/pull/17606#discussion_r1117662246
2023-02-24 23:40:23 +01:00
MacDue
f064f5f36e LibDeviceTree: Propagate try_append() errors while parsing paths 2023-02-24 22:18:25 +01:00
Andrew Kaster
613cfb31b1 LibDeviceTree: Add a slow, allocation-free property fetch API
Using the walk_device_tree helper, we can walk the device tree from the
beginning looking for a specific property node. It's still missing the
ability to get property lists, string lists, and property-specific data.
2023-02-19 13:49:07 +01:00
Andrew Kaster
e9e279bb77 LibDeviceTree: Add walk_device_tree and use it to dump structured data
We can use this simple parser and its callbacks to implement more
complex parsing in later commits.
2023-02-19 13:49:07 +01:00
Andrew Kaster
895f54f487 LibDeviceTree: Refactor dump() to return ErrorOr, and use ReadonlyBytes
ReadonlyBytes is much nicer to use than a u8 const* + size_t.
2023-02-19 13:49:07 +01:00
Andrew Kaster
01f32a22b4 LibDeviceTree: Print the StringsBlock size properly when bounds checking 2023-02-19 13:49:07 +01:00
Linus Groh
6e19ab2bbc AK+Everywhere: Rename String to DeprecatedString
We have a new, improved string type coming up in AK (OOM aware, no null
state), and while it's going to use UTF-8, the name UTF8String is a
mouthful - so let's free up the String name by renaming the existing
class.
Making the old one have an annoying name will hopefully also help with
quick adoption :^)
2022-12-06 08:54:33 +01:00
Daniel Bertalan
4296425bd8 Everywhere: Remove redundant inequality comparison operators
C++20 can automatically synthesize `operator!=` from `operator==`, so
there is no point in writing such functions by hand if all they do is
call through to `operator==`.

This fixes a compile error with compilers that implement P2468 (Clang
16 currently). This paper restores the C++17 behavior that if both
`T::operator==(U)` and `T::operator!=(U)` exist, `U == T` won't be
rewritten in reverse to call `T::operator==(U)`. Removing `!=` operators
makes the rewriting possible again.
See https://reviews.llvm.org/D134529#3853062
2022-11-06 10:25:08 -07:00
Tim Schumacher
ce2f1b845f Everywhere: Mark dependencies of most targets as PRIVATE
Otherwise, we end up propagating those dependencies into targets that
link against that library, which creates unnecessary link-time
dependencies.

Also included are changes to readd now missing dependencies to tools
that actually need them.
2022-11-01 14:49:09 +00:00
Tim Schumacher
7834e26ddb Everywhere: Explicitly link all binaries against the LibC target
Even though the toolchain implicitly links against -lc, it does not know
where it should get LibC from except for the sysroot. In the case of
Clang this causes it to pick up the LibC stub instead, which might be
slightly outdated and feature missing symbols.

This is currently not an issue that manifests because we pass through
the dependency on LibC and other libraries by accident, which causes
CMake to link against the LibC target (instead of just the library),
and thus points the linker at the build output directory.

Since we are looking to fix that in the upcoming commits, let's make
sure that everything will still be able to find the proper LibC first.
2022-11-01 14:49:09 +00:00
Andrew Kaster
644928314a Libraries: Add LibDeviceTree for manipulating OpenFirmware Device Trees
Starting with header validation and a dump() method that can be used to
debug future parsing work.
2021-10-21 19:20:03 -07:00