Commit graph

16572 commits

Author SHA1 Message Date
AnotherTest 20765da2a4 AK: Add dbgln() format checking
This checks the following things:
- No unclosed braces in format string
    `dbgln("a:{}}", a)` where the '}}' would be interpreted as a
    literal '}'
    `dbgln("a:{", a)` where someone with a faulty keyboard like mine
    could generate
- No extra closed braces in format string
    `dbgln("a:{{}", a)` where the '{{' would interpreted as a literal '{'
    `dbgln("a:}", a)` where someone with a faulty keyboard could
    generate
- No references to nonexistent arguments
    `dbgln("a:{} b:{}", a)` where the value of `b` is not in the
    arguments list
- No unconsumed argument
    `dbgln("a:{1}", not_used, 1)` where `not_used` is extraneous
2021-02-08 18:08:55 +01:00
AnotherTest 09a43969ba Everywhere: Replace dbgln<flag>(...) with dbgln_if(flag, ...)
Replacement made by `find Kernel Userland -name '*.h' -o -name '*.cpp' | sed -i -Ee 's/dbgln\b<(\w+)>\(/dbgln_if(\1, /g'`
2021-02-08 18:08:55 +01:00
AnotherTest 1f8a633cc7 Kernel: Make Arch/i386/CPU.cpp safe to run through clang-format
This file was far too messy, and touching it was a major pain.
Also enable clang-format linting on it.
2021-02-08 18:08:55 +01:00
AnotherTest 53ce923e10 Everywhere: Fix obvious dbgln() bugs
This will allow compiletime dbgln() checks to pass
2021-02-08 18:08:55 +01:00
AnotherTest b68e34cc2e UserspaceEmulator: Use vdbgln() instead of dbgln() when reporting
This will avoid conflict with the upcoming compiletime checks.
2021-02-08 18:08:55 +01:00
AnotherTest f0d85acc94 AK: Add an iota_array() function that can generate an array
...of increasing values with an optional offset.
2021-02-08 18:08:55 +01:00
Ben Wiederhake de947acaf9 AK: Clean up includes around printf/vdbgprintf 2021-02-08 18:03:57 +01:00
Ben Wiederhake c6a42ab5c3 Everywhere: Remove unnecessary headers 4/4
Arbitrarily split up to make git bisect easier.

