Skip to content

Commit

Permalink
fix warnings in coreclr/jit/compiler.cpp for non-Windows targets
Browse files Browse the repository at this point in the history
This change was extracted from dotnet/runtimelab#2614,
which includes various fixes to enable building on non-Windows systems.  We're
in the process of upstreaming the parts of that PR which are not specific to
NativeAOT-LLVM, and this is the latest such change.

Note that I left a TODO comment in `DisplayNowayAssertMap` since I'm not sure
how to print a `LPCWSTR` using `fprintf` on non-Windows systems, but it's clear
that the existing code is not portable given the difference between `wchar_t` on
Windows (where it's 16 bits) and other systems (where it's usually 32 bits).

Signed-off-by: Joel Dice <joel.dice@fermyon.com>
  • Loading branch information
dicej committed Jul 15, 2024
1 parent f9eda07 commit 250a96f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/coreclr/jit/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1262,8 +1262,12 @@ void DisplayNowayAssertMap()
fout = _wfopen(strJitMeasureNowayAssertFile, W("a"));
if (fout == nullptr)
{
#if !defined(HOST_WINDOWS)
// TODO: how do we print a `const char16_t*` portably?
#else
fprintf(jitstdout(), "Failed to open JitMeasureNowayAssertFile \"%ws\"\n",
strJitMeasureNowayAssertFile);
#endif
return;
}
}
Expand Down Expand Up @@ -1295,7 +1299,7 @@ void DisplayNowayAssertMap()

for (i = 0; i < count; i++)
{
fprintf(fout, "%u, %s, %u, \"%s\"\n", nacp[i].count, nacp[i].fl.m_file, nacp[i].fl.m_line,
fprintf(fout, "%zu, %s, %u, \"%s\"\n", nacp[i].count, nacp[i].fl.m_file, nacp[i].fl.m_line,
nacp[i].fl.m_condStr);
}

Expand Down Expand Up @@ -3389,7 +3393,7 @@ void Compiler::compInitOptions(JitFlags* jitFlags)
compMaxUncheckedOffsetForNullObject = (size_t)JitConfig.JitMaxUncheckedOffset();
if (verbose)
{
printf("STRESS_NULL_OBJECT_CHECK: compMaxUncheckedOffsetForNullObject=0x%X\n",
printf("STRESS_NULL_OBJECT_CHECK: compMaxUncheckedOffsetForNullObject=0x%zX\n",
compMaxUncheckedOffsetForNullObject);
}
}
Expand Down Expand Up @@ -9548,7 +9552,7 @@ void dumpConvertedVarSet(Compiler* comp, VARSET_VALARG_TP vars)

bool first = true;
printf("{");
for (size_t varNum = 0; varNum < comp->lvaCount; varNum++)
for (unsigned varNum = 0; varNum < comp->lvaCount; varNum++)
{
if (pVarNumSet[varNum] == 1)
{
Expand Down

0 comments on commit 250a96f

Please sign in to comment.