Skip to content

Commit

Permalink
Fix dumb bugs because I can't program C++.
Browse files Browse the repository at this point in the history
this fixes the build on windows.
  • Loading branch information
zhiayang committed Nov 27, 2019
1 parent 998abf6 commit a39c3df
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
4 changes: 3 additions & 1 deletion source/backend/llvm/linker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,9 @@ namespace backend

if(frontend::getOutputMode() == ProgOutputMode::RunJit)
{
const char* argv = ("llvm-jit-" + this->linkedModule->getModuleIdentifier()).c_str();
std::string modname = ("llvm-jit-" + this->linkedModule->getModuleIdentifier());
const char* argv = modname.c_str();

auto entry = this->getEntryFunctionFromJIT();

_printTiming(ts, "llvm jit");
Expand Down
2 changes: 1 addition & 1 deletion source/backend/llvm/translator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ namespace backend
ty = fir::Type::getString();

// add -1 for the capacity and 0 for the refcountptr.
mems.push_back(llvm::ConstantInt::get(getNativeWordTy(), -1));
mems.push_back(llvm::ConstantInt::get(getNativeWordTy(), static_cast<uint64_t>(-1)));
mems.push_back(zconst);
}

Expand Down
7 changes: 4 additions & 3 deletions source/include/zpr.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#include <map>
#include <string>
#include <algorithm>
#include <type_traits>
#include <string_view>

Expand Down Expand Up @@ -404,7 +405,6 @@ namespace zpr
char buf[65] = {0};

size_t digits_len = 0;
const char* fmt_str = 0;
auto spec = args.specifier;

static std::map<int64_t, std::string> len_specs = {
Expand All @@ -417,8 +417,9 @@ namespace zpr
{ format_args::LENGTH_PTRDIFF_T, "t" }
};

fmt_str = ("%" + len_specs[args.length] + spec).c_str();
digits_len = snprintf(&buf[0], 64, fmt_str, x);
auto fmt_str = ("%" + len_specs[args.length] + spec);

digits_len = snprintf(&buf[0], 64, fmt_str.c_str(), x);

// sadly, we must cheat here as well, because osx doesn't bloody have charconv (STILL)?

Expand Down

0 comments on commit a39c3df

Please sign in to comment.