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

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
This commit is contained in:
asynts 2021-01-23 23:29:11 +01:00 committed by Andreas Kling
parent 76f2918416
commit 1a3a0836c0
59 changed files with 475 additions and 459 deletions

View file

@ -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 {

View file

@ -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;

View file

@ -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;

View file

@ -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

View file

@ -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);