These unnecessary #include's were found by combining an automated tool (which
determined likely candidates) and some brain power (which decided whether
the #include is also semantically superfluous).
2021-02-08 18:03:57 +01:00
Ben Wiederhake cc89606ba8 Everywhere: Remove unnecessary headers 3/4
Arbitrarily split up to make git bisect easier.

These unnecessary #include's were found by combining an automated tool (which
determined likely candidates) and some brain power (which decided whether
the #include is also semantically superfluous).
2021-02-08 18:03:57 +01:00
Ben Wiederhake fa2b5ca6f6 Everywhere: Remove unnecessary headers 2/4
Arbitrarily split up to make git bisect easier.

These unnecessary #include's were found by combining an automated tool (which
determined likely candidates) and some brain power (which decided whether
the #include is also semantically superfluous).
2021-02-08 18:03:57 +01:00
Ben Wiederhake c9bb887c55 Everywhere: Remove unnecessary headers 1/4
Arbitrarily split up to make git bisect easier.

These unnecessary #include's were found by combining an automated tool (which
determined likely candidates) and some brain power (which decided whether
the #include is also semantically superfluous).

My favorite #include:

    #include "Applications/Piano/Music.h" // You can't have too much music in life!
2021-02-08 18:03:57 +01:00
Ben Wiederhake 0a2304ba05 Everywhere: Fix weird includes 2021-02-08 18:03:57 +01:00
Ben Wiederhake 6e9fa350bc Fuzz: Remove unused FuzziliJS header 2021-02-08 18:03:57 +01:00
Ben Wiederhake 7961e09c29 Everywhere: Add semantically-missing includes
For example, FindInFilesWidget.h mentions GUI::TableView, but did not include
it. On the other hand, all source files that include FindInFilesWidget.h
also include TableView.h, so the issue is only cosmetical.
2021-02-08 18:03:57 +01:00
Ben Wiederhake 667b417d9f AK: remove unused and uninteresting return value
The return value is always be 'count', even in the case of 0.

Note that the return value of TypedTransfer::copy() is likewise uninteresting,
but apparently it is beig used. Hence this patch does not touch it.
2021-02-08 18:03:57 +01:00
Ben Wiederhake 71219b8a1d Documentation: QtCreator and <syscall.h> 2021-02-08 18:03:57 +01:00
Ben Wiederhake 897d3d78b9 Documentation: Update QtCreator includes for Debug.h
Including 'Build/' is unfortunate, but this seems to be what everyone does,
short of creating a symlink/hardlink from /AK/Debug.h to /Build/AK/Debug.h.

This feels like a crutch, but it's a better crutch than having a workaround
that could easily break or corrupt commits (i.e., the symlinks).
2021-02-08 18:03:57 +01:00
Luke 3e723ec177 LibTTF: Check if the given offset plus offset table size would overflow
If it does overflow, it would think there was enough data to read in
table information, when there isn't. This would cause read buffer
overflows when reading in the table information.

Found by: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=29338&sort=-opened&can=1&q=proj%3Aserenity
2021-02-08 18:01:41 +01:00
Linus Groh 83c29bd8d7 LibJS: Don't assume match for each capture group in RegExp.prototype.exec()
This was not implementing the following part of the spec correctly:

    27. For each integer i such that i ≥ 1 and i ≤ n, do
        a. Let captureI be ith element of r's captures List.
        b. If captureI is undefined, let capturedValue be undefined.

Expecting a capture group match to exist for each of the RegExp's
capture groups would assert in Vector's operator[] if that's not the
case, for example:

    /(foo)(bar)?/.exec("foo")

Append undefined instead.

Fixes #5256.
2021-02-08 18:01:23 +01:00
Tom 1d843c46eb Kernel: KResultOr can use the same storage as the object for the error
Since it can only hold either an object or an error code, we can share
the same storage to hold either.
2021-02-08 18:00:38 +01:00
Linus Groh 79bab28f5e LibWeb: Implement Element.getElementsBy{Tag,Class}Name()
Just like the Document variants, but using the given Element as
for_each_in_subtree_of_type() root.
2021-02-08 17:59:04 +01:00
Linus Groh 2a38f008bf LibWeb: Make getElementsByClassName() case-insensitive in quirks mode
From https://dom.spec.whatwg.org/#concept-getelementsbyclassname:

    The comparisons for the classes must be done in an ASCII case-
    insensitive manner if root’s node document’s mode is "quirks", and
    in an identical to manner otherwise.
2021-02-08 17:59:04 +01:00
Linus Groh 5a9094a70a LibWeb: Make getElementsByTagName() case-insensitive for HTML elements
From https://dom.spec.whatwg.org/#concept-getelementsbytagname:

    2. Otherwise, if root’s node document is an HTML document, return a
       HTMLCollection rooted at root, whose filter matches the following
       descendant elements:

       * Whose namespace is the HTML namespace and whose qualified name
         is qualifiedName, in ASCII lowercase.

       * Whose namespace is not the HTML namespace and whose qualified
         name is qualifiedName.
2021-02-08 17:59:04 +01:00
Tom 27a395d964 Kernel: Fix KResultOr copy-move from itself case
If move-assigning from itself we shouldn't do anything.
2021-02-07 23:02:57 +01:00
Tom b22740c08e Kernel: Use KResultOr::release_value in Process::create_kernel_thread
This should avoid an unneccessary reference bump.
2021-02-07 22:25:15 +01:00
Tom f74e31c74d Kernel: Change KResultOr::take_value to use move semantics
This may be more light weight than copying the object.
2021-02-07 22:25:15 +01:00
Andreas Kling ad42d873e5 Kernel: Remove ancient unused Scheduler::beep() declaration 2021-02-07 20:45:09 +01:00
Andreas Kling 0d8262cbab Kernel: Remove a handful of unused things from Thread 2021-02-07 20:26:53 +01:00
Andreas Kling 2ec8b4e177 Kernel: Don't allocate kernel stack twice per thread :^) 2021-02-07 20:13:51 +01:00
Andreas Kling 33c7017f6e LibGUI: Add missing "final" in TextEditor 2021-02-07 19:32:40 +01:00
Andreas Kling b466ede1ea Kernel: Make sure we can allocate kernel stack before creating thread
Wrap thread creation in a Thread::try_create() helper that first
allocates a kernel stack region. If that allocation fails, we propagate
an ENOMEM error to the caller.

This avoids the situation where a thread is half-constructed, without a
valid kernel stack, and avoids having to do messy cleanup in that case.
2021-02-07 19:27:00 +01:00
Andreas Kling 5c45b0d32d Kernel: Combine Thread::backtrace() and backtrace_impl() into one 2021-02-07 19:27:00 +01:00
Andreas Kling fd3eca3acc Kernel: Add initializer for Thread::m_tss 2021-02-07 19:27:00 +01:00
Andreas Kling 5c1c82cd33 Kernel: Remove unused function Process::backtrace() 2021-02-07 19:27:00 +01:00
Andreas Kling b1813e5dae Kernel: Remove some unused declarations from Process 2021-02-07 19:27:00 +01:00
Brian Gianforcaro 489fe9b66a Meta: Fix path to kernel binary in debug-kernel.sh
This appears to have been broken since the migration to cmake.
2021-02-07 19:13:10 +01:00
Andreas Kling 50308f6fda Shell: Move Shell syntax highlighter LibShell 2021-02-07 17:07:33 +01:00
Andreas Kling ddbf20ecf6 LibSyntax+LibGUI+LibJS: Move JS syntax highlighter to LibJS
This is a little bit messy but the basic idea is:

Syntax::Highlighter now has a Syntax::HighlighterClient to talk to the
outside world. It mostly communicates in LibGUI primitives that are
available in headers, so inlineable.

GUI::TextEditor inherits from Syntax::HighlighterClient.

This let us to move GUI::JSSyntaxHighlighter to JS::SyntaxHighlighter
and remove LibGUI's dependency on LibJS.
2021-02-07 16:56:02 +01:00
Andreas Kling 22baa5e64f LibGfx: Make Palette::color(ColorRole) inline 2021-02-07 16:53:39 +01:00
Andreas Kling 767ff06f56 LibGfx: Make Color(NamedColor) inline and constexpr 2021-02-07 16:51:17 +01:00
Andreas Kling 43c7d7d285 LibSyntax: Move GUI::Highlighter to Syntax::Highlighter in LibSyntax
This is a move towards dropping more LibGUI dependencies.
2021-02-07 15:15:10 +01:00
Andreas Kling ff2438e0ce LibGUI+LibCpp: Move C++ syntax highlighter to LibCpp
This makes LibGUI not depend on LibCpp.
2021-02-07 14:40:36 +01:00
Andreas Kling b1f1f5afcf DynamicLoader: Remove unnecessary math functions
These are provided by libgcc.
2021-02-07 14:21:53 +01:00
AnotherTest 6985b4008a LibLine: Place the search editor prompt at the right line after ^L
...as the search editor prompt has to always stay after the main prompt preview.
2021-02-07 13:12:56 +01:00
AnotherTest 3a231c00aa LibLine: Close the search editor when it's interrupted
Fixes #5233.
2021-02-07 13:12:56 +01:00
AnotherTest 5204c9062c Shell: Make history index values not fitting in i32 a syntax error
A continuation of e3ec759.
Also found by oss-fuzz:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=30405
2021-02-07 13:12:56 +01:00
DragonAlex98 885974fc3c
WindowServer: Don't close menu when clicking on item with submenu (#5239)
When clicking on a menu item with a submenu, don't close the menu.
2021-02-07 12:28:42 +01:00
Brian Gianforcaro d107cabf5d Ports: Fix linking of the stress-ng port 2021-02-07 12:16:37 +01:00
Andreas Kling 0eac44af49 LibWeb: Don't assert on <colgroup> & friends
Let's just construct a placeholder BlockBox layout node for now.

Fixes #5081.
2021-02-07 11:47:33 +01:00
Andreas Kling 796c31a52b LibWeb: Reorganize Element::create_layout_node() into a switch
This allows us to see which CSS::Display types are not yet handled.
2021-02-07 11:40:42 +01:00