diff options
author | Kenneth Myhra <kennethmyhra@gmail.com> | 2021-11-27 21:18:01 +0100 |
---|---|---|
committer | Brian Gianforcaro <b.gianfo@gmail.com> | 2021-12-11 15:10:42 -0800 |
commit | 7cb19b2965eea1816d00e8677ef85bd89c95f1fa (patch) | |
tree | 90bbc7aa9a923b2f6568781d0f02ae584568a54b | |
parent | 121fe820d9b90b82ce4d74d2a534a1a5ea9aaa5d (diff) | |
download | serenity-7cb19b2965eea1816d00e8677ef85bd89c95f1fa.zip |
cpp-processor: Port to LibMain :^)
-rw-r--r-- | Userland/Utilities/CMakeLists.txt | 1 | ||||
-rw-r--r-- | Userland/Utilities/cpp-preprocessor.cpp | 7 |
2 files changed, 6 insertions, 2 deletions
diff --git a/Userland/Utilities/CMakeLists.txt b/Userland/Utilities/CMakeLists.txt index c61fdedd42..421fccfe7b 100644 --- a/Userland/Utilities/CMakeLists.txt +++ b/Userland/Utilities/CMakeLists.txt @@ -75,6 +75,7 @@ target_link_libraries(copy LibGUI LibMain) target_link_libraries(cp LibMain) target_link_libraries(cpp-lexer LibMain) target_link_libraries(cpp-parser LibMain) +target_link_libraries(cpp-preprocessor LibMain) target_link_libraries(diff LibDiff) target_link_libraries(disasm LibX86) target_link_libraries(dmesg LibMain) diff --git a/Userland/Utilities/cpp-preprocessor.cpp b/Userland/Utilities/cpp-preprocessor.cpp index 2266315359..834e80db8c 100644 --- a/Userland/Utilities/cpp-preprocessor.cpp +++ b/Userland/Utilities/cpp-preprocessor.cpp @@ -8,15 +8,16 @@ #include <LibCore/ArgsParser.h> #include <LibCore/File.h> #include <LibCpp/Preprocessor.h> +#include <LibMain/Main.h> -int main(int argc, char** argv) +ErrorOr<int> serenity_main(Main::Arguments arguments) { Core::ArgsParser args_parser; const char* path = nullptr; bool print_definitions = false; args_parser.add_positional_argument(path, "File", "file", Core::ArgsParser::Required::Yes); args_parser.add_option(print_definitions, "Print preprocessor definitions", "definitions", 'D'); - args_parser.parse(argc, argv); + args_parser.parse(arguments); auto file = Core::File::construct(path); if (!file->open(Core::OpenMode::ReadOnly)) { warnln("Failed to open {}: {}", path, file->error_string()); @@ -41,4 +42,6 @@ int main(int argc, char** argv) for (auto& token : tokens) { outln("{}", token.to_string()); } + + return 0; } |