Remove positional parameters in aul compiler warning strings

Feel free to revert this commit when windows autobuilds are no longer done using mingw
alut-include-path
Sven Eberhardt 2017-02-24 21:41:28 -05:00
parent 5c8ed12c3f
commit 750d9dafb9
2 changed files with 19 additions and 19 deletions

View File

@ -511,10 +511,10 @@ void C4AulCompiler::PreparseAstVisitor::visit(const ::aul::ast::VarDecl *n)
// if target_host is unset, we're parsing this func for direct execution,
// in which case we don't want to warn about variable hiding.
if (target_host->Engine->GlobalNamedNames.GetItemNr(cname) >= 0 || target_host->Engine->GlobalConstNames.GetItemNr(cname) >= 0)
Warn(target_host, host, n, Fn, C4AulWarningId::variable_shadows_variable, cname, "local variable", "global variable");
Warn(target_host, host, n, Fn, C4AulWarningId::variable_shadows_variable, "local variable", cname, "global variable");
C4String *s = ::Strings.FindString(cname);
if (s && target_host->GetPropList()->HasProperty(s))
Warn(target_host, host, n, Fn, C4AulWarningId::variable_shadows_variable, cname, "local variable", "object-local variable");
Warn(target_host, host, n, Fn, C4AulWarningId::variable_shadows_variable, "local variable", cname, "object-local variable");
if (Fn->ParNamed.GetItemNr(cname) != -1)
{
// The parameter order of this warning is correct:
@ -522,7 +522,7 @@ void C4AulCompiler::PreparseAstVisitor::visit(const ::aul::ast::VarDecl *n)
// the parameter actually shadows the local variable.
// This doesn't make a whole lot of sense and should
// probably be changed.
Warn(target_host, host, n, Fn, C4AulWarningId::variable_shadows_variable, cname, "parameter", "local variable");
Warn(target_host, host, n, Fn, C4AulWarningId::variable_shadows_variable, "parameter", cname, "local variable");
}
}
Fn->VarNamed.AddName(cname);
@ -531,10 +531,10 @@ void C4AulCompiler::PreparseAstVisitor::visit(const ::aul::ast::VarDecl *n)
case ::aul::ast::VarDecl::Scope::Object:
{
if (host->Engine->GlobalNamedNames.GetItemNr(cname) >= 0 || host->Engine->GlobalConstNames.GetItemNr(cname) >= 0)
Warn(target_host, host, n, Fn, C4AulWarningId::variable_shadows_variable, cname, "object-local variable", "global variable");
Warn(target_host, host, n, Fn, C4AulWarningId::variable_shadows_variable, "object-local variable", cname, "global variable");
C4String *s = ::Strings.RegString(cname);
if (target_host->GetPropList()->HasProperty(s))
Warn(target_host, host, n, Fn, C4AulWarningId::redeclaration, cname, "object-local variable");
Warn(target_host, host, n, Fn, C4AulWarningId::redeclaration, "object-local variable", cname);
else
target_host->GetPropList()->SetPropertyByS(s, C4VNull);
break;
@ -545,7 +545,7 @@ void C4AulCompiler::PreparseAstVisitor::visit(const ::aul::ast::VarDecl *n)
throw Error(target_host, host, n, Fn, "internal error: global var declaration inside function");
if (host->Engine->GlobalNamedNames.GetItemNr(cname) >= 0 || host->Engine->GlobalConstNames.GetItemNr(cname) >= 0)
Warn(target_host, host, n, Fn, C4AulWarningId::redeclaration, cname, "global variable");
Warn(target_host, host, n, Fn, C4AulWarningId::redeclaration, "global variable", cname);
if (n->constant)
host->Engine->GlobalConstNames.AddName(cname);
else
@ -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, cname, i, GetC4VName(from), GetC4VName(to));
Warn(target_host, host, n->args[i].get(), Fn, C4AulWarningId::arg_type_mismatch, i, cname, GetC4VName(from), GetC4VName(to));
}
}
@ -1672,7 +1672,7 @@ void C4AulCompiler::CodegenAstVisitor::visit(const ::aul::ast::FunctionDecl *n)
if (f->SFunc() && f->SFunc()->pOrgScript == host && f->Parent == Parent)
{
if (Fn)
Warn(target_host, host, n, Fn, C4AulWarningId::redeclaration, f->GetName(), "function");
Warn(target_host, host, n, Fn, C4AulWarningId::redeclaration, "function", f->GetName());
Fn = f->SFunc();
}
f = f->SFunc() ? f->SFunc()->OwnerOverloaded : 0;

View File

@ -21,22 +21,22 @@
#endif
// Lexer diagnostics
DIAG(invalid_escape_sequence, "unknown escape sequence '\\%1$s'", true)
DIAG(invalid_escape_sequence, "unknown escape sequence '\\%s'", true)
DIAG(invalid_hex_escape, "'\\x' used with no following hex digits", true)
// Parser diagnostics
DIAG(type_name_used_as_par_name, "type '%1$s' used as parameter name", false)
DIAG(empty_parameter_in_call, "parameter %1$zu of call to '%2$s' is empty", false)
DIAG(empty_parameter_in_array, "array entry %1$zu is empty", false)
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)
// Compiler diagnostics
DIAG(implicit_range_loop_var_decl, "implicit declaration of the loop variable '%1$s' in a for-in loop is deprecated", true)
DIAG(non_global_var_is_never_const, "variable '%1$s' declared as const, but non-global variables are always mutable", true)
DIAG(variable_shadows_variable, "declaration of %2$s '%1$s' shadows %3$s", true)
DIAG(redeclaration, "redeclaration of %2$s '%1$s'", true)
DIAG(undeclared_varargs, "use of '%1$s' in a function forces it to take variable arguments", true)
DIAG(arg_count_mismatch, "call to '%1$s' passes %2$zu arguments, of which only %3$zu are used", true)
DIAG(arg_type_mismatch, "parameter %2$zu of call to '%1$s' passes %3$s (%4$s expected)", true)
DIAG(implicit_range_loop_var_decl, "implicit declaration of the loop variable '%s' in a for-in loop is deprecated", true)
DIAG(non_global_var_is_never_const, "variable '%s' declared as const, but non-global variables are always mutable", true)
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(empty_if, "empty controlled statement (use '{}' if this is intentional)", true)
#pragma pop_macro("DIAG")