summaryrefslogtreecommitdiff
path: root/AK
AgeCommit message (Collapse)Author
2020-08-12AK: Mark compilation-unit-only functions as staticBen Wiederhake
This enables a nice warning in case a function becomes dead code. Also, add forgotten header to Base64.cpp, which would cause an issue later when we enable -Wmissing-declarations.
2020-08-11AK: Span<T>::operator=(const T&) => Span<T>::operator=(const Span<T>&)AnotherTest
2020-08-10AK: Add test case for duplicate JsonObject keysLinus Groh
2020-08-10AK: Don't keep equal JsonObject keys in the order vector twiceLinus Groh
Fixes #3069.
2020-08-10AK: Implement and test DistinctNumeric classBen Wiederhake
This template class allows for easy generation of incompatible numeric types. This is useful whenever code has to handle heterogenous data (like meters and seconds) but the underlying data types are compatible (like int and int). The motivation comes from the Kernel's inconsistent use of pid_t for process and thread IDs even though the ID spaces are incompatible, and translating forth/back is nontrivial. Other uses could be units (as described above), or incompatible index systems. A popular use in real life is image manipulation, when there are multiple coordinate systems.
2020-08-10AK: TestSuite's main should return 0Ben Wiederhake
2020-08-10disasm: Insert symbol names in disassembly streamNico Weber
The symbol name insertion scheme is different from objdump -d's. Compare the output on Build/Userland/id: * disasm: ... _start (08048305-0804836b): 08048305 push ebp ... 08048366 call 0x0000df56 0804836b o16 nop 0804836d o16 nop 0804836f nop (deregister_tm_clones (08048370-08048370)) 08048370 mov eax, 0x080643e0 ... _ZN2AK8Utf8ViewC1ERKNS_6StringE (0805d9b2-0805d9b7): _ZN2AK8Utf8ViewC2ERKNS_6StringE (0805d9b2-0805d9b7): 0805d9b2 jmp 0x00014ff2 0805d9b7 nop * objdump -d: 08048305 <_start>: 8048305: 55 push %ebp ... 8048366: e8 9b dc 00 00 call 8056006 <exit> 804836b: 66 90 xchg %ax,%ax 804836d: 66 90 xchg %ax,%ax 804836f: 90 nop 08048370 <deregister_tm_clones>: 8048370: b8 e0 43 06 08 mov $0x80643e0,%eax ... 0805d9b2 <_ZN2AK8Utf8ViewC1ERKNS_6StringE>: 805d9b2: e9 eb f6 ff ff jmp 805d0a2 <_ZN2AK10StringViewC1ERKNS_6StringE> 805d9b7: 90 nop Differences: 1. disasm can show multiple symbols that cover the same instructions. I've only seen this happen for C1/C2 (and D1/D2) ctor/dtor pairs, but it could conceivably happen with ICF as well. 2. disasm separates instructions that do not belong to a symbol with a newline, so that nop padding isn't shown as part of a function when it technically isn't. 3. disasm shows symbols that are skipped (due to having size 0) in parenthesis, separated from preceding and following instructions.
2020-08-09LibELF+Lagom: Work towards getting LibELF in LagomNico Weber
Mostly -Wformat fixes, some of which pointed out real (if benign) bugs.
2020-08-09AK: Add a GenericLexer and extend the JsonParser with it (#2696)Benoît Lormeau
2020-08-07AK: Add static_ptr_cast support for the Userspace<T> pointer typeBrian Gianforcaro
When using Userspace<T> there are certain syscalls where being able to cast between types is needed. You should be able to easily cast away the Userspace<T> wrapper, but it's perfectly safe to be able to cast the internal type that is being wrapped.
2020-08-07AK: Remove unnecessary clang-format off comments.asynts
2020-08-06AK+Kernel+LibC: Add vdbgprintf()Andreas Kling
This is like dbgprintf() except it takes a va_list instead of ...
2020-08-06AK: Remove Stream::operator bool()Andreas Kling
This was only used in one place, and that caused a bug, so I'm removing this for now since there are no more uses.
2020-08-06Refactor: Expose const_cast by removing ByteBuffer::warp(const void*, size_t)asynts
This function did a const_cast internally which made the call side look "safe". This method is removed completely and call sites are replaced with ByteBuffer::wrap(const_cast<void*>(data), size) which makes the behaviour obvious.
2020-08-06LibDebug: Use InputMemoryStream instead of BufferStream.asynts
This removes another call to ByteBuffer::wrap(const void*, size_t).
2020-08-06AK: Add InputStream abstraction and InputMemoryStream implementation.asynts
2020-08-06AK: Add String constructor from ReadonlyBytes.asynts
2020-08-06AK: Rename Tests/Span.cpp to Tests/TestSpan.cpp.asynts
2020-08-06AK: Add Integral and FloatingPoint concepts.asynts
2020-08-06AK: Rename MakeUnsigned::type to MakeUnsigned::Type.asynts
Also renames MakeSigned::type to MakeSigned::Type.
2020-08-06AK: Make min/max behave like the STL for equivalent inputs (#2976)Muhammad Zahalqa
min(a, b) now returns a if both are equivalent. max(a, b) now returns a if both are equivalent.
2020-08-06AK: Fix broken symlink used by JSON testAndreas Kling
2020-08-05Unicode: Try s/codepoint/code_point/g againNico Weber
This time, without trailing 's'. Ran: git grep -l 'codepoint' | xargs sed -ie 's/codepoint/code_point/g
2020-08-05Revert "Unicode: s/codepoint/code_point/g"Nico Weber
This reverts commit ea9ac3155d1774f13ac4e9a96605c0e85a8f299e. It replaced "codepoint" with "code_points", not "code_point".
2020-08-05AK: Decorate AK::Result<V, E> with [[nodiscard]]Brian Gianforcaro
2020-08-05AK: Decorate AK::TriState with [[nodiscard]]Brian Gianforcaro
TriState is another type of return code, it's value should always be observed.
2020-08-05AK: Decorate atomic compare exchange operations with [[nodiscard]]Brian Gianforcaro
All CAS operations should always check return values, so they are robust to failure in the event of conflict in parallel operation.
2020-08-05AK: Decorate AK::NonnullOwnPtr::leak_ptr() with [[nodiscard]]Brian Gianforcaro
2020-08-05AK: Decorate AK::OwnPtr::leak_ptr() with [[nodiscard]]Brian Gianforcaro
We should always leak to an observed variable, otherwise it's an actual leak. This is similar to AK::RefPtr::leak_ref() which is also marked as [[nodiscard]].
2020-08-05AK: Decorate Optional<T> with [[nodisard]]Brian Gianforcaro
2020-08-05AK: Fix StringUtils tests to actually observe return value.Brian Gianforcaro
Noticed this while playing around with making Optional<T> nodiscard.
2020-08-05AK: Use AK relative include style for InlineLinkedList.hBrian Gianforcaro
This is the style that seems to be used in the rest of AK.
2020-08-05AK: Add SinglyLinkedListWithCount<T>, a singulary linked list with countBrian Gianforcaro
There are use cases where a linked list is useful but it's also worth the overhead to maintain a count so you can quickly answer queries of the size of the list.
2020-08-04Revert "AK: Let the compiler provide the default new and delete operators"Andreas Kling
This reverts commit 45b05e9734962b07f95630e76b9a680e1775f002. I forgot about the Toolchain build again. :^(
2020-08-04AK: Let the compiler provide the default new and delete operatorsAndreas Kling
...except in kernelspace.
2020-08-04AK: Remove an unused variable in the Span test (#2985)Uma Sankar
2020-08-03Unicode: s/codepoint/code_point/gAndreas Kling
Unicode calls them "code points" so let's follow their style.
2020-08-03AK: Add more time convenience functions and comparison operatorsTom
2020-08-03AK: Fix adding timeval/timespecTom
tv_usec and tv_nsec should always be less than one second.
2020-08-02AK: Fix overflow and mixed-signedness issues in binary_search() (#2961)Muhammad Zahalqa
2020-08-02AK: Remove relative_paths test from TestLexicalPathBrian Gianforcaro
This test appears to be testing functionality that doesn't exist. Just remove it. Closes old bug #2388 CC @bugaevc
2020-08-02AK: Hack Userspace<T> to not break Qt Creator syntax highlightingAndreas Kling
This is a very cheesy patch and I don't like it, but as Qt Creator does not grok C++20 concepts yet, this makes it possible to still use syntax highlighting. We'll remove this hack the moment it stops being a problem. Note that it doesn't actually affect the build since we use GCC, not Clang.
2020-08-01AK: In Userspace.h, #if defined(KERNEL) => #ifdef KERNELEmanuele Torre
2020-08-01AK: Use C++20 concepts to only allow Userspace wrappers of pointersEmanuele Torre
It was a bit odd that you could create a Userspace<int> and that Userspace<int>::ptr() returned an int instead of an int*. Let's use C++20 concepts to only allow creating Userspace objects with pointer types. :^)
2020-08-01AK: Make MappedFile store why it is invalidAnotherTest
This makes AK::MappedFile save the errno either open() or mmap() failed with.
2020-08-01AK: Add StringView::contains(StringView)AnotherTest
2020-07-31Kernel+AK: Add and use Userspace<T>::unsafe_userspace_ptr()Andreas Kling
Since we already have the type information in the Userspace template, it was a bit silly to cast manually everywhere. Just add a sufficiently scary-sounding getter for a typed pointer. Thanks @alimpfard for pointing out that I was being silly with tossing out the type. In the future we may want to make this API non-public as well.
2020-07-31AK: Add Userspace<T>, a wrapper for userspace pointersAndreas Kling
This will be used in the kernel to wrap pointers into userspace memory without convenient direct access. The idea is to use the compiler to enforce that we don't dereference userspace pointers.
2020-07-31AK: On failed mmap, don't claim that there's a readable pageBen Wiederhake
2020-07-30AK: Add (more) tests for String(View)::split*AnotherTest
This patchset adds some tests for String(View)::split*, hopefully documenting their behaviour in some cases.