summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorasynts <asynts@gmail.com>2021-01-23 23:29:11 +0100
committerAndreas Kling <kling@serenityos.org>2021-01-25 09:47:36 +0100
commit1a3a0836c017ab5e5672472033f3ff369dc33c39 (patch)
tree354552e5dae4f7baf2b8ee05eb33e2f7587826f6 /Userland
parent76f29184162e35d570034a8438a683695faa273f (diff)
downloadserenity-1a3a0836c017ab5e5672472033f3ff369dc33c39.zip
Everywhere: Use CMake to generate AK/Debug.h.
This was done with the help of several scripts, I dump them here to easily find them later: awk '/#ifdef/ { print "#cmakedefine01 "$2 }' AK/Debug.h.in for debug_macro in $(awk '/#ifdef/ { print $2 }' AK/Debug.h.in) do find . \( -name '*.cpp' -o -name '*.h' -o -name '*.in' \) -not -path './Toolchain/*' -not -path './Build/*' -exec sed -i -E 's/#ifdef '$debug_macro'/#if '$debug_macro'/' {} \; done # Remember to remove WRAPPER_GERNERATOR_DEBUG from the list. awk '/#cmake/ { print "set("$2" ON)" }' AK/Debug.h.in
Diffstat (limited to 'Userland')
-rw-r--r--Userland/DevTools/HackStudio/CursorTool.cpp8
-rw-r--r--Userland/DevTools/HackStudio/LanguageServers/Cpp/ClientConnection.cpp4
-rw-r--r--Userland/DevTools/HackStudio/LanguageServers/Shell/ClientConnection.cpp2
-rw-r--r--Userland/DevTools/UserspaceEmulator/Emulator.cpp5
-rw-r--r--Userland/Libraries/LibCore/Gzip.cpp6
-rw-r--r--Userland/Libraries/LibCore/NetworkJob.cpp2
-rw-r--r--Userland/Libraries/LibCrypto/NumberTheory/ModularFunctions.cpp2
-rw-r--r--Userland/Libraries/LibDebug/DebugInfo.cpp9
-rw-r--r--Userland/Libraries/LibDebug/Dwarf/LineProgram.cpp26
-rw-r--r--Userland/Libraries/LibGemini/Job.cpp2
-rw-r--r--Userland/Libraries/LibGfx/GIFLoader.cpp4
-rw-r--r--Userland/Libraries/LibGfx/JPGLoader.cpp2
-rw-r--r--Userland/Libraries/LibGfx/PNGLoader.cpp18
-rw-r--r--Userland/Libraries/LibGfx/Painter.cpp4
-rw-r--r--Userland/Libraries/LibHTTP/Job.cpp2
-rw-r--r--Userland/Libraries/LibMarkdown/Text.cpp7
-rw-r--r--Userland/Libraries/LibRegex/RegexDebug.h5
-rw-r--r--Userland/Libraries/LibRegex/RegexLexer.cpp3
-rw-r--r--Userland/Libraries/LibRegex/RegexMatcher.cpp12
-rw-r--r--Userland/Libraries/LibRegex/RegexParser.cpp4
-rw-r--r--Userland/Libraries/LibRegex/Tests/Regex.cpp14
-rw-r--r--Userland/Libraries/LibTLS/ClientHandshake.cpp36
-rw-r--r--Userland/Libraries/LibTLS/Exchange.cpp7
-rw-r--r--Userland/Libraries/LibTLS/Record.cpp8
-rw-r--r--Userland/Libraries/LibTLS/Socket.cpp8
-rw-r--r--Userland/Libraries/LibTLS/TLSv12.cpp14
-rw-r--r--Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Loader/Resource.cpp4
-rw-r--r--Userland/Libraries/LibWeb/WebContentClient.cpp4
-rw-r--r--Userland/Services/ImageDecoder/ClientConnection.cpp4
-rw-r--r--Userland/Services/WindowServer/Compositor.cpp2
-rw-r--r--Userland/Services/WindowServer/Screen.cpp4
32 files changed, 116 insertions, 118 deletions
diff --git a/Userland/DevTools/HackStudio/CursorTool.cpp b/Userland/DevTools/HackStudio/CursorTool.cpp
index aed955e888..15fbce04d9 100644
--- a/Userland/DevTools/HackStudio/CursorTool.cpp
+++ b/Userland/DevTools/HackStudio/CursorTool.cpp
@@ -36,7 +36,7 @@ namespace HackStudio {
void CursorTool::on_mousedown(GUI::MouseEvent& event)
{
-#ifdef DEBUG_CURSOR_TOOL
+#if DEBUG_CURSOR_TOOL
dbgln("CursorTool::on_mousedown");
#endif
auto& form_widget = m_editor.form_widget();
@@ -73,7 +73,7 @@ void CursorTool::on_mousedown(GUI::MouseEvent& event)
void CursorTool::on_mouseup(GUI::MouseEvent& event)
{
-#ifdef DEBUG_CURSOR_TOOL
+#if DEBUG_CURSOR_TOOL
dbgln("CursorTool::on_mouseup");
#endif
if (event.button() == GUI::MouseButton::Left) {
@@ -94,7 +94,7 @@ void CursorTool::on_mouseup(GUI::MouseEvent& event)
void CursorTool::on_mousemove(GUI::MouseEvent& event)
{
-#ifdef DEBUG_CURSOR_TOOL
+#if DEBUG_CURSOR_TOOL
dbgln("CursorTool::on_mousemove");
#endif
auto& form_widget = m_editor.form_widget();
@@ -133,7 +133,7 @@ void CursorTool::on_mousemove(GUI::MouseEvent& event)
void CursorTool::on_keydown(GUI::KeyEvent& event)
{
-#ifdef DEBUG_CURSOR_TOOL
+#if DEBUG_CURSOR_TOOL
dbgln("CursorTool::on_keydown");
#endif
diff --git a/Userland/DevTools/HackStudio/LanguageServers/Cpp/ClientConnection.cpp b/Userland/DevTools/HackStudio/LanguageServers/Cpp/ClientConnection.cpp
index ec61984e54..0f1eb1d228 100644
--- a/Userland/DevTools/HackStudio/LanguageServers/Cpp/ClientConnection.cpp
+++ b/Userland/DevTools/HackStudio/LanguageServers/Cpp/ClientConnection.cpp
@@ -104,7 +104,7 @@ void ClientConnection::handle(const Messages::LanguageServer::FileEditInsertText
}
GUI::TextPosition start_position { (size_t)message.start_line(), (size_t)message.start_column() };
document->insert_at(start_position, message.text(), &s_default_document_client);
-#ifdef DEBUG_FILE_CONTENT
+#if DEBUG_FILE_CONTENT
dbgln("{}", document->text());
#endif
}
@@ -129,7 +129,7 @@ void ClientConnection::handle(const Messages::LanguageServer::FileEditRemoveText
};
document->remove(range);
-#ifdef DEBUG_FILE_CONTENT
+#if DEBUG_FILE_CONTENT
dbgln("{}", document->text());
#endif
}
diff --git a/Userland/DevTools/HackStudio/LanguageServers/Shell/ClientConnection.cpp b/Userland/DevTools/HackStudio/LanguageServers/Shell/ClientConnection.cpp
index cf71dc2134..93b2b11a65 100644
--- a/Userland/DevTools/HackStudio/LanguageServers/Shell/ClientConnection.cpp
+++ b/Userland/DevTools/HackStudio/LanguageServers/Shell/ClientConnection.cpp
@@ -104,7 +104,7 @@ void ClientConnection::handle(const Messages::LanguageServer::FileEditInsertText
}
GUI::TextPosition start_position { (size_t)message.start_line(), (size_t)message.start_column() };
document->insert_at(start_position, message.text(), &s_default_document_client);
-#ifdef DEBUG_FILE_CONTENT
+#if DEBUG_FILE_CONTENT
dbgln("{}", document->text());
#endif
}
diff --git a/Userland/DevTools/UserspaceEmulator/Emulator.cpp b/Userland/DevTools/UserspaceEmulator/Emulator.cpp
index 3c88b1bdd5..f9f0a04eab 100644
--- a/Userland/DevTools/UserspaceEmulator/Emulator.cpp
+++ b/Userland/DevTools/UserspaceEmulator/Emulator.cpp
@@ -28,6 +28,7 @@
#include "MmapRegion.h"
#include "SimpleRegion.h"
#include "SoftCPU.h"
+#include <AK/Debug.h>
#include <AK/Format.h>
#include <AK/LexicalPath.h>
#include <AK/MappedFile.h>
@@ -59,8 +60,6 @@
# pragma GCC optimize("O3")
#endif
-// #define DEBUG_SPAM
-
namespace UserspaceEmulator {
static constexpr u32 stack_location = 0x10000000;
@@ -344,7 +343,7 @@ void Emulator::dump_backtrace()
u32 Emulator::virt_syscall(u32 function, u32 arg1, u32 arg2, u32 arg3)
{
-#ifdef DEBUG_SPAM
+#if DEBUG_SPAM
reportln("Syscall: {} ({:x})", Syscall::to_string((Syscall::Function)function), function);
#endif
switch (function) {
diff --git a/Userland/Libraries/LibCore/Gzip.cpp b/Userland/Libraries/LibCore/Gzip.cpp
index afa2bb6319..a2fc706cc1 100644
--- a/Userland/Libraries/LibCore/Gzip.cpp
+++ b/Userland/Libraries/LibCore/Gzip.cpp
@@ -52,7 +52,7 @@ static Optional<ByteBuffer> get_gzip_payload(const ByteBuffer& data)
return data[current++];
};
-#ifdef DEBUG_GZIP
+#if DEBUG_GZIP
dbgln("get_gzip_payload: Skipping over gzip header.");
#endif
@@ -135,7 +135,7 @@ Optional<ByteBuffer> Gzip::decompress(const ByteBuffer& data)
source.data(), &source_len);
if (puff_ret == 0) {
-#ifdef DEBUG_GZIP
+#if DEBUG_GZIP
dbgln("Gzip::decompress: Decompression success.");
#endif
destination.trim(destination_len);
@@ -144,7 +144,7 @@ Optional<ByteBuffer> Gzip::decompress(const ByteBuffer& data)
if (puff_ret == 1) {
// FIXME: Find a better way of decompressing without needing to try over and over again.
-#ifdef DEBUG_GZIP
+#if DEBUG_GZIP
dbgln("Gzip::decompress: Output buffer exhausted. Growing.");
#endif
destination.grow(destination.size() * 2);
diff --git a/Userland/Libraries/LibCore/NetworkJob.cpp b/Userland/Libraries/LibCore/NetworkJob.cpp
index 1c981e3ad9..8a9827d94d 100644
--- a/Userland/Libraries/LibCore/NetworkJob.cpp
+++ b/Userland/Libraries/LibCore/NetworkJob.cpp
@@ -68,7 +68,7 @@ void NetworkJob::did_fail(Error error)
NonnullRefPtr<NetworkJob> protector(*this);
m_error = error;
-#ifdef CNETWORKJOB_DEBUG
+#if CNETWORKJOB_DEBUG
dbgprintf("%s{%p} job did_fail! error: %u (%s)\n", class_name(), this, (unsigned)error, to_string(error));
#endif
ASSERT(on_finish);
diff --git a/Userland/Libraries/LibCrypto/NumberTheory/ModularFunctions.cpp b/Userland/Libraries/LibCrypto/NumberTheory/ModularFunctions.cpp
index 71f16d284e..c939bfb6c5 100644
--- a/Userland/Libraries/LibCrypto/NumberTheory/ModularFunctions.cpp
+++ b/Userland/Libraries/LibCrypto/NumberTheory/ModularFunctions.cpp
@@ -221,7 +221,7 @@ UnsignedBigInteger LCM(const UnsignedBigInteger& a, const UnsignedBigInteger& b)
GCD_without_allocation(a, b, temp_a, temp_b, temp_1, temp_2, temp_3, temp_4, temp_quotient, temp_remainder, gcd_output);
if (gcd_output == 0) {
-#ifdef NT_DEBUG
+#if NT_DEBUG
dbgln("GCD is zero");
#endif
return output;
diff --git a/Userland/Libraries/LibDebug/DebugInfo.cpp b/Userland/Libraries/LibDebug/DebugInfo.cpp
index 0cc00b6284..04285c7c5d 100644
--- a/Userland/Libraries/LibDebug/DebugInfo.cpp
+++ b/Userland/Libraries/LibDebug/DebugInfo.cpp
@@ -25,6 +25,7 @@
*/
#include "DebugInfo.h"
+#include <AK/Debug.h>
#include <AK/LexicalPath.h>
#include <AK/MemoryStream.h>
#include <AK/QuickSort.h>
@@ -32,8 +33,6 @@
#include <LibDebug/Dwarf/DwarfInfo.h>
#include <LibDebug/Dwarf/Expression.h>
-//#define DEBUG_SPAM
-
namespace Debug {
DebugInfo::DebugInfo(NonnullOwnPtr<const ELF::Image> elf, String source_root, FlatPtr base_address)
@@ -63,13 +62,13 @@ void DebugInfo::parse_scopes_impl(const Dwarf::DIE& die)
return;
if (child.get_attribute(Dwarf::Attribute::Inline).has_value()) {
-#ifdef DEBUG_SPAM
+#if DEBUG_SPAM
dbgln("DWARF inlined functions are not supported");
#endif
return;
}
if (child.get_attribute(Dwarf::Attribute::Ranges).has_value()) {
-#ifdef DEBUG_SPAM
+#if DEBUG_SPAM
dbgln("DWARF ranges are not supported");
#endif
return;
@@ -82,7 +81,7 @@ void DebugInfo::parse_scopes_impl(const Dwarf::DIE& die)
scope.name = name.value().data.as_string;
if (!child.get_attribute(Dwarf::Attribute::LowPc).has_value()) {
-#ifdef DEBUG_SPAM
+#if DEBUG_SPAM
dbgln("DWARF: Couldn't find attribute LowPc for scope");
#endif
return;
diff --git a/Userland/Libraries/LibDebug/Dwarf/LineProgram.cpp b/Userland/Libraries/LibDebug/Dwarf/LineProgram.cpp
index 180c0f7c95..9dab951d2f 100644
--- a/Userland/Libraries/LibDebug/Dwarf/LineProgram.cpp
+++ b/Userland/Libraries/LibDebug/Dwarf/LineProgram.cpp
@@ -48,7 +48,7 @@ void LineProgram::parse_unit_header()
ASSERT(m_unit_header.version == DWARF_VERSION);
ASSERT(m_unit_header.opcode_base == SPECIAL_OPCODES_BASE);
-#ifdef DWARF_DEBUG
+#if DWARF_DEBUG
dbgln("unit length: {}", m_unit_header.length);
#endif
}
@@ -60,7 +60,7 @@ void LineProgram::parse_source_directories()
while (m_stream.peek_or_error()) {
String directory;
m_stream >> directory;
-#ifdef DWARF_DEBUG
+#if DWARF_DEBUG
dbgln("directory: {}", directory);
#endif
m_source_directories.append(move(directory));
@@ -81,7 +81,7 @@ void LineProgram::parse_source_files()
size_t _unused = 0;
m_stream.read_LEB128_unsigned(_unused); // skip modification time
m_stream.read_LEB128_unsigned(_unused); // skip file size
-#ifdef DWARF_DEBUG
+#if DWARF_DEBUG
dbgln("file: {}, directory index: {}", file_name, directory_index);
#endif
m_source_files.append({ file_name, directory_index });
@@ -92,7 +92,7 @@ void LineProgram::parse_source_files()
void LineProgram::append_to_line_info()
{
-#ifdef DWARF_DEBUG
+#if DWARF_DEBUG
dbgln("appending line info: {:p}, {}:{}", m_address, m_source_files[m_file_index].name, m_line);
#endif
if (!m_is_statement)
@@ -133,20 +133,20 @@ void LineProgram::handle_extended_opcode()
case ExtendedOpcodes::SetAddress: {
ASSERT(length == sizeof(size_t) + 1);
m_stream >> m_address;
-#ifdef DWARF_DEBUG
+#if DWARF_DEBUG
dbgln("SetAddress: {:p}", m_address);
#endif
break;
}
case ExtendedOpcodes::SetDiscriminator: {
-#ifdef DWARF_DEBUG
+#if DWARF_DEBUG
dbgln("SetDiscriminator");
#endif
m_stream.discard_or_error(1);
break;
}
default:
-#ifdef DWARF_DEBUG
+#if DWARF_DEBUG
dbgln("offset: {:p}", m_stream.offset());
#endif
ASSERT_NOT_REACHED();
@@ -163,7 +163,7 @@ void LineProgram::handle_standard_opcode(u8 opcode)
size_t operand = 0;
m_stream.read_LEB128_unsigned(operand);
size_t delta = operand * m_unit_header.min_instruction_length;
-#ifdef DWARF_DEBUG
+#if DWARF_DEBUG
dbgln("AdvancePC by: {} to: {:p}", delta, m_address + delta);
#endif
m_address += delta;
@@ -172,7 +172,7 @@ void LineProgram::handle_standard_opcode(u8 opcode)
case StandardOpcodes::SetFile: {
size_t new_file_index = 0;
m_stream.read_LEB128_unsigned(new_file_index);
-#ifdef DWARF_DEBUG
+#if DWARF_DEBUG
dbgln("SetFile: new file index: {}", new_file_index);
#endif
m_file_index = new_file_index;
@@ -180,7 +180,7 @@ void LineProgram::handle_standard_opcode(u8 opcode)
}
case StandardOpcodes::SetColumn: {
// not implemented
-#ifdef DWARF_DEBUG
+#if DWARF_DEBUG
dbgln("SetColumn");
#endif
size_t new_column;
@@ -193,13 +193,13 @@ void LineProgram::handle_standard_opcode(u8 opcode)
m_stream.read_LEB128_signed(line_delta);
ASSERT(line_delta >= 0 || m_line >= (size_t)(-line_delta));
m_line += line_delta;
-#ifdef DWARF_DEBUG
+#if DWARF_DEBUG
dbgln("AdvanceLine: {}", m_line);
#endif
break;
}
case StandardOpcodes::NegateStatement: {
-#ifdef DWARF_DEBUG
+#if DWARF_DEBUG
dbgln("NegateStatement");
#endif
m_is_statement = !m_is_statement;
@@ -209,7 +209,7 @@ void LineProgram::handle_standard_opcode(u8 opcode)
u8 adjusted_opcode = 255 - SPECIAL_OPCODES_BASE;
ssize_t address_increment = (adjusted_opcode / m_unit_header.line_range) * m_unit_header.min_instruction_length;
address_increment *= m_unit_header.min_instruction_length;
-#ifdef DWARF_DEBUG
+#if DWARF_DEBUG
dbgln("ConstAddPc: advance pc by: {} to: {}", address_increment, (m_address + address_increment));
#endif
m_address += address_increment;
diff --git a/Userland/Libraries/LibGemini/Job.cpp b/Userland/Libraries/LibGemini/Job.cpp
index ee75cdc742..5cad2399f9 100644
--- a/Userland/Libraries/LibGemini/Job.cpp
+++ b/Userland/Libraries/LibGemini/Job.cpp
@@ -152,7 +152,7 @@ void Job::on_socket_connected()
});
if (!is_established()) {
-#ifdef JOB_DEBUG
+#if JOB_DEBUG
dbgln("Connection appears to have closed, finishing up");
#endif
finish_up();
diff --git a/Userland/Libraries/LibGfx/GIFLoader.cpp b/Userland/Libraries/LibGfx/GIFLoader.cpp
index 1e625986e9..0418244d93 100644
--- a/Userland/Libraries/LibGfx/GIFLoader.cpp
+++ b/Userland/Libraries/LibGfx/GIFLoader.cpp
@@ -355,7 +355,7 @@ static bool decode_frame(GIFLoadingContext& context, size_t frame_index)
while (true) {
Optional<u16> code = decoder.next_code();
if (!code.has_value()) {
-#ifdef GIF_DEBUG
+#if GIF_DEBUG
dbgln("Unexpectedly reached end of gif frame data");
#endif
return false;
@@ -504,7 +504,7 @@ static bool load_gif_frame_descriptors(GIFLoadingContext& context)
if (extension_type == 0xF9) {
if (sub_block.size() != 4) {
-#ifdef GIF_DEBUG
+#if GIF_DEBUG
dbgln("Unexpected graphic control size");
#endif
continue;
diff --git a/Userland/Libraries/LibGfx/JPGLoader.cpp b/Userland/Libraries/LibGfx/JPGLoader.cpp
index 8994b3c26d..33f03daeeb 100644
--- a/Userland/Libraries/LibGfx/JPGLoader.cpp
+++ b/Userland/Libraries/LibGfx/JPGLoader.cpp
@@ -267,7 +267,7 @@ static Optional<u8> get_next_symbol(HuffmanStreamState& hstream, const HuffmanTa
}
}
-#ifdef JPG_DEBUG
+#if JPG_DEBUG
dbgln("If you're seeing this...the jpeg decoder needs to support more kinds of JPEGs!");
#endif
return {};
diff --git a/Userland/Libraries/LibGfx/PNGLoader.cpp b/Userland/Libraries/LibGfx/PNGLoader.cpp
index fd0b32fdd0..868cf1f0ab 100644
--- a/Userland/Libraries/LibGfx/PNGLoader.cpp
+++ b/Userland/Libraries/LibGfx/PNGLoader.cpp
@@ -526,7 +526,7 @@ static bool decode_png_header(PNGLoadingContext& context)
return true;
if (!context.data || context.data_size < sizeof(png_header)) {
-#ifdef PNG_DEBUG
+#if PNG_DEBUG
dbgln("Missing PNG header");
#endif
context.state = PNGLoadingContext::State::Error;
@@ -534,7 +534,7 @@ static bool decode_png_header(PNGLoadingContext& context)
}
if (memcmp(context.data, png_header, sizeof(png_header)) != 0) {
-#ifdef PNG_DEBUG
+#if PNG_DEBUG
dbgln("Invalid PNG header");
#endif
context.state = PNGLoadingContext::State::Error;
@@ -874,7 +874,7 @@ static bool process_IHDR(ReadonlyBytes data, PNGLoadingContext& context)
context.filter_method = ihdr.filter_method;
context.interlace_method = ihdr.interlace_method;
-#ifdef PNG_DEBUG
+#if PNG_DEBUG
printf("PNG: %dx%d (%d bpp)\n", context.width, context.height, context.bit_depth);
printf(" Color type: %d\n", context.color_type);
printf("Compress Method: %d\n", context.compression_method);
@@ -883,7 +883,7 @@ static bool process_IHDR(ReadonlyBytes data, PNGLoadingContext& context)
#endif
if (context.interlace_method != PngInterlaceMethod::Null && context.interlace_method != PngInterlaceMethod::Adam7) {
-#ifdef PNG_DEBUG
+#if PNG_DEBUG
dbgln("PNGLoader::process_IHDR: unknown interlace method: {}", context.interlace_method);
#endif
return false;
@@ -947,7 +947,7 @@ static bool process_chunk(Streamer& streamer, PNGLoadingContext& context)
{
u32 chunk_size;
if (!streamer.read(chunk_size)) {
-#ifdef PNG_DEBUG
+#if PNG_DEBUG
printf("Bail at chunk_size\n");
#endif
return false;
@@ -955,26 +955,26 @@ static bool process_chunk(Streamer& streamer, PNGLoadingContext& context)
u8 chunk_type[5];
chunk_type[4] = '\0';
if (!streamer.read_bytes(chunk_type, 4)) {
-#ifdef PNG_DEBUG
+#if PNG_DEBUG
printf("Bail at chunk_type\n");
#endif
return false;
}
ReadonlyBytes chunk_data;
if (!streamer.wrap_bytes(chunk_data, chunk_size)) {
-#ifdef PNG_DEBUG
+#if PNG_DEBUG
printf("Bail at chunk_data\n");
#endif
return false;
}
u32 chunk_crc;
if (!streamer.read(chunk_crc)) {
-#ifdef PNG_DEBUG
+#if PNG_DEBUG
printf("Bail at chunk_crc\n");
#endif
return false;
}
-#ifdef PNG_DEBUG
+#if PNG_DEBUG
printf("Chunk type: '%s', size: %u, crc: %x\n", chunk_type, chunk_size, chunk_crc);
#endif
diff --git a/Userland/Libraries/LibGfx/Painter.cpp b/Userland/Libraries/LibGfx/Painter.cpp
index e98cec2c8a..89dc36b6e9 100644
--- a/Userland/Libraries/LibGfx/Painter.cpp
+++ b/Userland/Libraries/LibGfx/Painter.cpp
@@ -1620,7 +1620,7 @@ void Painter::fill_path(Path& path, Color color, WindingRule winding_rule)
quick_sort(active_list, [](const auto& line0, const auto& line1) {
return line1.x < line0.x;
});
-#ifdef FILL_PATH_DEBUG
+#if FILL_PATH_DEBUG
if ((int)scanline % 10 == 0) {
draw_text(IntRect(active_list.last().x - 20, scanline, 20, 10), String::number((int)scanline));
}
@@ -1692,7 +1692,7 @@ void Painter::fill_path(Path& path, Color color, WindingRule winding_rule)
}
}
-#ifdef FILL_PATH_DEBUG
+#if FILL_PATH_DEBUG
size_t i { 0 };
for (auto& segment : segments) {
draw_line(Point<int>(segment.from), Point<int>(segment.to), Color::from_hsv(i++ * 360.0 / segments.size(), 1.0, 1.0), 1);
diff --git a/Userland/Libraries/LibHTTP/Job.cpp b/Userland/Libraries/LibHTTP/Job.cpp
index 707cd3efbd..0c69848dab 100644
--- a/Userland/Libraries/LibHTTP/Job.cpp
+++ b/Userland/Libraries/LibHTTP/Job.cpp
@@ -331,7 +331,7 @@ void Job::on_socket_connected()
});
if (!is_established()) {
-#ifdef JOB_DEBUG
+#if JOB_DEBUG
dbgln("Connection appears to have closed, finishing up");
#endif
finish_up();
diff --git a/Userland/Libraries/LibMarkdown/Text.cpp b/Userland/Libraries/LibMarkdown/Text.cpp
index 9361e05d60..21d167874a 100644
--- a/Userland/Libraries/LibMarkdown/Text.cpp
+++ b/Userland/Libraries/LibMarkdown/Text.cpp
@@ -24,13 +24,12 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include <AK/Debug.h>
#include <AK/ScopeGuard.h>
#include <AK/StringBuilder.h>
#include <LibMarkdown/Text.h>
#include <string.h>
-//#define DEBUG_MARKDOWN
-
namespace Markdown {
static String unescape(const StringView& text)
@@ -243,7 +242,7 @@ Optional<Text> Text::parse(const StringView& str)
current_link_is_actually_img = true;
break;
case '[':
-#ifdef DEBUG_MARKDOWN
+#if DEBUG_MARKDOWN
if (first_span_in_the_current_link != -1)
dbgln("Dropping the outer link");
#endif
@@ -251,7 +250,7 @@ Optional<Text> Text::parse(const StringView& str)
break;
case ']': {
if (first_span_in_the_current_link == -1) {
-#ifdef DEBUG_MARKDOWN
+#if DEBUG_MARKDOWN
dbgln("Unmatched ]");
#endif
continue;
diff --git a/Userland/Libraries/LibRegex/RegexDebug.h b/Userland/Libraries/LibRegex/RegexDebug.h
index c90c587d29..5b48fc8a2d 100644
--- a/Userland/Libraries/LibRegex/RegexDebug.h
+++ b/Userland/Libraries/LibRegex/RegexDebug.h
@@ -28,10 +28,9 @@
#include "AK/StringBuilder.h"
#include "LibRegex/RegexMatcher.h"
+#include <AK/Debug.h>
-//#define REGEX_DEBUG
-
-#ifdef REGEX_DEBUG
+#if REGEX_DEBUG
namespace regex {
diff --git a/Userland/Libraries/LibRegex/RegexLexer.cpp b/Userland/Libraries/LibRegex/RegexLexer.cpp
index c7e154e307..e61708a4c4 100644
--- a/Userland/Libraries/LibRegex/RegexLexer.cpp
+++ b/Userland/Libraries/LibRegex/RegexLexer.cpp
@@ -26,6 +26,7 @@
#include "RegexLexer.h"
#include <AK/Assertions.h>
+#include <AK/Debug.h>
#include <AK/LogStream.h>
#include <stdio.h>
@@ -150,7 +151,7 @@ Token Lexer::next()
case '\\':
return 2;
default:
-#ifdef REGEX_DEBUG
+#if REGEX_DEBUG
fprintf(stderr, "[LEXER] Found invalid escape sequence: \\%c (the parser will have to deal with this!)\n", peek(1));
#endif
return 0;
diff --git a/Userland/Libraries/LibRegex/RegexMatcher.cpp b/Userland/Libraries/LibRegex/RegexMatcher.cpp
index 14c461fbb4..cadc74fece 100644
--- a/Userland/Libraries/LibRegex/RegexMatcher.cpp
+++ b/Userland/Libraries/LibRegex/RegexMatcher.cpp
@@ -34,7 +34,7 @@
namespace regex {
-#ifdef REGEX_DEBUG
+#if REGEX_DEBUG
static RegexDebug s_regex_dbg(stderr);
#endif
@@ -138,7 +138,7 @@ RegexResult Matcher<Parser>::match(const Vector<RegexStringView> views, Optional
}
};
-#ifdef REGEX_DEBUG
+#if REGEX_DEBUG
s_regex_dbg.print_header();
#endif
@@ -314,7 +314,7 @@ Optional<bool> Matcher<Parser>::execute(const MatchInput& input, MatchState& sta
return {};
}
-#ifdef REGEX_DEBUG
+#if REGEX_DEBUG
s_regex_dbg.print_opcode("VM", *opcode, state, recursion_level, false);
#endif
@@ -326,7 +326,7 @@ Optional<bool> Matcher<Parser>::execute(const MatchInput& input, MatchState& sta
result = opcode->execute(input, state, output);
}
-#ifdef REGEX_DEBUG
+#if REGEX_DEBUG
s_regex_dbg.print_result(*opcode, bytecode, input, state, result);
#endif
@@ -369,14 +369,14 @@ ALWAYS_INLINE Optional<bool> Matcher<Parser>::execute_low_prio_forks(const Match
for (auto& state : states) {
state.instruction_position = state.fork_at_position;
-#ifdef REGEX_DEBUG
+#if REGEX_DEBUG
fprintf(stderr, "Forkstay... ip = %lu, sp = %lu\n", state.instruction_position, state.string_position);
#endif
auto success = execute(input, state, output, recursion_level);
if (!success.has_value())
return {};
if (success.value()) {
-#ifdef REGEX_DEBUG
+#if REGEX_DEBUG
fprintf(stderr, "Forkstay succeeded... ip = %lu, sp = %lu\n", state.instruction_position, state.string_position);
#endif
original_state = state;
diff --git a/Userland/Libraries/LibRegex/RegexParser.cpp b/Userland/Libraries/LibRegex/RegexParser.cpp
index ba82b3f9d8..6ed5e2e217 100644
--- a/Userland/Libraries/LibRegex/RegexParser.cpp
+++ b/Userland/Libraries/LibRegex/RegexParser.cpp
@@ -141,7 +141,7 @@ Parser::Result Parser::parse(Optional<AllOptions> regex_options)
else
set_error(Error::InvalidPattern);
-#ifdef REGEX_DEBUG
+#if REGEX_DEBUG
fprintf(stderr, "[PARSER] Produced bytecode with %lu entries (opcodes + arguments)\n", m_parser_state.bytecode.size());
#endif
return {
@@ -454,7 +454,7 @@ ALWAYS_INLINE bool PosixExtendedParser::parse_sub_expression(ByteCode& stack, si
if (match(TokenType::EscapeSequence)) {
length = 1;
Token t = consume();
-#ifdef REGEX_DEBUG
+#if REGEX_DEBUG
printf("[PARSER] EscapeSequence with substring %s\n", String(t.value()).characters());
#endif
diff --git a/Userland/Libraries/LibRegex/Tests/Regex.cpp b/Userland/Libraries/LibRegex/Tests/Regex.cpp
index fc920140d0..ffd585e8d3 100644
--- a/Userland/Libraries/LibRegex/Tests/Regex.cpp
+++ b/Userland/Libraries/LibRegex/Tests/Regex.cpp
@@ -376,7 +376,7 @@ TEST_CASE(ini_file_entries)
Regex<PosixExtended> re("[[:alpha:]]*=([[:digit:]]*)|\\[(.*)\\]");
RegexResult result;
-#ifdef REGEX_DEBUG
+#if REGEX_DEBUG
RegexDebug regex_dbg(stderr);
regex_dbg.print_raw_bytecode(re);
regex_dbg.print_header();
@@ -387,7 +387,7 @@ TEST_CASE(ini_file_entries)
EXPECT_EQ(re.search(haystack.view(), result, PosixFlags::Multiline), true);
EXPECT_EQ(result.count, 3u);
-#ifdef REGEX_DEBUG
+#if REGEX_DEBUG
for (auto& v : result.matches)
fprintf(stderr, "%s\n", v.view.to_string().characters());
#endif
@@ -425,7 +425,7 @@ TEST_CASE(named_capture_group)
Regex<PosixExtended> re("[[:alpha:]]*=(?<Test>[[:digit:]]*)");
RegexResult result;
-#ifdef REGEX_DEBUG
+#if REGEX_DEBUG
RegexDebug regex_dbg(stderr);
regex_dbg.print_raw_bytecode(re);
regex_dbg.print_header();
@@ -446,7 +446,7 @@ TEST_CASE(a_star)
Regex<PosixExtended> re("a*");
RegexResult result;
-#ifdef REGEX_DEBUG
+#if REGEX_DEBUG
RegexDebug regex_dbg(stderr);
regex_dbg.print_raw_bytecode(re);
regex_dbg.print_header();
@@ -506,7 +506,7 @@ TEST_CASE(ECMA262_parse)
for (auto& test : tests) {
Regex<ECMA262> re(test.pattern);
EXPECT_EQ(re.parser_result.error, test.expected_error);
-#ifdef REGEX_DEBUG
+#if REGEX_DEBUG
dbgln("\n");
RegexDebug regex_dbg(stderr);
regex_dbg.print_raw_bytecode(re);
@@ -551,7 +551,7 @@ TEST_CASE(ECMA262_match)
for (auto& test : tests) {
Regex<ECMA262> re(test.pattern, test.options);
-#ifdef REGEX_DEBUG
+#if REGEX_DEBUG
dbgln("\n");
RegexDebug regex_dbg(stderr);
regex_dbg.print_raw_bytecode(re);
@@ -584,7 +584,7 @@ TEST_CASE(replace)
for (auto& test : tests) {
Regex<ECMA262> re(test.pattern, test.options);
-#ifdef REGEX_DEBUG
+#if REGEX_DEBUG
dbgln("\n");
RegexDebug regex_dbg(stderr);
regex_dbg.print_raw_bytecode(re);
diff --git a/Userland/Libraries/LibTLS/ClientHandshake.cpp b/Userland/Libraries/LibTLS/ClientHandshake.cpp
index ddd754e785..99ebc72822 100644
--- a/Userland/Libraries/LibTLS/ClientHandshake.cpp
+++ b/Userland/Libraries/LibTLS/ClientHandshake.cpp
@@ -91,7 +91,7 @@ ssize_t TLSv12::handle_hello(ReadonlyBytes buffer, WritePacketStage& write_packe
if (session_length && session_length <= 32) {
memcpy(m_context.session_id, buffer.offset_pointer(res), session_length);
m_context.session_id_size = session_length;
-#ifdef TLS_DEBUG
+#if TLS_DEBUG
dbgln("Remote session ID:");
print_buffer(ReadonlyBytes { m_context.session_id, session_length });
#endif
@@ -228,7 +228,7 @@ ssize_t TLSv12::handle_finished(ReadonlyBytes buffer, WritePacketStage& write_pa
}
// TODO: Compare Hashes
-#ifdef TLS_DEBUG
+#if TLS_DEBUG
dbgln("FIXME: handle_finished :: Check message validity");
#endif
m_context.connection_status = ConnectionStatus::Established;
@@ -276,7 +276,7 @@ void TLSv12::build_random(PacketBuilder& builder)
}
auto& certificate = m_context.certificates[certificate_option.value()];
-#ifdef TLS_DEBUG
+#if TLS_DEBUG
dbgln("PreMaster secret");
print_buffer(m_context.premaster_key);
#endif
@@ -287,7 +287,7 @@ void TLSv12::build_random(PacketBuilder& builder)
auto outbuf = Bytes { out, rsa.output_size() };
rsa.encrypt(m_context.premaster_key, outbuf);
-#ifdef TLS_DEBUG
+#if TLS_DEBUG
dbgln("Encrypted: ");
print_buffer(outbuf);
#endif
@@ -305,7 +305,7 @@ void TLSv12::build_random(PacketBuilder& builder)
ssize_t TLSv12::handle_payload(ReadonlyBytes vbuffer)
{
if (m_context.connection_status == ConnectionStatus::Established) {
-#ifdef TLS_DEBUG
+#if TLS_DEBUG
dbgln("Renegotiation attempt ignored");
#endif
// FIXME: We should properly say "NoRenegotiation", but that causes a handshake failure
@@ -359,7 +359,7 @@ ssize_t TLSv12::handle_payload(ReadonlyBytes vbuffer)
break;
}
++m_context.handshake_messages[2];
-#ifdef TLS_DEBUG
+#if TLS_DEBUG
dbgln("server hello");
#endif
if (m_context.is_server) {
@@ -380,7 +380,7 @@ ssize_t TLSv12::handle_payload(ReadonlyBytes vbuffer)
break;
}
++m_context.handshake_messages[4];
-#ifdef TLS_DEBUG
+#if TLS_DEBUG
dbgln("certificate");
#endif
if (m_context.connection_status == ConnectionStatus::Negotiating) {
@@ -415,7 +415,7 @@ ssize_t TLSv12::handle_payload(ReadonlyBytes vbuffer)
break;
}
++m_context.handshake_messages[5];
-#ifdef TLS_DEBUG
+#if TLS_DEBUG
dbgln("server key exchange");
#endif
if (m_context.is_server) {
@@ -451,7 +451,7 @@ ssize_t TLSv12::handle_payload(ReadonlyBytes vbuffer)
break;
}
++m_context.handshake_messages[7];
-#ifdef TLS_DEBUG
+#if TLS_DEBUG
dbgln("server hello done");
#endif
if (m_context.is_server) {
@@ -470,7 +470,7 @@ ssize_t TLSv12::handle_payload(ReadonlyBytes vbuffer)
break;
}
++m_context.handshake_messages[8];
-#ifdef TLS_DEBUG
+#if TLS_DEBUG
dbgln("certificate verify");
#endif
if (m_context.connection_status == ConnectionStatus::KeyExchange) {
@@ -486,7 +486,7 @@ ssize_t TLSv12::handle_payload(ReadonlyBytes vbuffer)
break;
}
++m_context.handshake_messages[9];
-#ifdef TLS_DEBUG
+#if TLS_DEBUG
dbgln("client key exchange");
#endif
if (m_context.is_server) {
@@ -506,7 +506,7 @@ ssize_t TLSv12::handle_payload(ReadonlyBytes vbuffer)
break;
}
++m_context.handshake_messages[10];
-#ifdef TLS_DEBUG
+#if TLS_DEBUG
dbgln("finished");
#endif
payload_res = handle_finished(buffer.slice(1, payload_size), write_packets);
@@ -593,7 +593,7 @@ ssize_t TLSv12::handle_payload(ReadonlyBytes vbuffer)
break;
case WritePacketStage::ClientHandshake:
if (m_context.client_verified == VerificationNeeded) {
-#ifdef TLS_DEBUG
+#if TLS_DEBUG
dbgln("> Client Certificate");
#endif
auto packet = build_certificate();
@@ -601,14 +601,14 @@ ssize_t TLSv12::handle_payload(ReadonlyBytes vbuffer)
m_context.client_verified = Verified;
}
{
-#ifdef TLS_DEBUG
+#if TLS_DEBUG
dbgln("> Key exchange");
#endif
auto packet = build_client_key_exchange();
write_packet(packet);
}
{
-#ifdef TLS_DEBUG
+#if TLS_DEBUG
dbgln("> change cipher spec");
#endif
auto packet = build_change_cipher_spec();
@@ -617,7 +617,7 @@ ssize_t TLSv12::handle_payload(ReadonlyBytes vbuffer)
m_context.cipher_spec_set = 1;
m_context.local_sequence_number = 0;
{
-#ifdef TLS_DEBUG
+#if TLS_DEBUG
dbgln("> client finished");
#endif
auto packet = build_finished();
@@ -633,14 +633,14 @@ ssize_t TLSv12::handle_payload(ReadonlyBytes vbuffer)
case WritePacketStage::Finished:
// finished
{
-#ifdef TLS_DEBUG
+#if TLS_DEBUG
dbgln("> change cipher spec");
#endif
auto packet = build_change_cipher_spec();
write_packet(packet);
}
{
-#ifdef TLS_DEBUG
+#if TLS_DEBUG
dbgln("> client finished");
#endif
auto packet = build_finished();
diff --git a/Userland/Libraries/LibTLS/Exchange.cpp b/Userland/Libraries/LibTLS/Exchange.cpp
index de10d568af..9f3ea55eb9 100644
--- a/Userland/Libraries/LibTLS/Exchange.cpp
+++ b/Userland/Libraries/LibTLS/Exchange.cpp
@@ -24,6 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include <AK/Debug.h>
#include <LibCrypto/ASN1/DER.h>
#include <LibCrypto/PK/Code/EMSA_PSS.h>
#include <LibTLS/TLSv12.h>
@@ -72,7 +73,7 @@ bool TLSv12::expand_key()
auto server_iv = key + offset;
offset += iv_size;
-#ifdef TLS_DEBUG
+#if TLS_DEBUG
dbgln("client key");
print_buffer(client_key, key_size);
dbgln("server key");
@@ -171,7 +172,7 @@ bool TLSv12::compute_master_secret(size_t length)
ReadonlyBytes { m_context.remote_random, sizeof(m_context.remote_random) });
m_context.premaster_key.clear();
-#ifdef TLS_DEBUG
+#if TLS_DEBUG
dbgln("master key:");
print_buffer(m_context.master_key);
#endif
@@ -213,7 +214,7 @@ ByteBuffer TLSv12::build_certificate()
builder.append((u8)HandshakeType::CertificateMessage);
if (!total_certificate_size) {
-#ifdef TLS_DEBUG
+#if TLS_DEBUG
dbgln("No certificates, sending empty certificate message");
#endif
builder.append_u24(certificate_vector_header_size);
diff --git a/Userland/Libraries/LibTLS/Record.cpp b/Userland/Libraries/LibTLS/Record.cpp
index 1850e03818..5cdb816fa9 100644
--- a/Userland/Libraries/LibTLS/Record.cpp
+++ b/Userland/Libraries/LibTLS/Record.cpp
@@ -200,7 +200,7 @@ ByteBuffer TLSv12::hmac_message(const ReadonlyBytes& buf, const Optional<Readonl
u64 sequence_number = AK::convert_between_host_and_network_endian(local ? m_context.local_sequence_number : m_context.remote_sequence_number);
ensure_hmac(mac_length, local);
auto& hmac = local ? *m_hmac_local : *m_hmac_remote;
-#ifdef TLS_DEBUG
+#if TLS_DEBUG
dbgln("========================= PACKET DATA ==========================");
print_buffer((const u8*)&sequence_number, sizeof(u64));
print_buffer(buf.data(), buf.size());
@@ -344,7 +344,7 @@ ssize_t TLSv12::handle_message(ReadonlyBytes buffer)
length = decrypted_span.size();
-#ifdef TLS_DEBUG
+#if TLS_DEBUG
dbgln("Decrypted: ");
print_buffer(decrypted);
#endif
@@ -395,7 +395,7 @@ ssize_t TLSv12::handle_message(ReadonlyBytes buffer)
}
break;
case MessageType::Handshake:
-#ifdef TLS_DEBUG
+#if TLS_DEBUG
dbgln("tls handshake message");
#endif
payload_res = handle_payload(plain);
@@ -406,7 +406,7 @@ ssize_t TLSv12::handle_message(ReadonlyBytes buffer)
auto packet = build_alert(true, (u8)AlertDescription::UnexpectedMessage);
payload_res = (i8)Error::UnexpectedMessage;
} else {
-#ifdef TLS_DEBUG
+#if TLS_DEBUG
dbgln("change cipher spec message");
#endif
m_context.cipher_spec_set = true;
diff --git a/Userland/Libraries/LibTLS/Socket.cpp b/Userland/Libraries/LibTLS/Socket.cpp
index bf38aaa7b5..93b58064de 100644
--- a/Userland/Libraries/LibTLS/Socket.cpp
+++ b/Userland/Libraries/LibTLS/Socket.cpp
@@ -77,7 +77,7 @@ String TLSv12::read_line(size_t max_size)
bool TLSv12::write(ReadonlyBytes buffer)
{
if (m_context.connection_status != ConnectionStatus::Established) {
-#ifdef TLS_DEBUG
+#if TLS_DEBUG
dbgln("write request while not connected");
#endif
return false;
@@ -193,7 +193,7 @@ bool TLSv12::check_connection_state(bool read)
{
if (!Core::Socket::is_open() || !Core::Socket::is_connected() || Core::Socket::eof()) {
// an abrupt closure (the server is a jerk)
-#ifdef TLS_DEBUG
+#if TLS_DEBUG
dbgln("Socket not open, assuming abrupt closure");
#endif
m_context.connection_finished = true;
@@ -216,7 +216,7 @@ bool TLSv12::check_connection_state(bool read)
m_context.application_buffer.size());
} else {
m_context.connection_finished = false;
-#ifdef TLS_DEBUG
+#if TLS_DEBUG
dbgln("FINISHED");
#endif
}
@@ -237,7 +237,7 @@ bool TLSv12::flush()
if (out_buffer_length == 0)
return true;
-#ifdef TLS_DEBUG
+#if TLS_DEBUG
dbgln("SENDING...");
print_buffer(out_buffer, out_buffer_length);
#endif
diff --git a/Userland/Libraries/LibTLS/TLSv12.cpp b/Userland/Libraries/LibTLS/TLSv12.cpp
index 06d4a0072e..62534771dc 100644
--- a/Userland/Libraries/LibTLS/TLSv12.cpp
+++ b/Userland/Libraries/LibTLS/TLSv12.cpp
@@ -208,7 +208,7 @@ static ssize_t _parse_asn1(const Context& context, Certificate& cert, const u8*
size_t length = _get_asn1_length((const u8*)&buffer[position], size - position, octets);
if (octets > 4 || octets > size - position) {
-#ifdef TLS_DEBUG
+#if TLS_DEBUG
dbgln("could not read the certificate");
#endif
return position;
@@ -216,7 +216,7 @@ static ssize_t _parse_asn1(const Context& context, Certificate& cert, const u8*
position += octets;
if (size - position < length) {
-#ifdef TLS_DEBUG
+#if TLS_DEBUG
dbgln("not enough data for sequence");
#endif
return (i8)Error::NeedMoreData;
@@ -415,7 +415,7 @@ static ssize_t _parse_asn1(const Context& context, Certificate& cert, const u8*
auto fingerprint = hash.digest();
cert.fingerprint.grow(fingerprint.data_length());
cert.fingerprint.overwrite(0, fingerprint.immutable_data(), fingerprint.data_length());
-#ifdef TLS_DEBUG
+#if TLS_DEBUG
dbgln("Certificate fingerprint:");
print_buffer(cert.fingerprint);
#endif
@@ -446,7 +446,7 @@ ssize_t TLSv12::handle_certificate(ReadonlyBytes buffer)
ssize_t res = 0;
if (buffer.size() < 3) {
-#ifdef TLS_DEBUG
+#if TLS_DEBUG
dbgln("not enough certificate header data");
#endif
return (i8)Error::NeedMoreData;
@@ -462,7 +462,7 @@ ssize_t TLSv12::handle_certificate(ReadonlyBytes buffer)
res += 3;
if (certificate_total_length > buffer.size() - res) {
-#ifdef TLS_DEBUG
+#if TLS_DEBUG
dbgln("not enough data for claimed total cert length");
#endif
return (i8)Error::NeedMoreData;
@@ -475,7 +475,7 @@ ssize_t TLSv12::handle_certificate(ReadonlyBytes buffer)
while (size > 0) {
++index;
if (buffer.size() - res < 3) {
-#ifdef TLS_DEBUG
+#if TLS_DEBUG
dbgln("not enough data for certificate length");
#endif
return (i8)Error::NeedMoreData;
@@ -484,7 +484,7 @@ ssize_t TLSv12::handle_certificate(ReadonlyBytes buffer)
res += 3;
if (buffer.size() - res < certificate_size) {
-#ifdef TLS_DEBUG
+#if TLS_DEBUG
dbgln("not enough data for certificate body");
#endif
return (i8)Error::NeedMoreData;
diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.cpp b/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.cpp
index 28213ffe62..2ea70af30c 100644
--- a/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.cpp
+++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.cpp
@@ -36,7 +36,7 @@ namespace Web::HTML {
#pragma GCC diagnostic ignored "-Wunused-label"
-#ifdef TOKENIZER_TRACE
+#if TOKENIZER_TRACE
# define PARSE_ERROR() \
do { \
dbgln("Parse error (tokenization) {} @ {}", __PRETTY_FUNCTION__, __LINE__) \
diff --git a/Userland/Libraries/LibWeb/Loader/Resource.cpp b/Userland/Libraries/LibWeb/Loader/Resource.cpp
index be5f38a5fd..666654a05f 100644
--- a/Userland/Libraries/LibWeb/Loader/Resource.cpp
+++ b/Userland/Libraries/LibWeb/Loader/Resource.cpp
@@ -94,7 +94,7 @@ void Resource::did_load(Badge<ResourceLoader>, ReadonlyBytes data, const HashMap
auto content_type = headers.get("Content-Type");
if (content_type.has_value()) {
-#ifdef RESOURCE_DEBUG
+#if RESOURCE_DEBUG
dbgln("Content-Type header: '{}'", content_type.value());
#endif
m_encoding = encoding_from_content_type(content_type.value());
@@ -104,7 +104,7 @@ void Resource::did_load(Badge<ResourceLoader>, ReadonlyBytes data, const HashMap
m_encoding = "utf-8"; // FIXME: This doesn't seem nice.
m_mime_type = url().data_mime_type();
} else {
-#ifdef RESOURCE_DEBUG
+#if RESOURCE_DEBUG
dbgln("No Content-Type header to go on! Guessing based on filename...");
#endif
m_encoding = "utf-8"; // FIXME: This doesn't seem nice.
diff --git a/Userland/Libraries/LibWeb/WebContentClient.cpp b/Userland/Libraries/LibWeb/WebContentClient.cpp
index c98418e1ef..4a4a56085d 100644
--- a/Userland/Libraries/LibWeb/WebContentClient.cpp
+++ b/Userland/Libraries/LibWeb/WebContentClient.cpp
@@ -64,7 +64,7 @@ void WebContentClient::handle(const Messages::WebContentClient::DidInvalidateCon
void WebContentClient::handle(const Messages::WebContentClient::DidChangeSelection&)
{
-#ifdef DEBUG_SPAM
+#if DEBUG_SPAM
dbgln("handle: WebContentClient::DidChangeSelection!");
#endif
m_view.notify_server_did_change_selection({});
@@ -96,7 +96,7 @@ void WebContentClient::handle(const Messages::WebContentClient::DidHoverLink& me
void WebContentClient::handle(const Messages::WebContentClient::DidUnhoverLink&)
{
-#ifdef DEBUG_SPAM
+#if DEBUG_SPAM
dbgln("handle: WebContentClient::DidUnhoverLink!");
#endif
m_view.notify_server_did_unhover_link({});
diff --git a/Userland/Services/ImageDecoder/ClientConnection.cpp b/Userland/Services/ImageDecoder/ClientConnection.cpp
index e6cb73cbfb..9b7115c0e2 100644
--- a/Userland/Services/ImageDecoder/ClientConnection.cpp
+++ b/Userland/Services/ImageDecoder/ClientConnection.cpp
@@ -61,7 +61,7 @@ OwnPtr<Messages::ImageDecoderServer::DecodeImageResponse> ClientConnection::hand
{
auto encoded_buffer = message.data();
if (!encoded_buffer.is_valid()) {
-#ifdef IMAGE_DECODER_DEBUG
+#if IMAGE_DECODER_DEBUG
dbgln("Encoded data is invalid");
#endif
return {};
@@ -71,7 +71,7 @@ OwnPtr<Messages::ImageDecoderServer::DecodeImageResponse> ClientConnection::hand
auto bitmap = decoder->bitmap();
if (!bitmap) {
-#ifdef IMAGE_DECODER_DEBUG
+#if IMAGE_DECODER_DEBUG
dbgln("Could not decode image from encoded data");
#endif
return make<Messages::ImageDecoderServer::DecodeImageResponse>(Gfx::ShareableBitmap());
diff --git a/Userland/Services/WindowServer/Compositor.cpp b/Userland/Services/WindowServer/Compositor.cpp
index 38156ac218..b9beeaec47 100644
--- a/Userland/Services/WindowServer/Compositor.cpp
+++ b/Userland/Services/WindowServer/Compositor.cpp
@@ -863,7 +863,7 @@ void Compositor::recompute_occlusions()
return IterationDecision::Continue;
});
-#ifdef OCCLUSIONS_DEBUG
+#if OCCLUSIONS_DEBUG
dbgln("OCCLUSIONS:");
#endif
diff --git a/Userland/Services/WindowServer/Screen.cpp b/Userland/Services/WindowServer/Screen.cpp
index dac462cc52..a10ab03d60 100644
--- a/Userland/Services/WindowServer/Screen.cpp
+++ b/Userland/Services/WindowServer/Screen.cpp
@@ -144,12 +144,12 @@ void Screen::on_receive_mouse_data(const MousePacket& packet)
auto prev_location = m_physical_cursor_location / m_scale_factor;
if (packet.is_relative) {
m_physical_cursor_location.move_by(packet.x * m_acceleration_factor, packet.y * m_acceleration_factor);
-#ifdef WSSCREEN_DEBUG
+#if WSSCREEN_DEBUG
dbgln("Screen: New Relative mouse point @ {}", m_physical_cursor_location);
#endif
} else {
m_physical_cursor_location = { packet.x * physical_width() / 0xffff, packet.y * physical_height() / 0xffff };
-#ifdef WSSCREEN_DEBUG
+#if WSSCREEN_DEBUG
dbgln("Screen: New Absolute mouse point @ {}", m_physical_cursor_location);
#endif
}