1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 07:07:44 +00:00

Everywhere: Debug macros instead of constexpr.

This was done with the following script:

    find . \( -name '*.cpp' -o -name '*.h' -o -name '*.in' \) -not -path './Toolchain/*' -not -path './Build/*' -exec sed -i -E 's/dbgln<debug_([a-z_]+)>/dbgln<\U\1_DEBUG>/' {} \;

    find . \( -name '*.cpp' -o -name '*.h' -o -name '*.in' \) -not -path './Toolchain/*' -not -path './Build/*' -exec sed -i -E 's/if constexpr \(debug_([a-z0-9_]+)/if constexpr \(\U\1_DEBUG/' {} \;
This commit is contained in:
asynts 2021-01-23 23:59:27 +01:00 committed by Andreas Kling
parent bb483f7ef4
commit 8465683dcf
98 changed files with 414 additions and 972 deletions

View file

@ -406,7 +406,7 @@ int main(int argc, char** argv)
interface->fully_qualified_name = interface->name;
}
if constexpr (debug_wrapper_generator) {
if constexpr (WRAPPER_GENERATOR_DEBUG) {
dbgln("Attributes:");
for (auto& attribute : interface->attributes) {
dbgln(" {}{}{} {}",

View file

@ -141,7 +141,7 @@ void HTMLDocumentParser::run(const URL& url)
break;
auto& token = optional_token.value();
dbgln<debug_parser>("[{}] {}", insertion_mode_name(), token.to_string());
dbgln<PARSER_DEBUG>("[{}] {}", insertion_mode_name(), token.to_string());
// FIXME: If the adjusted current node is a MathML text integration point and the token is a start tag whose tag name is neither "mglyph" nor "malignmark"
// FIXME: If the adjusted current node is a MathML text integration point and the token is a character token
@ -157,7 +157,7 @@ void HTMLDocumentParser::run(const URL& url)
}
if (m_stop_parsing) {
dbgln<debug_parser>("Stop parsing{}! :^)", m_parsing_fragment ? " fragment" : "");
dbgln<PARSER_DEBUG>("Stop parsing{}! :^)", m_parsing_fragment ? " fragment" : "");
break;
}
}

View file

@ -36,10 +36,10 @@ namespace Web::HTML {
#pragma GCC diagnostic ignored "-Wunused-label"
#if TOKENIZER_TRACE
# define PARSE_ERROR() \
do { \
dbgln("Parse error (tokenization) {} @ {}", __PRETTY_FUNCTION__, __LINE__) \
#if TOKENIZER_TRACE_DEBUG
# define PARSE_ERROR() \
do { \
dbgln("Parse error (tokenization) {} @ {}", __PRETTY_FUNCTION__, __LINE__); \
} while (0)
#else
# define PARSE_ERROR()
@ -221,7 +221,7 @@ Optional<u32> HTMLTokenizer::next_code_point()
return {};
m_prev_utf8_iterator = m_utf8_iterator;
++m_utf8_iterator;
dbgln<debug_trace_tokenizer>("(Tokenizer) Next code_point: {}", (char)*m_prev_utf8_iterator);
dbgln<TOKENIZER_TRACE_DEBUG>("(Tokenizer) Next code_point: {}", (char)*m_prev_utf8_iterator);
return *m_prev_utf8_iterator;
}
@ -2618,17 +2618,17 @@ HTMLTokenizer::HTMLTokenizer(const StringView& input, const String& encoding)
void HTMLTokenizer::will_switch_to([[maybe_unused]] State new_state)
{
dbgln<debug_trace_tokenizer>("[{}] Switch to {}", state_name(m_state), state_name(new_state));
dbgln<TOKENIZER_TRACE_DEBUG>("[{}] Switch to {}", state_name(m_state), state_name(new_state));
}
void HTMLTokenizer::will_reconsume_in([[maybe_unused]] State new_state)
{
dbgln<debug_trace_tokenizer>("[{}] Reconsume in {}", state_name(m_state), state_name(new_state));
dbgln<TOKENIZER_TRACE_DEBUG>("[{}] Reconsume in {}", state_name(m_state), state_name(new_state));
}
void HTMLTokenizer::switch_to(Badge<HTMLDocumentParser>, State new_state)
{
dbgln<debug_trace_tokenizer>("[{}] Parser switches tokenizer state to {}", state_name(m_state), state_name(new_state));
dbgln<TOKENIZER_TRACE_DEBUG>("[{}] Parser switches tokenizer state to {}", state_name(m_state), state_name(new_state));
m_state = new_state;
}

View file

@ -72,7 +72,7 @@ void ImageLoader::resource_did_load()
m_loading_state = LoadingState::Loaded;
if constexpr (debug_image_loader) {
if constexpr (IMAGE_LOADER_DEBUG) {
if (!resource()->has_encoded_data()) {
dbgln("ImageLoader: Resource did load, no encoded data. URL: {}", resource()->url());
} else {

View file

@ -100,7 +100,7 @@ void Resource::did_load(Badge<ResourceLoader>, ReadonlyBytes data, const HashMap
m_encoding = encoding_from_content_type(content_type.value());
m_mime_type = mime_type_from_content_type(content_type.value());
} else if (url().protocol() == "data" && !url().data_mime_type().is_empty()) {
dbgln<debug_resource>("This is a data URL with mime-type _{}_", url().data_mime_type());
dbgln<RESOURCE_DEBUG>("This is a data URL with mime-type _{}_", url().data_mime_type());
m_encoding = "utf-8"; // FIXME: This doesn't seem nice.
m_mime_type = url().data_mime_type();
} else {

View file

@ -86,7 +86,7 @@ RefPtr<Resource> ResourceLoader::load_resource(Resource::Type type, const LoadRe
if (it->value->type() != type) {
dbgln("FIXME: Not using cached resource for {} since there's a type mismatch.", request.url());
} else {
dbgln<debug_cache>("Reusing cached resource for: {}", request.url());
dbgln<CACHE_DEBUG>("Reusing cached resource for: {}", request.url());
return it->value;
}
}

View file

@ -38,7 +38,7 @@ namespace Web::SVG {
static void print_instruction(const PathInstruction& instruction)
{
ASSERT(debug_path);
ASSERT(PATH_DEBUG);
auto& data = instruction.data;
@ -463,7 +463,7 @@ Gfx::Path& SVGPathElement::get_path()
auto& absolute = instruction.absolute;
auto& data = instruction.data;
if constexpr (debug_path) {
if constexpr (PATH_DEBUG) {
print_instruction(instruction);
}

View file

@ -56,7 +56,7 @@ void WebContentClient::handle([[maybe_unused]] const Messages::WebContentClient:
void WebContentClient::handle(const Messages::WebContentClient::DidInvalidateContentRect& message)
{
dbgln<debug_spam>("handle: WebContentClient::DidInvalidateContentRect! content_rect={}", message.content_rect());
dbgln<SPAM_DEBUG>("handle: WebContentClient::DidInvalidateContentRect! content_rect={}", message.content_rect());
// FIXME: Figure out a way to coalesce these messages to reduce unnecessary painting
m_view.notify_server_did_invalidate_content_rect({}, message.content_rect());
@ -72,25 +72,25 @@ void WebContentClient::handle(const Messages::WebContentClient::DidChangeSelecti
void WebContentClient::handle(const Messages::WebContentClient::DidLayout& message)
{
dbgln<debug_spam>("handle: WebContentClient::DidLayout! content_size={}", message.content_size());
dbgln<SPAM_DEBUG>("handle: WebContentClient::DidLayout! content_size={}", message.content_size());
m_view.notify_server_did_layout({}, message.content_size());
}
void WebContentClient::handle(const Messages::WebContentClient::DidChangeTitle& message)
{
dbgln<debug_spam>("handle: WebContentClient::DidChangeTitle! title={}", message.title());
dbgln<SPAM_DEBUG>("handle: WebContentClient::DidChangeTitle! title={}", message.title());
m_view.notify_server_did_change_title({}, message.title());
}
void WebContentClient::handle(const Messages::WebContentClient::DidRequestScrollIntoView& message)
{
dbgln<debug_spam>("handle: WebContentClient::DidRequestScrollIntoView! rect={}", message.rect());
dbgln<SPAM_DEBUG>("handle: WebContentClient::DidRequestScrollIntoView! rect={}", message.rect());
m_view.notify_server_did_request_scroll_into_view({}, message.rect());
}
void WebContentClient::handle(const Messages::WebContentClient::DidHoverLink& message)
{
dbgln<debug_spam>("handle: WebContentClient::DidHoverLink! url={}", message.url());
dbgln<SPAM_DEBUG>("handle: WebContentClient::DidHoverLink! url={}", message.url());
m_view.notify_server_did_hover_link({}, message.url());
}