Skip to content

Commit

Permalink
[core] Fix minor compiler issues with Tracy build
Browse files Browse the repository at this point in the history
  • Loading branch information
zach2good committed Dec 19, 2023
1 parent da01ba4 commit 41568db
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 23 deletions.
2 changes: 1 addition & 1 deletion src/common/console_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ ConsoleService::ConsoleService()
}
else
{
fmt::print(fmt::format("> Unknown command: {}\n", inputs[0]));
fmt::print(fmt::runtime("> Unknown command: {}\n"), inputs[0]);
}
}

Expand Down
45 changes: 24 additions & 21 deletions src/common/tracy.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@

// clang-format off
#ifdef TRACY_ENABLE

#include <cstdint>
#include <fmt/format.h>

#include "tracy/Tracy.hpp"
#include "cbasetypes.h"

#define TracyFrameMark FrameMark
#define TracyZoneScoped ZoneScoped
Expand All @@ -35,14 +38,14 @@
#define TracyZoneString(str) ZoneText(str.c_str(), str.size())
#define TracyZoneCString(cstr) ZoneText(cstr, std::strlen(cstr))
#define TracyMessageStr(str) TracyMessage(str.c_str(), str.size())
#define TracySetThreadName(str) tracy::SetThreadName(str);
#define TracySetThreadName(str) tracy::SetThreadName(str)

inline std::string Hex8ToString(uint8 hex)
inline std::string Hex8ToString(std::uint8_t hex)
{
return fmt::format("0x{:02X}", hex);
}

inline std::string Hex16ToString(uint16 hex)
inline std::string Hex16ToString(std::uint16_t hex)
{
return fmt::format("0x{:04X}", hex);
}
Expand Down Expand Up @@ -71,23 +74,23 @@ inline std::string Hex16ToString(uint16 hex)
TracyReportGraphBytes("Lua Memory Usage", static_cast<double>(lua_gc(L, LUA_GCCOUNT, 0)) * 1024.0); \

#else // Empty stubs for regular builds
#define TracyFrameMark std::ignore = 0;
#define TracyZoneScoped std::ignore = 0;
#define TracyZoneScopedN(n) std::ignore = n;
#define TracyZoneNamed(var) std::ignore = #var;
#define TracyZoneText(n, l) std::ignore = n; std::ignore = l;
#define TracyZoneScopedC(c) std::ignore = c;
#define TracyZoneString(str) std::ignore = str;
#define TracyZoneCString(cstr) std::ignore = cstr;
#define TracyZoneIString(istr) std::ignore = istr;
#define TracyZoneHex8(num) std::ignore = num;
#define TracyZoneHex16(num) std::ignore = num;
#define TracyReportGraphNumber(name, num) std::ignore = name; std::ignore = num;
#define TracyReportGraphBytes(name, num) std::ignore = name; std::ignore = num;
#define TracyReportGraphPercent(name, num) std::ignore = name; std::ignore = num;
#define TracyReportLuaMemory(L) std::ignore = L;
#define TracyMessageStr(str) std::ignore = str;
#define TracySetThreadName(str) std::ignore = str;
#define TracyFrameMark std::ignore = 0
#define TracyZoneScoped std::ignore = 0
#define TracyZoneScopedN(n) std::ignore = n
#define TracyZoneNamed(var) std::ignore = #var
#define TracyZoneText(n, l) std::ignore = n; std::ignore = l
#define TracyZoneScopedC(c) std::ignore = c
#define TracyZoneString(str) std::ignore = str
#define TracyZoneCString(cstr) std::ignore = cstr
#define TracyZoneIString(istr) std::ignore = istr
#define TracyZoneHex8(num) std::ignore = num
#define TracyZoneHex16(num) std::ignore = num
#define TracyReportGraphNumber(name, num) std::ignore = name; std::ignore = num
#define TracyReportGraphBytes(name, num) std::ignore = name; std::ignore = num
#define TracyReportGraphPercent(name, num) std::ignore = name; std::ignore = num
#define TracyReportLuaMemory(L) std::ignore = L
#define TracyMessageStr(str) std::ignore = str
#define TracySetThreadName(str) std::ignore = str
#endif
// clang-format on

Expand Down
2 changes: 1 addition & 1 deletion src/map/lua/luautils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2009,7 +2009,7 @@ namespace luautils
ShowError("Invalid objtype for entity received.");
return -1;
}
auto filename = fmt::format(pathFormat, zone, name);
auto filename = fmt::format(fmt::runtime(pathFormat), zone, name);

PChar->eventPreparation->targetEntity = PNpc;
PChar->eventPreparation->scriptFile = filename;
Expand Down

0 comments on commit 41568db

Please sign in to comment.