1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-11 18:20:43 +09:00

Everywhere: Turn #if *_DEBUG into dbgln_if/if constexpr

This commit is contained in:
Gunnar Beutner 2021-05-01 21:10:08 +02:00 committed by Andreas Kling
parent 4e6f03a860
commit 6cf59b6ae9
Notes: sideshowbarker 2024-07-18 18:47:59 +09:00
58 changed files with 315 additions and 469 deletions

View file

@ -14,6 +14,10 @@
#include <ctype.h>
#include <stdio.h>
#ifndef GENERATE_DEBUG_CODE
# define GENERATE_DEBUG_CODE 0
#endif
struct Parameter {
Vector<String> attributes;
String type;
@ -444,22 +448,22 @@ public:
stream >> message_endpoint_magic;
if (stream.handle_any_error()) {
)~~~");
#if GENERATE_DEBUG_CODE
endpoint_generator.append(R"~~~(
dbgln("Failed to read message endpoint magic");
if constexpr (GENERATE_DEBUG_CODE) {
endpoint_generator.append(R"~~~(
dbgln("Failed to read message endpoint magic");
)~~~");
#endif
}
endpoint_generator.append(R"~~~(
return {};
}
if (message_endpoint_magic != @endpoint.magic@) {
)~~~");
#if GENERATE_DEBUG_CODE
endpoint_generator.append(R"~~~(
dbgln("@endpoint.name@: Endpoint magic number message_endpoint_magic != @endpoint.magic@, not my message! (the other endpoint may have handled it)");
if constexpr (GENERATE_DEBUG_CODE) {
endpoint_generator.append(R"~~~(
dbgln("@endpoint.name@: Endpoint magic number message_endpoint_magic != @endpoint.magic@, not my message! (the other endpoint may have handled it)");
)~~~");
#endif
}
endpoint_generator.append(R"~~~(
return {};
}
@ -468,11 +472,11 @@ public:
stream >> message_id;
if (stream.handle_any_error()) {
)~~~");
#if GENERATE_DEBUG_CODE
endpoint_generator.append(R"~~~(
dbgln("Failed to read message ID");
if constexpr (GENERATE_DEBUG_CODE) {
endpoint_generator.append(R"~~~(
dbgln("Failed to read message ID");
)~~~");
#endif
}
endpoint_generator.append(R"~~~(
return {};
}
@ -502,22 +506,22 @@ public:
endpoint_generator.append(R"~~~(
default:
)~~~");
#if GENERATE_DEBUG_CODE
endpoint_generator.append(R"~~~(
dbgln("Failed to decode @endpoint.name@.({})", message_id);
if constexpr (GENERATE_DEBUG_CODE) {
endpoint_generator.append(R"~~~(
dbgln("Failed to decode @endpoint.name@.({})", message_id);
)~~~");
#endif
}
endpoint_generator.append(R"~~~(
return {};
}
if (stream.handle_any_error()) {
)~~~");
#if GENERATE_DEBUG_CODE
endpoint_generator.append(R"~~~(
dbgln("Failed to read the message");
if constexpr (GENERATE_DEBUG_CODE) {
endpoint_generator.append(R"~~~(
dbgln("Failed to read the message");
)~~~");
#endif
}
endpoint_generator.append(R"~~~(
return {};
}