From 4afefc5a82a79716928c8f6130f015858ccc7011 Mon Sep 17 00:00:00 2001 From: Ziemas Date: Sat, 17 Feb 2024 20:14:23 +0100 Subject: [PATCH] Update to C++20 (#3193) Just putting this here for consideration, I'm personally not in a big rush to get it. --------- Co-authored-by: Tyler Wilding --- CMakeLists.txt | 4 +- common/global_profiler/GlobalProfiler.h | 1 + common/log/log.h | 4 +- common/type_system/TypeSystem.cpp | 2 +- common/util/FileUtil.cpp | 2 +- common/util/Trie.h | 2 +- decompiler/Function/Warnings.h | 4 +- decompiler/IR2/Form.h | 2 +- decompiler/IR2/GenericElementMatcher.cpp | 4 + decompiler/IR2/GenericElementMatcher.h | 2 +- decompiler/IR2/OpenGoalMapping.cpp | 2 +- decompiler/VuDisasm/VuDisassembler.cpp | 128 ++++++++++--------- decompiler/data/streamed_audio.cpp | 2 +- decompiler/extractor/extractor_util.cpp | 2 +- decompiler/level_extractor/extract_tfrag.cpp | 2 - decompiler/util/Error.h | 4 +- goalc/compiler/StaticObject.cpp | 3 +- goalc/make/MakeSystem.cpp | 6 +- goalc/make/Tools.cpp | 2 +- 19 files changed, 95 insertions(+), 83 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 718c11770..4909a72ed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ # Top Level CMakeLists.txt cmake_minimum_required(VERSION 3.10) -set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD 20) project(jak) include(CTest) @@ -39,7 +39,6 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") -fcxx-exceptions \ -fexceptions \ -fdiagnostics-color=always \ - -std=c++17 \ -mavx \ -Wall \ -Wno-c++11-narrowing \ @@ -217,7 +216,6 @@ build_third_party_lib(sqlite3 sqlite3) # build tree-sitter parser include_directories(third-party/tree-sitter/tree-sitter/lib/include) -include_directories(third-party/tree-sitter/tree-sitter-opengoal/include) build_third_party_lib(tree-sitter tree-sitter) # native OS dialogs for error messages diff --git a/common/global_profiler/GlobalProfiler.h b/common/global_profiler/GlobalProfiler.h index 98b23c8c8..e00f279d2 100644 --- a/common/global_profiler/GlobalProfiler.h +++ b/common/global_profiler/GlobalProfiler.h @@ -34,6 +34,7 @@ class GlobalProfiler { }; struct ScopedEvent { + ScopedEvent(GlobalProfiler* _prof) : prof(_prof){}; ScopedEvent(const ScopedEvent&) = delete; ScopedEvent& operator=(const ScopedEvent&) = delete; GlobalProfiler* prof = nullptr; diff --git a/common/log/log.h b/common/log/log.h index a80dc1713..027988586 100644 --- a/common/log/log.h +++ b/common/log/log.h @@ -61,13 +61,13 @@ void log(level log_level, const std::string& format, Args&&... args) { #else now.tim = time(nullptr); #endif - std::string formatted_message = fmt::format(format, std::forward(args)...); + std::string formatted_message = fmt::format(fmt::runtime(format), std::forward(args)...); internal::log_message(log_level, now, formatted_message.c_str()); } template void print(const std::string& format, Args&&... args) { - std::string formatted_message = fmt::format(format, std::forward(args)...); + std::string formatted_message = fmt::format(fmt::runtime(format), std::forward(args)...); internal::log_print(formatted_message.c_str()); } template diff --git a/common/type_system/TypeSystem.cpp b/common/type_system/TypeSystem.cpp index 9f94ae658..82154bd49 100644 --- a/common/type_system/TypeSystem.cpp +++ b/common/type_system/TypeSystem.cpp @@ -28,7 +28,7 @@ template } throw std::runtime_error( - fmt::format("Type Error: {}", fmt::format(str, std::forward(args)...))); + fmt::format("Type Error: {}", fmt::format(fmt::runtime(str), std::forward(args)...))); } } // namespace diff --git a/common/util/FileUtil.cpp b/common/util/FileUtil.cpp index f9f062656..0d7527599 100644 --- a/common/util/FileUtil.cpp +++ b/common/util/FileUtil.cpp @@ -386,7 +386,7 @@ std::string split_path_at(const fs::path& path, const std::vector& split_str += folder + "/"; #endif } - const auto& path_str = path.u8string(); + const auto& path_str = path.string(); return path_str.substr(path_str.find(split_str) + split_str.length()); } diff --git a/common/util/Trie.h b/common/util/Trie.h index 6b808ba62..d108bfeb8 100644 --- a/common/util/Trie.h +++ b/common/util/Trie.h @@ -150,7 +150,7 @@ class Trie { }; template -Trie::~Trie() { +Trie::~Trie() { m_root.delete_children(); m_size = 0; } diff --git a/decompiler/Function/Warnings.h b/decompiler/Function/Warnings.h index 0e4ef69dc..628a2a333 100644 --- a/decompiler/Function/Warnings.h +++ b/decompiler/Function/Warnings.h @@ -36,7 +36,7 @@ class DecompWarnings { template void error_and_throw(const std::string& str, Args&&... args) { - auto text = fmt::format(str, std::forward(args)...); + auto text = fmt::format(fmt::runtime(str), std::forward(args)...); _warning(Warning::Kind::ERR, false, text); throw std::runtime_error(text); } @@ -99,7 +99,7 @@ class DecompWarnings { template void _warning(Warning::Kind kind, bool unique, const std::string& str, Args&&... args) { - std::string msg = fmt::format(str, std::forward(args)...); + std::string msg = fmt::format(fmt::runtime(str), std::forward(args)...); if (unique) { if (unique_warnings.find(msg) != unique_warnings.end()) { return; diff --git a/decompiler/IR2/Form.h b/decompiler/IR2/Form.h index 0ee046302..a311c2be6 100644 --- a/decompiler/IR2/Form.h +++ b/decompiler/IR2/Form.h @@ -1819,7 +1819,7 @@ class DefpartElement : public FormElement { case GameVersion::Jak2: return field_id == 72; default: - ASSERT_MSG(false, fmt::format("unknown version {} for is_sp_end")); + ASSERT_MSG(false, fmt::format("unknown version for is_sp_end")); return false; } } diff --git a/decompiler/IR2/GenericElementMatcher.cpp b/decompiler/IR2/GenericElementMatcher.cpp index d52f01809..e559e6dd3 100644 --- a/decompiler/IR2/GenericElementMatcher.cpp +++ b/decompiler/IR2/GenericElementMatcher.cpp @@ -36,6 +36,10 @@ Matcher Matcher::reg(Register reg) { return m; } +Matcher Matcher::s6() { + return Matcher::reg(Register(Reg::GPR, Reg::S6)); +} + Matcher Matcher::op(const GenericOpMatcher& op, const std::vector& args) { Matcher m; m.m_kind = Kind::GENERIC_OP; diff --git a/decompiler/IR2/GenericElementMatcher.h b/decompiler/IR2/GenericElementMatcher.h index d73abfa51..6ba41f32e 100644 --- a/decompiler/IR2/GenericElementMatcher.h +++ b/decompiler/IR2/GenericElementMatcher.h @@ -39,7 +39,7 @@ class Matcher { static Matcher var_name(const std::string& name); static Matcher any_label(int match_id = -1); static Matcher reg(Register reg); - static inline Matcher s6() { return Matcher::reg(Register(Reg::GPR, Reg::S6)); } + static Matcher s6(); static Matcher op(const GenericOpMatcher& op, const std::vector& args); static Matcher func(const Matcher& match, const std::vector& args); static Matcher func(const std::string& name, const std::vector& args); diff --git a/decompiler/IR2/OpenGoalMapping.cpp b/decompiler/IR2/OpenGoalMapping.cpp index 071c41cbc..ab1b56a92 100644 --- a/decompiler/IR2/OpenGoalMapping.cpp +++ b/decompiler/IR2/OpenGoalMapping.cpp @@ -204,7 +204,7 @@ std::string OpenGOALAsm::full_function_name() { if (func.allows_modifier(MOD::BROADCAST)) { if (m_instr.cop2_bc != 0xff) { std::string bc = std::string(1, m_instr.cop2_bc_to_char()); - func_name = fmt::format(func_name, bc); + func_name = fmt::format(fmt::runtime(func_name), bc); } } return func_name; diff --git a/decompiler/VuDisasm/VuDisassembler.cpp b/decompiler/VuDisasm/VuDisassembler.cpp index b45ddf181..97182486c 100644 --- a/decompiler/VuDisasm/VuDisassembler.cpp +++ b/decompiler/VuDisasm/VuDisassembler.cpp @@ -646,24 +646,26 @@ std::string VuDisassembler::to_cpp(const VuInstruction& instr, bool mips2c_forma instr.dst->to_string(m_label_names), instr.src.at(0).to_string(m_label_names)); } else if (instr.src.at(0).value() == 0) { - return fmt::format(mips2c_format ? "lq_buffer(Mask::{}, c->vfs[{}].vf, vis[{}]);" - : "lq_buffer(Mask::{}, vu.{}, vu.{});", - mask_to_string(*instr.mask), instr.dst->to_string(m_label_names), - instr.src.at(1).to_string(m_label_names)); + return fmt::format( + fmt::runtime(mips2c_format ? "lq_buffer(Mask::{}, c->vfs[{}].vf, vis[{}]);" + : "lq_buffer(Mask::{}, vu.{}, vu.{});"), + mask_to_string(*instr.mask), instr.dst->to_string(m_label_names), + instr.src.at(1).to_string(m_label_names)); } else { - return fmt::format(mips2c_format ? "lq_buffer(Mask::{}, c->vfs[{}].vf, vis[{}] + {});" - : "lq_buffer(Mask::{}, vu.{}, vu.{} + {});", - mask_to_string(*instr.mask), instr.dst->to_string(m_label_names), - instr.src.at(1).to_string(m_label_names), - instr.src.at(0).to_string(m_label_names)); + return fmt::format( + fmt::runtime(mips2c_format ? "lq_buffer(Mask::{}, c->vfs[{}].vf, vis[{}] + {});" + : "lq_buffer(Mask::{}, vu.{}, vu.{} + {});"), + mask_to_string(*instr.mask), instr.dst->to_string(m_label_names), + instr.src.at(1).to_string(m_label_names), instr.src.at(0).to_string(m_label_names)); } goto unknown; case VuInstrK::LQI: ASSERT(!instr.src.at(0).is_int_reg(0)); - return fmt::format(mips2c_format ? "lq_buffer(Mask::{}, c->vfs[{}].vf, vis[{}]++);" - : "lq_buffer(Mask::{}, vu.{}, vu.{}++);", - mask_to_string(*instr.mask), instr.dst->to_string(m_label_names), - instr.src.at(0).to_string(m_label_names)); + return fmt::format( + fmt::runtime(mips2c_format ? "lq_buffer(Mask::{}, c->vfs[{}].vf, vis[{}]++);" + : "lq_buffer(Mask::{}, vu.{}, vu.{}++);"), + mask_to_string(*instr.mask), instr.dst->to_string(m_label_names), + instr.src.at(0).to_string(m_label_names)); case VuInstrK::SQI: ASSERT(!instr.src.at(0).is_int_reg(0)); if (mips2c_format) { @@ -682,16 +684,18 @@ std::string VuDisassembler::to_cpp(const VuInstruction& instr, bool mips2c_forma instr.dst->to_string(m_label_names), instr.src.at(0).to_string(m_label_names)); } else if (instr.src.at(0).value() == 0) { - return fmt::format(mips2c_format ? "sq_buffer(Mask::{}, c->vf_src({}).vf, vis[{}]);" - : "sq_buffer(Mask::{}, vu.{}, vu.{});", - mask_to_string(*instr.mask), instr.dst->to_string(m_label_names), - instr.src.at(1).to_string(m_label_names)); + return fmt::format( + fmt::runtime(mips2c_format ? "sq_buffer(Mask::{}, c->vf_src({}).vf, vis[{}]);" + : "sq_buffer(Mask::{}, vu.{}, vu.{});"), + + mask_to_string(*instr.mask), instr.dst->to_string(m_label_names), + instr.src.at(1).to_string(m_label_names)); } else { - return fmt::format(mips2c_format ? "sq_buffer(Mask::{}, c->vf_src({}).vf, vis[{}] + {});" - : "sq_buffer(Mask::{}, vu.{}, vu.{} + {});", - mask_to_string(*instr.mask), instr.dst->to_string(m_label_names), - instr.src.at(1).to_string(m_label_names), - instr.src.at(0).to_string(m_label_names)); + return fmt::format( + fmt::runtime(mips2c_format ? "sq_buffer(Mask::{}, c->vf_src({}).vf, vis[{}] + {});" + : "sq_buffer(Mask::{}, vu.{}, vu.{} + {});"), + mask_to_string(*instr.mask), instr.dst->to_string(m_label_names), + instr.src.at(1).to_string(m_label_names), instr.src.at(0).to_string(m_label_names)); } goto unknown; case VuInstrK::IADDI: @@ -774,10 +778,11 @@ std::string VuDisassembler::to_cpp(const VuInstruction& instr, bool mips2c_forma } case VuInstrK::MTIR: - return fmt::format( - mips2c_format ? "vis[{}] = c->vf_src({}).vf.{}_as_u16();" : "vu.{} = vu.{}.{}_as_u16();", - instr.dst->to_string(m_label_names), instr.src.at(0).to_string(m_label_names), - bc_to_part(*instr.first_src_field)); + return fmt::format(fmt::runtime(mips2c_format ? "vis[{}] = c->vf_src({}).vf.{}_as_u16();" + : "vu.{} = vu.{}.{}_as_u16();"), + instr.dst->to_string(m_label_names), + instr.src.at(0).to_string(m_label_names), + bc_to_part(*instr.first_src_field)); case VuInstrK::MFIR: return fmt::format("vu.{}.mfir(Mask::{}, vu.{});", instr.dst->to_string(m_label_names), @@ -821,10 +826,10 @@ std::string VuDisassembler::to_cpp(const VuInstruction& instr, bool mips2c_forma ASSERT(!instr.src.at(1).is_int_reg(0)); ASSERT(!instr.src.at(0).is_int_reg(0)); ASSERT(!instr.dst->is_int_reg(0)); - return fmt::format(mips2c_format ? "vis[{}] = vis[{}] + vis[{}];" : "vu.{} = vu.{} + vu.{};", - instr.dst->to_string(m_label_names), - instr.src.at(0).to_string(m_label_names), - instr.src.at(1).to_string(m_label_names)); + return fmt::format( + fmt::runtime(mips2c_format ? "vis[{}] = vis[{}] + vis[{}];" : "vu.{} = vu.{} + vu.{};"), + instr.dst->to_string(m_label_names), instr.src.at(0).to_string(m_label_names), + instr.src.at(1).to_string(m_label_names)); case VuInstrK::ISUB: return fmt::format("vu.{} = vu.{} - vu.{};", instr.dst->to_string(m_label_names), instr.src.at(0).to_string(m_label_names), @@ -864,15 +869,17 @@ std::string VuDisassembler::to_cpp(const VuInstruction& instr, bool mips2c_forma mask_to_string(*instr.mask)); case VuInstrK::MULq: - return fmt::format(mips2c_format ? "c->vfs[{}].vf.mul(Mask::{}, c->vf_src({}).vf, c->Q);" - : "vu.{}.mul(Mask::{}, vu.{}, vu.Q);", - instr.dst->to_string(m_label_names), mask_to_string(*instr.mask), - instr.src.at(0).to_string(m_label_names)); + return fmt::format( + fmt::runtime(mips2c_format ? "c->vfs[{}].vf.mul(Mask::{}, c->vf_src({}).vf, c->Q);" + : "vu.{}.mul(Mask::{}, vu.{}, vu.Q);"), + instr.dst->to_string(m_label_names), mask_to_string(*instr.mask), + instr.src.at(0).to_string(m_label_names)); case VuInstrK::MULi: - return fmt::format(mips2c_format ? "c->vfs[{}].vf.mul(Mask::{}, c->vf_src({}).vf, c->I);" - : "vu.{}.mul(Mask::{}, vu.{}, vu.I);", - instr.dst->to_string(m_label_names), mask_to_string(*instr.mask), - instr.src.at(0).to_string(m_label_names)); + return fmt::format( + fmt::runtime(mips2c_format ? "c->vfs[{}].vf.mul(Mask::{}, c->vf_src({}).vf, c->I);" + : "vu.{}.mul(Mask::{}, vu.{}, vu.I);"), + instr.dst->to_string(m_label_names), mask_to_string(*instr.mask), + instr.src.at(0).to_string(m_label_names)); case VuInstrK::DIV: return fmt::format( "vu.Q = vu.{}.{}() / vu.{}.{}();", instr.src.at(0).to_string(m_label_names), @@ -963,34 +970,36 @@ std::string VuDisassembler::to_cpp(const VuInstruction& instr, bool mips2c_forma vf_src(instr.src.at(1).to_string(m_label_names), mips2c_format)); case VuInstrK::ADDAbc: - return fmt::format(mips2c_format - ? "c->acc.vf.adda(Mask::{}, c->vfs[{}].vf, c->vfs[{}].vf.{}());" - : "vu.acc.adda(Mask::{}, vu.{}, vu.{}.{}());", - mask_to_string(*instr.mask), instr.dst->to_string(m_label_names), - instr.src.at(0).to_string(m_label_names), bc_to_part(*instr.bc)); + return fmt::format( + fmt::runtime(mips2c_format + ? "c->acc.vf.adda(Mask::{}, c->vfs[{}].vf, c->vfs[{}].vf.{}());" + : "vu.acc.adda(Mask::{}, vu.{}, vu.{}.{}());"), + mask_to_string(*instr.mask), instr.dst->to_string(m_label_names), + instr.src.at(0).to_string(m_label_names), bc_to_part(*instr.bc)); case VuInstrK::MADDA: return fmt::format("vu.acc.madda(Mask::{}, vu.{}, vu.{});", mask_to_string(*instr.mask), instr.src.at(0).to_string(m_label_names), instr.src.at(1).to_string(m_label_names)); case VuInstrK::MADDAbc: - return fmt::format(mips2c_format - ? "c->acc.vf.madda(Mask::{}, c->vfs[{}].vf, c->vfs[{}].vf.{}());" - : "vu.acc.madda(Mask::{}, vu.{}, vu.{}.{}());", - mask_to_string(*instr.mask), instr.src.at(0).to_string(m_label_names), - instr.src.at(1).to_string(m_label_names), bc_to_part(*instr.bc)); + return fmt::format( + fmt::runtime(mips2c_format + ? "c->acc.vf.madda(Mask::{}, c->vfs[{}].vf, c->vfs[{}].vf.{}());" + : "vu.acc.madda(Mask::{}, vu.{}, vu.{}.{}());"), + mask_to_string(*instr.mask), instr.src.at(0).to_string(m_label_names), + instr.src.at(1).to_string(m_label_names), bc_to_part(*instr.bc)); case VuInstrK::MADDbc: return fmt::format( - mips2c_format - ? "c->acc.vf.madd(Mask::{}, c->vfs[{}].vf, c->vf_src({}).vf, c->vf_src({}).vf.{}());" - : "vu.acc.madd(Mask::{}, vu.{}, vu.{}, vu.{}.{}());", + fmt::runtime(mips2c_format ? "c->acc.vf.madd(Mask::{}, c->vfs[{}].vf, c->vf_src({}).vf, " + "c->vf_src({}).vf.{}());" + : "vu.acc.madd(Mask::{}, vu.{}, vu.{}, vu.{}.{}());"), mask_to_string(*instr.mask), instr.dst->to_string(m_label_names), instr.src.at(0).to_string(m_label_names), instr.src.at(1).to_string(m_label_names), bc_to_part(*instr.bc)); case VuInstrK::MSUBbc: return fmt::format( - mips2c_format - ? "c->acc.vf.msub(Mask::{}, c->vfs[{}].vf, c->vf_src({}).vf, c->vf_src({}).vf.{}());" - : "vu.acc.msub(Mask::{}, vu.{}, vu.{}, vu.{}.{}());", + fmt::runtime(mips2c_format ? "c->acc.vf.msub(Mask::{}, c->vfs[{}].vf, c->vf_src({}).vf, " + "c->vf_src({}).vf.{}());" + : "vu.acc.msub(Mask::{}, vu.{}, vu.{}, vu.{}.{}());"), mask_to_string(*instr.mask), instr.dst->to_string(m_label_names), instr.src.at(0).to_string(m_label_names), instr.src.at(1).to_string(m_label_names), bc_to_part(*instr.bc)); @@ -1002,11 +1011,12 @@ std::string VuDisassembler::to_cpp(const VuInstruction& instr, bool mips2c_forma return fmt::format("vu.acc.mula(Mask::{}, vu.{}, vu.Q);", mask_to_string(*instr.mask), instr.src.at(0).to_string(m_label_names)); case VuInstrK::MULAbc: - return fmt::format(mips2c_format - ? "c->acc.vf.mula(Mask::{}, c->vf_src({}).vf, c->vf_src({}).vf.{}());" - : "vu.acc.mula(Mask::{}, vu.{}, vu.{}.{}());", - mask_to_string(*instr.mask), instr.src.at(0).to_string(m_label_names), - instr.src.at(1).to_string(m_label_names), bc_to_part(*instr.bc)); + return fmt::format( + fmt::runtime(mips2c_format + ? "c->acc.vf.mula(Mask::{}, c->vf_src({}).vf, c->vf_src({}).vf.{}());" + : "vu.acc.mula(Mask::{}, vu.{}, vu.{}.{}());"), + mask_to_string(*instr.mask), instr.src.at(0).to_string(m_label_names), + instr.src.at(1).to_string(m_label_names), bc_to_part(*instr.bc)); case VuInstrK::XGKICK: return fmt::format("xgkick(vu.{});", instr.src.at(0).to_string(m_label_names)); diff --git a/decompiler/data/streamed_audio.cpp b/decompiler/data/streamed_audio.cpp index 515dbe41a..86574b05b 100644 --- a/decompiler/data/streamed_audio.cpp +++ b/decompiler/data/streamed_audio.cpp @@ -266,7 +266,7 @@ void process_streamed_audio(const decompiler::Config& config, for (size_t lang_id = 0; lang_id < audio_files.size(); lang_id++) { auto& file = audio_files[lang_id]; auto wad_data = file_util::read_binary_file(input_dir / "VAG" / file); - auto suffix = fs::path(file).extension().u8string().substr(1); + auto suffix = fs::path(file).extension().string().substr(1); bool int_bank_p = suffix.compare("INT") == 0; langs.push_back(suffix); for (int i = 0; i < dir_data.entry_count(); i++) { diff --git a/decompiler/extractor/extractor_util.cpp b/decompiler/extractor/extractor_util.cpp index 7a3fc785f..73de70463 100644 --- a/decompiler/extractor/extractor_util.cpp +++ b/decompiler/extractor/extractor_util.cpp @@ -23,7 +23,7 @@ const std::unordered_map game_iso_territory_map = { std::string get_territory_name(int territory) { ASSERT_MSG(game_iso_territory_map.count(territory), - fmt::format("territory {} not found in territory name map")); + fmt::format("territory {} not found in territory name map", territory)); return game_iso_territory_map.at(territory); } diff --git a/decompiler/level_extractor/extract_tfrag.cpp b/decompiler/level_extractor/extract_tfrag.cpp index 69ce3038f..995ecc42f 100644 --- a/decompiler/level_extractor/extract_tfrag.cpp +++ b/decompiler/level_extractor/extract_tfrag.cpp @@ -1677,9 +1677,7 @@ std::vector emulate_tfrag_execution(const level_tools::TFragment& fra } end: - [[maybe_unused]] int total_dvert = 0; for (auto& draw : all_draws) { - total_dvert += draw.verts.size(); draw.tfrag_id = frag.id; } diff --git a/decompiler/util/Error.h b/decompiler/util/Error.h index 2e19b91f1..b227e9552 100644 --- a/decompiler/util/Error.h +++ b/decompiler/util/Error.h @@ -8,5 +8,5 @@ class Error : public std::runtime_error { public: template Error(const std::string& format, Args&&... args) - : std::runtime_error(fmt::format(format, std::forward(args)...)) {} -}; \ No newline at end of file + : std::runtime_error(fmt::format(fmt::runtime(format), std::forward(args)...)) {} +}; diff --git a/goalc/compiler/StaticObject.cpp b/goalc/compiler/StaticObject.cpp index 514c8517e..f441b870d 100644 --- a/goalc/compiler/StaticObject.cpp +++ b/goalc/compiler/StaticObject.cpp @@ -3,6 +3,7 @@ #include "common/goal_constants.h" #include "goalc/compiler/Env.h" +#include "goalc/compiler/IR.h" #include "third-party/fmt/core.h" @@ -252,4 +253,4 @@ StaticResult StaticResult::make_func_ref(const FunctionEnv* func, const TypeSpec result.m_func = func; result.m_ts = type; return result; -} \ No newline at end of file +} diff --git a/goalc/make/MakeSystem.cpp b/goalc/make/MakeSystem.cpp index 463adc6a3..d2da39dcf 100644 --- a/goalc/make/MakeSystem.cpp +++ b/goalc/make/MakeSystem.cpp @@ -206,7 +206,7 @@ goos::Object MakeSystem::handle_basename(const goos::Object& form, va_check(form, args, {goos::ObjectType::STRING}, {}); fs::path input(args.unnamed.at(0).as_string()->data); - return goos::StringObject::make_new(input.filename().u8string()); + return goos::StringObject::make_new(input.filename().string()); } goos::Object MakeSystem::handle_stem(const goos::Object& form, @@ -216,7 +216,7 @@ goos::Object MakeSystem::handle_stem(const goos::Object& form, va_check(form, args, {goos::ObjectType::STRING}, {}); fs::path input(args.unnamed.at(0).as_string()->data); - return goos::StringObject::make_new(input.stem().u8string()); + return goos::StringObject::make_new(input.stem().string()); } goos::Object MakeSystem::handle_get_gsrc_path(const goos::Object& form, @@ -276,7 +276,7 @@ goos::Object MakeSystem::handle_set_gsrc_folder( auto src_files = file_util::find_files_recursively(folder_scan, std::regex(".*\\.gc")); for (const auto& path : src_files) { - auto name = file_util::base_name_no_ext(path.u8string()); + auto name = file_util::base_name_no_ext(path.string()); auto gsrc_path = file_util::convert_to_unix_path_separators(file_util::split_path_at(path, m_gsrc_folder)); // TODO - this is only "safe" because the current OpenGOAL system requires globally unique diff --git a/goalc/make/Tools.cpp b/goalc/make/Tools.cpp index 12a0a3c78..966b5f4f5 100644 --- a/goalc/make/Tools.cpp +++ b/goalc/make/Tools.cpp @@ -20,7 +20,7 @@ bool CompilerTool::needs_run(const ToolInput& task, const PathMap& path_map) { throw std::runtime_error(fmt::format("Invalid amount of inputs to {} tool", name())); } - if (!m_compiler->knows_object_file(fs::path(task.input.at(0)).stem().u8string())) { + if (!m_compiler->knows_object_file(fs::path(task.input.at(0)).stem().string())) { return true; } return Tool::needs_run(task, path_map);