Commit graph

30071 commits

Author SHA1 Message Date
Andrew Kaster
2b16ee742e AK: Avoid implicit conversion clang-tidy warnings in AK::Time 2021-11-14 22:52:35 +01:00
Andrew Kaster
2c4f7fae1e AK: Move StandardFormatter argument into base class initializer
Subclasses of StandardFormatter don't need to use the formatter argument
in their constructor, so move() it into the base class initializer.
2021-11-14 22:52:35 +01:00
Andrew Kaster
74e8aa73e5 AK: Avoid implicit conversions in TypeErasedParameter::to_size()
Refactor to a visitor+functor pattern that does an explicit static_cast
to size_t after performing suitable range checks for each type.
2021-11-14 22:52:35 +01:00
Andrew Kaster
762b92c650 AK: Resolve clang-tidy readability-qualified-auto warnings
... In files included by Kernel/Process.cpp and Kernel/Thread.cpp
2021-11-14 22:52:35 +01:00
Andrew Kaster
64edf17eb2 AK: Mark StringView::find_any_of() as const 2021-11-14 22:52:35 +01:00
Andrew Kaster
163367da39 AK: Resolve clang-tidy warnings about unusual assignment operators
Either not returning *this, or in the case of Variant, not checking for
self assignment. In AK::Atomic, we can't return *this due to the wrapper
semantics Atomic implements.
2021-11-14 22:52:35 +01:00
Andrew Kaster
22feb9d47b AK: Resolve clang-tidy readability-bool-conversion warnings
... In files included by Kernel/Process.cpp and Kernel/Thread.cpp
2021-11-14 22:52:35 +01:00
Andrew Kaster
10d0cac73c AK: Use capitalized literal suffixes for AK::abs() overloads
Using `l` for long double causes a clang-tidy warning, so use all caps
suffixes for all of the AK::abs() overloads for consistency. Also, avoid
leaking the internal __DEFINE_GENERIC_ABS macro.
2021-11-14 22:52:35 +01:00
Andrew Kaster
e982253c33 AK: Avoid else after return in files commonly included by the Kernel 2021-11-14 22:52:35 +01:00
Andrew Kaster
07f4e91b94 AK: Use proper type for bool NumericLimits::min and max specialization
We had these declared as returning char, which looks like a copy paste
error. Found by clang-tidy.
2021-11-14 22:52:35 +01:00
Andrew Kaster
7e2ee2e725 AK: Suppress false-positive clang-tidy warning in Assertions.h
The definition of VERIFY_NOT_REACHED() as `assert(false)` causes the
tool to suggest converting it to a static_assert. Which doesn't make
any sense in context for what the macro is trying to do: crash the
program at runtime.
2021-11-14 22:52:35 +01:00
Andrew Kaster
6f5b9cc031 Toolchain: Enable clang-tools-extra for LLVM
If we want to use clang-tidy on the codebase, we'll need to build
clang-tidy from an LLVM that has been patched and built with Serenity
cross-compilation support.
2021-11-14 22:52:35 +01:00
Andrew Kaster
3eeca784d2 Meta: Add basic clang-tidy configuration
Add a basic clang-tidy configuration that enables checks from the
following categories:

- bugprone
- cert
- clang-analyzer
- concurrency
- misc
- performance
- portability
- readability

The noisiest rules that have conflicts with the project style guide or
accepted practices have been turned off.

There's absolutely more work to be done here before we could consider
setting any of these warnings as errors and enforcing them in CI, but
committing a project clang-tidy configuration should help the rules
become more visible and let other contributors take a crack at tweaking
rules and/or finding possible bugs.

Sadly the cpp-core-guidelines and modernize categories are very, very
noisy. If we want to enable rules from these categories, they would need
to be on a rule by rule basis.
2021-11-14 22:52:35 +01:00
faxe1008
480903fe8a Taskbar: Make quicklaunch bar editable
This change adds a ConfigServer Listener to TaskbarWindow. Items in the
quicklaunch bar may be added or removed by editing the Taskbar config.
2021-11-14 22:42:52 +01:00
faxe1008
06cb526feb config: Add option to remove config key 2021-11-14 22:42:52 +01:00
Tim Schumacher
292398b585 Toolchain: Load x64 executables at a higher address
Serenity defines a protected range of memory that must not be mmapped,
and is apparently reserved for kernel tasks. In this case, the protected
range is anything below 0x800000.

