Commit Graph

9 Commits

Author SHA1 Message Date
Nicholas-Baron
c4ede38542 Everything: Add -Wnon-virtual-dtor flag
This flag warns on classes which have `virtual` functions but do not
have a `virtual` destructor.

This patch adds both the flag and missing destructors. The access level
of the destructors was determined by a two rules of thumb:
1. A destructor should have a similar or lower access level to that of a
   constructor.
2. Having a `private` destructor implicitly deletes the default
   constructor, which is probably undesirable for "interface" types
   (classes with only virtual functions and no data).

In short, most of the added destructors are `protected`, unless the
compiler complained about access.
2021-04-15 20:57:13 +02:00
AnotherTest
a6e4482080 AK+Everywhere: Make StdLibExtras templates less wrapper-y
This commit makes the user-facing StdLibExtras templates and utilities
arguably more nice-looking by removing the need to reach into the
wrapper structs generated by them to get the value/type needed.
The C++ standard library had to invent `_v` and `_t` variants (likely
because of backwards compat), but we don't need to cater to any codebase
except our own, so might as well have good things for free. :^)
2021-04-10 21:01:31 +02:00
Andreas Kling
5a050cb8d1 LibX86: Don't use "if (foo) [[unlikely]] { }" for now (to please clang) 2021-03-09 17:47:28 +01:00
Andreas Kling
656cd477c2 UserspaceEmulator+LibX86: Sprinkle some [[unlikely]] and ALWAYS_INLINE 2021-03-09 15:10:08 +01:00
Andreas Kling
5d180d1f99 Everywhere: Rename ASSERT => VERIFY
(...and ASSERT_NOT_REACHED => VERIFY_NOT_REACHED)

Since all of these checks are done in release builds as well,
let's rename them to VERIFY to prevent confusion, as everyone is
used to assertions being compiled out in release.

We can introduce a new ASSERT macro that is specifically for debug
checks, but I'm doing this wholesale conversion first since we've
accumulated thousands of these already, and it's not immediately
obvious which ones are suitable for ASSERT.
2021-02-23 20:56:54 +01:00
Andreas Kling
de149dc7fa LibX86: Don't assert just because insn has no immediate bytes
It's perfectly fine to not have immediate bytes. Many insns don't :^)
2021-02-02 20:13:44 +01:00
Thomas Mangin
34508c0b01 LibX86: sanity check for Instruction read size
During "Emulator hacking: Let's make the userspace emulator go faster!",
the switch implented in read() was inlined (toward the end of the video).

This patch restore the assert check for any read other than 8, 16 or 32
bits was lost during the code conversion.
2021-01-31 19:06:24 +01:00
Ben Wiederhake
67cda61b7f Libraries: Add missing headers
A C++ source file containing just
    #include <LibFoo/Bar.h>
should always compile cleanly.

This patch adds missing header inclusions that could have caused weird error
messages if they were used in a different context. Also, this confused QtCreator.
2021-01-22 21:49:54 +01:00
Andreas Kling
13d7c09125 Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00