Aul: use %u instead of %zu for parameter indexes

MinGW uses an ancient version of the CRT, which doesn't support the z
modifier for integer types in printf. Use %u instead and cast to
unsigned.
alut-include-path
Nicolas Hake 2017-03-14 00:45:27 +01:00
parent dc6804c12d
commit ed193a0715
3 changed files with 9 additions and 9 deletions

View File

@ -1319,7 +1319,7 @@ void C4AulCompiler::CodegenAstVisitor::visit(const ::aul::ast::CallExpr *n)
{
// Pop off any args that are over the limit
Warn(target_host, host, n->args[fn_argc].get(), Fn, C4AulWarningId::arg_count_mismatch,
cname, n->args.size(), fn_argc);
cname, (unsigned)n->args.size(), fn_argc);
AddBCC(n->loc, AB_STACK, fn_argc - n->args.size());
}
else if (n->args.size() < fn_argc)
@ -1399,7 +1399,7 @@ void C4AulCompiler::CodegenAstVisitor::visit(const ::aul::ast::CallExpr *n)
C4V_Type to = expected_par_types[i];
if (C4Value::WarnAboutConversion(from, to))
{
Warn(target_host, host, n->args[i].get(), Fn, C4AulWarningId::arg_type_mismatch, i, cname, GetC4VName(from), GetC4VName(to));
Warn(target_host, host, n->args[i].get(), Fn, C4AulWarningId::arg_type_mismatch, (unsigned)i, cname, GetC4VName(from), GetC4VName(to));
}
}

View File

@ -1178,7 +1178,7 @@ void C4AulParse::Parse_CallParams(::aul::ast::CallExpr *call)
{
case ATT_COMMA:
// got no parameter before a ","
Warn(C4AulWarningId::empty_parameter_in_call, call->args.size(), call->callee.c_str());
Warn(C4AulWarningId::empty_parameter_in_call, (unsigned)call->args.size(), call->callee.c_str());
call->args.push_back(::aul::ast::NilLit::New(TokenSPos));
Shift();
break;
@ -1211,7 +1211,7 @@ std::unique_ptr<::aul::ast::ArrayLit> C4AulParse::Parse_Array()
// got no parameter before a ","? then push nil
if (TokenType == ATT_COMMA)
{
Warn(C4AulWarningId::empty_parameter_in_array, arr->values.size());
Warn(C4AulWarningId::empty_parameter_in_array, (unsigned)arr->values.size());
arr->values.emplace_back(::aul::ast::NilLit::New(TokenSPos));
}
else
@ -1222,7 +1222,7 @@ std::unique_ptr<::aul::ast::ArrayLit> C4AulParse::Parse_Array()
// [] -> size 0, [*,] -> size 2, [*,*,] -> size 3
if (TokenType == ATT_BCLOSE2)
{
Warn(C4AulWarningId::empty_parameter_in_array, arr->values.size());
Warn(C4AulWarningId::empty_parameter_in_array, (unsigned)arr->values.size());
arr->values.emplace_back(::aul::ast::NilLit::New(TokenSPos));
}
}

View File

@ -26,8 +26,8 @@ DIAG(invalid_hex_escape, "'\\x' used with no following hex digits", true)
// Parser diagnostics
DIAG(type_name_used_as_par_name, "type '%s' used as parameter name", false)
DIAG(empty_parameter_in_call, "parameter %zu of call to '%s' is empty", false)
DIAG(empty_parameter_in_array, "array entry %zu is empty", false)
DIAG(empty_parameter_in_call, "parameter %u of call to '%s' is empty", false)
DIAG(empty_parameter_in_array, "array entry %u is empty", false)
// Compiler diagnostics
DIAG(implicit_range_loop_var_decl, "implicit declaration of the loop variable '%s' in a for-in loop is deprecated", true)
@ -35,8 +35,8 @@ DIAG(non_global_var_is_never_const, "variable '%s' declared as const, but non-gl
DIAG(variable_shadows_variable, "declaration of %s '%s' shadows %s", true)
DIAG(redeclaration, "redeclaration of %s '%s'", true)
DIAG(undeclared_varargs, "use of '%s' in a function forces it to take variable arguments", true)
DIAG(arg_count_mismatch, "call to '%s' passes %zu arguments, of which only %zu are used", true)
DIAG(arg_type_mismatch, "parameter %zu of call to '%s' passes %s (%s expected)", true)
DIAG(arg_count_mismatch, "call to '%s' passes %u arguments, of which only %u are used", true)
DIAG(arg_type_mismatch, "parameter %u of call to '%s' passes %s (%s expected)", true)
DIAG(empty_if, "empty controlled statement (use '{}' if this is intentional)", true)
#pragma pop_macro("DIAG")