However, in its default setting, binutils chooses the memory address
0x400000 as the mapping address for executables that do not have PIE
enabled, resulting in mmap being unable to map the file unless the load
address has been overwritten at link time or if it's a PIE.

To mitigate this, move the default base address somewhere outside of
that range (and preferably not anywhere close near the beginning of the
useable virtual memory space, to avoid running into it during sequential
allocations).
2021-11-14 22:25:15 +01:00
Timothy Flynn
4d79ab6866 LibJS: Implement engineering and scientific number formatting 2021-11-14 17:00:35 +00:00
Timothy Flynn
30fbb7d9cd LibUnicode: Parse and generate scientific formatting rules 2021-11-14 17:00:35 +00:00
Timothy Flynn
b019a7fe64 LibJS: Define the "name" property on the number format function
Also add a missing spec link.
2021-11-14 17:00:35 +00:00
Timothy Flynn
3645f6a0fc LibUnicode: Fix typo in percent format parser
Just by sheer luck this had no actual effect because the decimal format
prefix has the same length as the percent format prefix.
2021-11-14 17:00:35 +00:00
Daniel Bertalan
061fa8a1ca Toolchain: Add aligned allocation support to libc++
Now that we have `_aligned_malloc` and `_aligned_free`, we can finally
enable C++17 aligned allocation support.
2021-11-14 16:46:21 +00:00
Daniel Bertalan
40e7ac9967 LibC: Implement _aligned_malloc and _aligned_free
C++17 introduced aligned versions of `new` and `delete`, which are
automatically called by the compiler when allocating over-aligned
objects. As with the regular allocator functions, these are generally
thin wrappers around LibC.

We did not have support for aligned allocations in LibC, so this was not
possible. While libstdc++ has a fallback implementation, libc++ does
not, so the aligned allocation function was disabled internally. This
made building the LLVM port with Clang impossible.

Note that while the Microsoft docs say that aligned_malloc and
_aligned_free are declared in `malloc.h`, libc++ doesn't #include that
file, but instead relies on the definition coming from `stdlib.h`.
Therefore, I chose to declare it in that file instead of creating a new
LibC header.

I chose not to implement the more Unix-y `memalign`, `posix_memalign`,
or the C11 `aligned_alloc`, because that would require us to
significantly alter the memory allocator's internals. See the comment in
malloc.cpp.
2021-11-14 16:46:21 +00:00
EWouters
069e64efd1 Ports/libuv: Update libuv to version 1.42.0 and fix cmake argument
Add CMAKE_BUILD_WITH_INSTALL_RPATH=true to the cmake arguments as it
wouldn't compile on MacOS without this argument
2021-11-14 16:20:55 +00:00
Brian Gianforcaro
2c4db837e7 Ports: Add initial Pipe Viewer (pv) 1.6.20 port 2021-11-14 16:18:45 +00:00
Brian Gianforcaro
d1806d44fa AK: Swallow 'L' format specifier until it is properly implemented
Previously if code attempted to use the format specifier somewhere
(Ex: "%#4.3Lg"), the specifier would get dropped and we would just
print "g" instead of any value. Now at least we print a value.
2021-11-14 16:18:45 +00:00
Lady Gegga
0ddb877f87 Base: Add Chorasmian characters to font Katica Regular 10
10FB0-10FCB https://www.unicode.org/charts/PDF/U10FB0.pdf
2021-11-14 16:16:19 +00:00
Linus Groh
27d84bebd4 LibJS: Remove redundant exception checks from initialize_constructor()
define_direct_property() simply wraps storage_set(), which cannot throw.
2021-11-14 16:14:38 +00:00
Linus Groh
57de5056b6 LibJS: Convert push_execution_context() to ThrowCompletionOr 2021-11-14 16:14:38 +00:00
Linus Groh
7cdca08090 LibJS: Convert prepare_for_ordinary_call() to ThrowCompletionOr 2021-11-14 16:14:38 +00:00
Linus Groh
33ed87d642 LibJS: Convert TypedArray create() functions to ThrowCompletionOr 2021-11-14 16:14:38 +00:00
Linus Groh
878668efc9 LibJS: Call [[Reject]] in PromiseResolveThenableJob after abrupt then() 2021-11-14 15:27:46 +00:00
Linus Groh
194d90dc72 LibJS: Don't coerce this value to object in Promise.prototype.finally() 2021-11-14 15:27:46 +00:00
Linus Groh
53ec432e8d LibJS: Don't coerce this value to object in Promise.resolve() 2021-11-14 15:27:46 +00:00
Linus Groh
cd391aa8ef LibJS: Convert call_job_callback() to ThrowCompletionOr 2021-11-14 15:27:46 +00:00
Linus Groh
68ac13a192 LibJS: Add a Completion(ThrowCompletionOr<Value> const&) constructor 2021-11-14 15:27:46 +00:00
Linus Groh
01c2570678 LibJS: Annotate Promise implementation with spec comments
I wanted to do this for a long time. The guts of Promise are pretty
complex, and it's easier to understand with the spec right next to it.
Also found a couple of issues along the way :^)
2021-11-14 15:27:46 +00:00
Daniel Bertalan
df06552b48 Ports: Fix building zlib with Clang
Even though Clang generates PIC objects by default, an R_386_PC32
relocation still slips into libz.a if we don't set -fPIC explicitly.
2021-11-14 11:38:40 +00:00
Andreas Kling
7e5b22333e WindowServer: Make window switcher look more like other overlays
Render the window switcher with the same background and shadow as other
WindowServer overlays.

