diff --git a/Userland/Libraries/LibCpp/Preprocessor.cpp b/Userland/Libraries/LibCpp/Preprocessor.cpp index ca93915521..d8ffcc7a46 100644 --- a/Userland/Libraries/LibCpp/Preprocessor.cpp +++ b/Userland/Libraries/LibCpp/Preprocessor.cpp @@ -184,8 +184,11 @@ void Preprocessor::handle_preprocessor_line(const StringView& line) lexer.consume_all(); return; } - dbgln("Unsupported preprocessor keyword: {}", keyword); - VERIFY_NOT_REACHED(); + + if (!m_options.ignore_unsupported_keywords) { + dbgln("Unsupported preprocessor keyword: {}", keyword); + VERIFY_NOT_REACHED(); + } } const String& Preprocessor::processed_text() diff --git a/Userland/Libraries/LibCpp/Preprocessor.h b/Userland/Libraries/LibCpp/Preprocessor.h index f1c75ecf7e..3c4095d1a4 100644 --- a/Userland/Libraries/LibCpp/Preprocessor.h +++ b/Userland/Libraries/LibCpp/Preprocessor.h @@ -52,6 +52,8 @@ public: const Definitions& definitions() const { return m_definitions; } + void set_ignore_unsupported_keywords(bool ignore) { m_options.ignore_unsupported_keywords = ignore; } + private: void handle_preprocessor_line(const StringView&); @@ -74,5 +76,9 @@ private: Vector m_included_paths; String m_processed_text; + + struct Options { + bool ignore_unsupported_keywords { false }; + } m_options; }; }