Note that we don't actually render it as a WindowServer::Overlay, as the
window switcher uses mouse and keyboard events, and there's currently
no way for an overlay to receive events.
2021-11-14 12:23:04 +01:00
Andreas Kling
7fb2540ffe WindowServer: Clear window switcher's hovered item when cursor leaves
When the mouse cursor leaves the switcher window, we'll want to clear
the hovered item index so it stops showing as hovered. :^)
2021-11-14 12:23:04 +01:00
Andreas Kling
6f80d91850 WindowServer: Reset the window switcher's hovered item between uses
Before this, the last hovered item would still appear hovered when
bringing up the window switcher after having dismissed it.
2021-11-14 12:23:04 +01:00
Andreas Kling
9f7f7e69bb WindowServer: Allow server-internal windows with alpha channel
We were not creating backing stores with alpha for server-internal
windows. There was no reason for this limitation.
2021-11-14 12:23:04 +01:00
Andreas Kling
583fbf7111 WindowServer: Make WindowFrame::shadow_bitmap() const
There is no reason for callers to mutate the shadow bitmaps returned by
this function.
2021-11-14 12:23:04 +01:00
Lady Gegga
530360ce77 Base: Add Mende Kikakui characters to font Katica Regular 10
U1E800-1E8DF https://www.unicode.org/charts/PDF/U1E800.pdf
2021-11-14 11:11:01 +00:00
Timothy Flynn
15c5fbd9e9 LibJS: Implement number grouping for Intl.NumberFormat
For example, in en-US, the number 123456 should be formatted as the
string "123,456". In en-IN, it should be formatted as "1,23,456".
2021-11-14 10:35:19 +00:00
Timothy Flynn
3b7f5af042 LibUnicode: Generate primary and secondary number grouping sizes
Most locales have a single grouping size (the number of integer digits
to be written before inserting a grouping separator). However some have
a primary and secondary size. We parse the primary size as the size used
for the least significant integer digits, and the secondary size for the
most significant.
2021-11-14 10:35:19 +00:00
Liav A
0e5983e603 Kernel/AHCI: Simplify wait and timeout pattern significantly
Instead of repeating ourselves with the pattern of waiting for some
condition to be met, we can have a general method for this task,
and then we can provide the retry count, the required delay and a lambda
function for the checked condition.
2021-11-13 23:35:27 +01:00
Liav A
557351724a Kernel/AHCI: Remove unnecessary AHCIPort class member 2021-11-13 23:35:27 +01:00
Tim Schumacher
2e8330f78c Utilities/tr: Rework squeezing to be supported during more operations 2021-11-13 23:34:49 +01:00
David Lindbom
3c98a9430b LibVT: Show action of double click in tooltip
When hovering an item in Terminal we now show what application will
handle it, e.g "Open app-catdog.png in ImageViewer".

If the file is its own handler, i.e an executable, it will show
"Execute myscript.sh"
2021-11-13 23:33:46 +01:00
Luke Wilde
f6ab63993a LibJS: Implement Temporal.ZonedDateTime.prototype.round 2021-11-13 19:48:54 +00:00