diagnostics: replace %<%s%> with %qs [PR104896]

No functional change intended.

gcc/analyzer/ChangeLog:
	PR c/104896
	* sm-malloc.cc: Replace "%<%s%>" with "%qs" in message wording.

gcc/c-family/ChangeLog:
	PR c/104896
	* c-lex.cc (c_common_lex_availability_macro): Replace "%<%s%>"
	with "%qs" in message wording.
	* c-opts.cc (c_common_handle_option): Likewise.
	* c-warn.cc (warn_parm_array_mismatch): Likewise.

gcc/ChangeLog:
	PR c/104896
	* common/config/ia64/ia64-common.cc (ia64_handle_option): Replace
	"%<%s%>" with "%qs" in message wording.
	* common/config/rs6000/rs6000-common.cc (rs6000_handle_option):
	Likewise.
	* config/aarch64/aarch64.cc (aarch64_validate_sls_mitigation):
	Likewise.
	(aarch64_override_options): Likewise.
	(aarch64_process_target_attr): Likewise.
	* config/arm/aarch-common.cc (aarch_validate_mbranch_protection):
	Likewise.
	* config/pru/pru.cc (pru_insert_attributes): Likewise.
	* config/riscv/riscv-target-attr.cc
	(riscv_target_attr_parser::parse_arch): Likewise.
	* omp-general.cc (oacc_verify_routine_clauses): Likewise.
	* tree-ssa-uninit.cc (maybe_warn_read_write_only): Likewise.
	(maybe_warn_pass_by_reference): Likewise.

gcc/cp/ChangeLog:
	PR c/104896
	* cvt.cc (maybe_warn_nodiscard): Replace "%<%s%>" with "%qs" in
	message wording.

gcc/fortran/ChangeLog:
	PR c/104896
	* resolve.cc (resolve_operator): Replace "%<%s%>" with "%qs" in
	message wording.

gcc/go/ChangeLog:
	PR c/104896
	* gofrontend/embed.cc (Gogo::initializer_for_embeds): Replace
	"%<%s%>" with "%qs" in message wording.
	* gofrontend/expressions.cc
	(Selector_expression::lower_method_expression): Likewise.
	* gofrontend/gogo.cc (Gogo::set_package_name): Likewise.
	(Named_object::export_named_object): Likewise.
	* gofrontend/parse.cc (Parse::struct_type): Likewise.
	(Parse::parameter_list): Likewise.

gcc/rust/ChangeLog:
	PR c/104896
	* backend/rust-compile-expr.cc
	(CompileExpr::compile_integer_literal): Replace "%<%s%>" with
	"%qs" in message wording.
	(CompileExpr::compile_float_literal): Likewise.
	* backend/rust-compile-intrinsic.cc (Intrinsics::compile):
	Likewise.
	* backend/rust-tree.cc (maybe_warn_nodiscard): Likewise.
	* checks/lints/rust-lint-scan-deadcode.h: Likewise.
	* lex/rust-lex.cc (Lexer::parse_partial_unicode_escape): Likewise.
	(Lexer::parse_raw_byte_string): Likewise.
	* lex/rust-token.cc (Token::get_str): Likewise.
	* metadata/rust-export-metadata.cc
	(PublicInterface::write_to_path): Likewise.
	* parse/rust-parse.cc
	(peculiar_fragment_match_compatible_fragment): Likewise.
	(peculiar_fragment_match_compatible): Likewise.
	* resolve/rust-ast-resolve-path.cc (ResolvePath::resolve_path):
	Likewise.
	* resolve/rust-ast-resolve-toplevel.h: Likewise.
	* resolve/rust-ast-resolve-type.cc (ResolveRelativeTypePath::go):
	Likewise.
	* rust-session-manager.cc (validate_crate_name): Likewise.
	(Session::load_extern_crate): Likewise.
	* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit):
	Likewise.
	(TypeCheckExpr::resolve_fn_trait_call): Likewise.
	* typecheck/rust-hir-type-check-implitem.cc
	(TypeCheckImplItemWithTrait::visit): Likewise.
	* typecheck/rust-hir-type-check-item.cc
	(TypeCheckItem::validate_trait_impl_block): Likewise.
	* typecheck/rust-hir-type-check-struct.cc
	(TypeCheckStructExpr::visit): Likewise.
	* typecheck/rust-tyty-call.cc (TypeCheckCallExpr::visit):
	Likewise.
	* typecheck/rust-tyty.cc (BaseType::bounds_compatible): Likewise.
	* typecheck/rust-unify.cc (UnifyRules::emit_abi_mismatch):
	Likewise.
	* util/rust-attributes.cc (AttributeChecker::visit): Likewise.

libcpp/ChangeLog:
	PR c/104896
	* pch.cc (cpp_valid_state): Replace "%<%s%>" with "%qs" in message
	wording.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
This commit is contained in:
David Malcolm 2024-11-27 19:21:15 -05:00
parent 7a656d7461
commit 9f06b910a8
39 changed files with 104 additions and 104 deletions

View file

@ -1320,7 +1320,7 @@ public:
{
/* CWE-416: Use After Free. */
ctxt.add_cwe (416);
return ctxt.warn ("use after %<%s%> of %qE",
return ctxt.warn ("use after %qs of %qE",
m_deallocator->m_name, m_arg);
}
@ -1363,17 +1363,17 @@ public:
gcc_unreachable ();
case WORDING_FREED:
pp_printf (&pp,
"use after %<%s%> of %qE; freed at %@",
"use after %qs of %qE; freed at %@",
funcname, ev.m_expr, &m_free_event);
return true;
case WORDING_DELETED:
pp_printf (&pp,
"use after %<%s%> of %qE; deleted at %@",
"use after %qs of %qE; deleted at %@",
funcname, ev.m_expr, &m_free_event);
return true;
case WORDING_DEALLOCATED:
pp_printf (&pp,
"use after %<%s%> of %qE;"
"use after %qs of %qE;"
" deallocated at %@",
funcname, ev.m_expr, &m_free_event);
return true;
@ -1381,7 +1381,7 @@ public:
else
{
pp_printf (&pp,
"use after %<%s%> of %qE",
"use after %qs of %qE",
funcname, ev.m_expr);
return true;
}
@ -1517,12 +1517,12 @@ public:
case MEMSPACE_CODE:
case MEMSPACE_GLOBALS:
case MEMSPACE_READONLY_DATA:
return ctxt.warn ("%<%s%> of %qE which points to memory"
return ctxt.warn ("%qs of %qE which points to memory"
" not on the heap",
m_funcname, m_arg);
break;
case MEMSPACE_STACK:
return ctxt.warn ("%<%s%> of %qE which points to memory"
return ctxt.warn ("%qs of %qE which points to memory"
" on the stack",
m_funcname, m_arg);
break;

View file

@ -497,7 +497,7 @@ c_common_lex_availability_macro (cpp_reader *pfile, const char *builtin)
if (token->type != CPP_CLOSE_PAREN)
{
cpp_error (pfile, CPP_DL_ERROR,
"expected %<)%> after %<%s%>", name);
"expected %<)%> after %qs", name);
name = "";
}
}

View file

@ -374,7 +374,7 @@ c_common_handle_option (size_t scode, const char *arg, HOST_WIDE_INT value,
if (!strcmp (arg, "p1689r5"))
cpp_opts->deps.fdeps_format = FDEPS_FMT_P1689R5;
else
error ("%<-fdeps-format=%> unknown format %<%s%>", arg);
error ("%<-fdeps-format=%> unknown format %qs", arg);
break;
case OPT_fdeps_file_:

View file

@ -3708,7 +3708,7 @@ warn_parm_array_mismatch (location_t origloc, tree fndecl, tree newparms)
else
warned = warning_at (&richloc, OPT_Wvla_parameter,
"argument %u of type %s declared "
"with mismatched bound %<%s%>",
"with mismatched bound %qs",
parmpos + 1, newparmstr.c_str (),
newbndstr);
@ -3725,7 +3725,7 @@ warn_parm_array_mismatch (location_t origloc, tree fndecl, tree newparms)
}
else
inform (&richloc, "previously declared as %s with bound "
"%<%s%>", curparmstr.c_str (), curbndstr);
"%qs", curparmstr.c_str (), curbndstr);
continue;
}
@ -3742,7 +3742,7 @@ warn_parm_array_mismatch (location_t origloc, tree fndecl, tree newparms)
if (warning_at (newloc, OPT_Wvla_parameter,
"argument %u of type %s declared with "
"mismatched bound %<%s%>",
"mismatched bound %qs",
parmpos + 1, newparmstr.c_str (), newbndstr))
inform (origloc, "previously declared as %s with bound %qs",
curparmstr.c_str (), curbndstr);

View file

@ -62,7 +62,7 @@ ia64_handle_option (struct gcc_options *opts ATTRIBUTE_UNUSED,
{
case OPT_mtls_size_:
if (value != 14 && value != 22 && value != 64)
error_at (loc, "bad value %<%s%> for %<-mtls-size=%> switch", arg);
error_at (loc, "bad value %qs for %<-mtls-size=%> switch", arg);
return true;
default:

View file

@ -222,7 +222,7 @@ rs6000_handle_option (struct gcc_options *opts, struct gcc_options *opts_set,
case OPT_mabi_ieeelongdouble:
if (opts->x_rs6000_long_double_type_size == 64)
{
error_at (loc, "option %<%s%> requires %<-mlong-double-128%>",
error_at (loc, "option %qs requires %<-mlong-double-128%>",
decoded->orig_option_with_args_text);
return true;
}

View file

@ -18929,7 +18929,7 @@ aarch64_validate_sls_mitigation (const char *const_str)
}
else
{
error ("invalid argument %<%s%> for %<-mharden-sls=%>", str);
error ("invalid argument %qs for %<-mharden-sls=%>", str);
break;
}
str = strtok_r (NULL, ",", &token_save);
@ -19160,7 +19160,7 @@ aarch64_override_options (void)
= aarch64_get_extension_string_for_isa_flags (full_arch_flags,
full_cpu_flags);
warning (0, "switch %<-mcpu=%s%> conflicts with %<-march=%s%> switch "
"and resulted in options %<%s%> being added",
"and resulted in options %qs being added",
aarch64_cpu_string,
aarch64_arch_string,
ext_diff.c_str ());
@ -19899,7 +19899,7 @@ aarch64_process_target_attr (tree args)
= aarch64_parse_extension (with_plus.c_str (), &isa_temp, nullptr);
if (ext_res == AARCH_PARSE_OK)
error ("arch extension %<%s%> should be prefixed by %<+%>",
error ("arch extension %qs should be prefixed by %<+%>",
token);
else
error ("pragma or attribute %<target(\"%s\")%> is not valid", token);

View file

@ -711,9 +711,9 @@ aarch_validate_mbranch_protection (
{
res = false;
if (strcmp (str, "") == 0)
error ("missing feature or flag for %<%s%>", opt);
error ("missing feature or flag for %qs", opt);
else
error ("invalid argument %<%s%> for %<%s%>", str, opt);
error ("invalid argument %qs for %qs", str, opt);
break;
}
@ -724,7 +724,7 @@ aarch_validate_mbranch_protection (
if (reject_alone && alone_str != NULL)
{
res = false;
error ("argument %<%s%> can only appear alone in %<%s%>",
error ("argument %qs can only appear alone in %qs",
alone_str, opt);
break;
}

View file

@ -2217,7 +2217,7 @@ pru_insert_attributes (tree node, tree *)
error ("only 32-bit access is supported "
"for %<__regio_symbol%> address space");
if (strcmp (name, "__R30") != 0 && strcmp (name, "__R31") != 0)
error ("register name %<%s%> not recognized "
error ("register name %qs not recognized "
"in %<__regio_symbol%> address space", name);
}

View file

@ -140,7 +140,7 @@ riscv_target_attr_parser::parse_arch (const char *str)
error_at (
m_loc,
"unexpected arch for %<target()%> attribute: bad "
"string found %<%s%>", token);
"string found %qs", token);
goto fail;
}

View file

@ -1086,7 +1086,7 @@ maybe_warn_nodiscard (tree expr, impl_conv_void implicit)
const char *format
= (msg
? G_("ignoring return value of %qD, "
"declared with attribute %<nodiscard%>: %<%s%>")
"declared with attribute %<nodiscard%>: %qs")
: G_("ignoring return value of %qD, "
"declared with attribute %<nodiscard%>%s"));
const char *raw_msg = msg ? (const char *) msg : "";
@ -1104,7 +1104,7 @@ maybe_warn_nodiscard (tree expr, impl_conv_void implicit)
const char *format
= (msg
? G_("ignoring returned value of type %qT, "
"declared with attribute %<nodiscard%>: %<%s%>")
"declared with attribute %<nodiscard%>: %qs")
: G_("ignoring returned value of type %qT, "
"declared with attribute %<nodiscard%>%s"));
const char *raw_msg = msg ? (const char *) msg : "";

View file

@ -4278,7 +4278,7 @@ resolve_operator (gfc_expr *e)
}
CHECK_INTERFACES
gfc_error ("Operand of unary numeric operator %<%s%> at %L is %s",
gfc_error ("Operand of unary numeric operator %qs at %L is %s",
gfc_op2string (e->value.op.op), &e->where, gfc_typename (e));
return false;
@ -4306,7 +4306,7 @@ resolve_operator (gfc_expr *e)
if (flag_unsigned && gfc_invalid_unsigned_ops (op1, op2))
{
CHECK_INTERFACES
gfc_error ("Operands of binary numeric operator %<%s%> at %L are "
gfc_error ("Operands of binary numeric operator %qs at %L are "
"%s/%s", gfc_op2string (e->value.op.op), &e->where,
gfc_typename (op1), gfc_typename (op2));
return false;
@ -4333,14 +4333,14 @@ resolve_operator (gfc_expr *e)
{
CHECK_INTERFACES
gfc_error ("Unexpected derived-type entities in binary intrinsic "
"numeric operator %<%s%> at %L",
"numeric operator %qs at %L",
gfc_op2string (e->value.op.op), &e->where);
return false;
}
else
{
CHECK_INTERFACES
gfc_error ("Operands of binary numeric operator %<%s%> at %L are %s/%s",
gfc_error ("Operands of binary numeric operator %qs at %L are %s/%s",
gfc_op2string (e->value.op.op), &e->where, gfc_typename (op1),
gfc_typename (op2));
return false;
@ -4399,7 +4399,7 @@ resolve_operator (gfc_expr *e)
}
CHECK_INTERFACES
gfc_error ("Operands of logical operator %<%s%> at %L are %s/%s",
gfc_error ("Operands of logical operator %qs at %L are %s/%s",
gfc_op2string (e->value.op.op), &e->where, gfc_typename (op1),
gfc_typename (op2));
return false;
@ -4564,7 +4564,7 @@ resolve_operator (gfc_expr *e)
else
{
CHECK_INTERFACES
gfc_error ("Operands of comparison operator %<%s%> at %L are %s/%s",
gfc_error ("Operands of comparison operator %qs at %L are %s/%s",
gfc_op2string (e->value.op.op), &e->where, gfc_typename (op1),
gfc_typename (op2));
}
@ -4579,22 +4579,22 @@ resolve_operator (gfc_expr *e)
guessed = lookup_uop_fuzzy (name, e->value.op.uop->ns->uop_root);
CHECK_INTERFACES
if (guessed)
gfc_error ("Unknown operator %<%s%> at %L; did you mean "
"%<%s%>?", name, &e->where, guessed);
gfc_error ("Unknown operator %qs at %L; did you mean "
"%qs?", name, &e->where, guessed);
else
gfc_error ("Unknown operator %<%s%> at %L", name, &e->where);
gfc_error ("Unknown operator %qs at %L", name, &e->where);
}
else if (op2 == NULL)
{
CHECK_INTERFACES
gfc_error ("Operand of user operator %<%s%> at %L is %s",
gfc_error ("Operand of user operator %qs at %L is %s",
e->value.op.uop->name, &e->where, gfc_typename (op1));
}
else
{
e->value.op.uop->op->sym->attr.referenced = 1;
CHECK_INTERFACES
gfc_error ("Operands of user operator %<%s%> at %L are %s/%s",
gfc_error ("Operands of user operator %qs at %L are %s/%s",
e->value.op.uop->name, &e->where, gfc_typename (op1),
gfc_typename (op2));
}

View file

@ -792,7 +792,7 @@ Gogo::initializer_for_embeds(Type* type,
{
go_error_at(loc,
("invalid go:embed: build system did not "
"map pattern %<%s%>"),
"map pattern %qs"),
pe->c_str());
continue;
}
@ -807,7 +807,7 @@ Gogo::initializer_for_embeds(Type* type,
{
go_error_at(loc,
("invalid go:embed: build system did not "
"map file %<%s%>"),
"map file %qs"),
pf->c_str());
continue;
}

View file

@ -9079,12 +9079,12 @@ Selector_expression::lower_method_expression(Gogo* gogo)
if (nt != NULL)
{
if (!is_ambiguous)
go_error_at(location, "type %<%s%s%> has no method %<%s%>",
go_error_at(location, "type %<%s%s%> has no method %qs",
is_pointer ? "*" : "",
nt->message_name().c_str(),
Gogo::message_name(name).c_str());
else
go_error_at(location, "method %<%s%s%> is ambiguous in type %<%s%>",
go_error_at(location, "method %<%s%s%> is ambiguous in type %qs",
Gogo::message_name(name).c_str(),
is_pointer ? "*" : "",
nt->message_name().c_str());
@ -9092,10 +9092,10 @@ Selector_expression::lower_method_expression(Gogo* gogo)
else
{
if (!is_ambiguous)
go_error_at(location, "type has no method %<%s%>",
go_error_at(location, "type has no method %qs",
Gogo::message_name(name).c_str());
else
go_error_at(location, "method %<%s%> is ambiguous",
go_error_at(location, "method %qs is ambiguous",
Gogo::message_name(name).c_str());
}
return Expression::make_error(location);

View file

@ -358,7 +358,7 @@ Gogo::set_package_name(const std::string& package_name,
if (this->package_ != NULL)
{
if (this->package_->package_name() != package_name)
go_error_at(location, "expected package %<%s%>",
go_error_at(location, "expected package %qs",
Gogo::message_name(this->package_->package_name()).c_str());
return;
}
@ -8835,7 +8835,7 @@ Named_object::export_named_object(Export* exp) const
case NAMED_OBJECT_TYPE_DECLARATION:
go_error_at(this->type_declaration_value()->location(),
"attempt to export %<%s%> which was declared but not defined",
"attempt to export %qs which was declared but not defined",
this->message_name().c_str());
break;

View file

@ -511,7 +511,7 @@ Parse::struct_type()
{
if (pi->field_name() == pj->field_name()
&& !Gogo::is_sink_name(pi->field_name()))
go_error_at(pi->location(), "duplicate field name %<%s%>",
go_error_at(pi->location(), "duplicate field name %qs",
Gogo::message_name(pi->field_name()).c_str());
}
}
@ -966,7 +966,7 @@ Parse::parameter_list(bool* is_varargs)
type = Type::make_forward_declaration(no);
else
{
go_error_at(p->location(), "expected %<%s%> to be a type",
go_error_at(p->location(), "expected %qs to be a type",
Gogo::message_name(p->name()).c_str());
saw_error = true;
type = Type::make_error_type();

View file

@ -3157,7 +3157,7 @@ oacc_verify_routine_clauses (tree fndecl, tree *clauses, location_t loc,
/* See <https://gcc.gnu.org/PR93465>; the semantics of combining
OpenACC and OpenMP 'target' are not clear. */
error_at (loc,
"cannot apply %<%s%> to %qD, which has also been"
"cannot apply %qs to %qD, which has also been"
" marked with an OpenMP 'declare target' directive",
routine_str, fndecl);
/* Incompatible. */
@ -3212,14 +3212,14 @@ oacc_verify_routine_clauses (tree fndecl, tree *clauses, location_t loc,
if (c_diag != NULL_TREE)
error_at (OMP_CLAUSE_LOCATION (c_diag),
"incompatible %qs clause when applying"
" %<%s%> to %qD, which has already been"
" %qs to %qD, which has already been"
" marked with an OpenACC 'routine' directive",
omp_clause_code_name[OMP_CLAUSE_CODE (c_diag)],
routine_str, fndecl);
else if (c_diag_p != NULL_TREE)
error_at (loc,
"missing %qs clause when applying"
" %<%s%> to %qD, which has already been"
" %qs to %qD, which has already been"
" marked with an OpenACC 'routine' directive",
omp_clause_code_name[OMP_CLAUSE_CODE (c_diag_p)],
routine_str, fndecl);

View file

@ -1501,7 +1501,7 @@ CompileExpr::compile_integer_literal (const HIR::LiteralExpr &expr,
if (mpz_cmp (ival, type_min) < 0 || mpz_cmp (ival, type_max) > 0)
{
rust_error_at (expr.get_locus (),
"integer overflows the respective type %<%s%>",
"integer overflows the respective type %qs",
tyty->get_name ().c_str ());
return error_mark_node;
}
@ -1547,7 +1547,7 @@ CompileExpr::compile_float_literal (const HIR::LiteralExpr &expr,
if (TREE_OVERFLOW (real_value) || real_value_overflow)
{
rust_error_at (expr.get_locus (),
"decimal overflows the respective type %<%s%>",
"decimal overflows the respective type %qs",
tyty->get_name ().c_str ());
return error_mark_node;
}

View file

@ -271,7 +271,7 @@ Intrinsics::compile (TyTy::FnType *fntype)
location_t locus = ctx->get_mappings ()->lookup_location (fntype->get_ref ());
rust_error_at (locus, ErrorCode::E0093,
"unrecognized intrinsic function: %<%s%>",
"unrecognized intrinsic function: %qs",
fntype->get_identifier ().c_str ());
return error_mark_node;

View file

@ -613,7 +613,7 @@ maybe_warn_nodiscard (tree expr, impl_conv_void implicit)
if (args)
msg.escape (TREE_STRING_POINTER (TREE_VALUE (args)));
const char *format
= (msg ? G_ ("ignoring return value of %qD, that must be used: %<%s%>")
= (msg ? G_ ("ignoring return value of %qD, that must be used: %qs")
: G_ ("ignoring return value of %qD, that must be used"));
const char *raw_msg = msg ? (const char *) msg : "";
auto_diagnostic_group d;
@ -630,7 +630,7 @@ maybe_warn_nodiscard (tree expr, impl_conv_void implicit)
msg.escape (TREE_STRING_POINTER (TREE_VALUE (args)));
const char *format
= (msg ? G_ (
"ignoring returned value of type %qT, that must be used: %<%s%>")
"ignoring returned value of type %qT, that must be used: %qs")
: G_ ("ignoring returned value of type %qT, that must be used"));
const char *raw_msg = msg ? (const char *) msg : "";
auto_diagnostic_group d;

View file

@ -61,7 +61,7 @@ public:
{
rust_warning_at (
function.get_function_name ().get_locus (), 0,
"associated function is never used: %<%s%>",
"associated function is never used: %qs",
function.get_function_name ().as_string ().c_str ());
}
}
@ -69,7 +69,7 @@ public:
{
rust_warning_at (
function.get_function_name ().get_locus (), 0,
"function is never used: %<%s%>",
"function is never used: %qs",
function.get_function_name ().as_string ().c_str ());
}
}
@ -84,7 +84,7 @@ public:
= stct.get_identifier ().as_string ().at (0) == '_';
if (!name_starts_underscore)
rust_warning_at (stct.get_locus (), 0,
"struct is never constructed: %<%s%>",
"struct is never constructed: %qs",
stct.get_identifier ().as_string ().c_str ());
}
else
@ -97,7 +97,7 @@ public:
&& !field.get_visibility ().is_public ())
{
rust_warning_at (field.get_locus (), 0,
"field is never read: %<%s%>",
"field is never read: %qs",
field.get_field_name ().as_string ().c_str ());
}
}
@ -111,7 +111,7 @@ public:
if (should_warn (hirId) && !stct.get_visibility ().is_public ())
{
rust_warning_at (stct.get_locus (), 0,
"struct is never constructed: %<%s%>",
"struct is never constructed: %qs",
stct.get_identifier ().as_string ().c_str ());
}
}

View file

@ -1631,7 +1631,7 @@ Lexer::parse_partial_unicode_escape ()
else
{
rust_error_at (get_current_location (),
"invalid character %<%s%> in unicode escape",
"invalid character %qs in unicode escape",
current_char.as_string ().c_str ());
// TODO use utf-8 codepoint to skip whitespaces
while (current_char != '}' && current_char != '{'
@ -1896,7 +1896,7 @@ Lexer::parse_raw_byte_string (location_t loc)
else if (current_char.value > 127)
{
rust_error_at (get_current_location (),
"character %<%s%> in raw byte string out of range",
"character %qs in raw byte string out of range",
current_char.as_string ().c_str ());
current_char = 0;
}

View file

@ -191,7 +191,7 @@ Token::get_str () const
if (str == NULL)
{
rust_error_at (get_locus (),
"attempted to get string for %<%s%>, which has no string. "
"attempted to get string for %qs, which has no string. "
"returning empty string instead",
get_token_description ());
return empty;

View file

@ -244,7 +244,7 @@ PublicInterface::write_to_path (const std::string &path) const
{
rust_error_at (UNDEF_LOCATION,
"expected metadata-output path to have base file name of: "
"%<%s%> got %<%s%>",
"%qs got %qs",
expected_file_name.c_str (), path_base_name);
return;
}
@ -269,7 +269,7 @@ PublicInterface::write_to_path (const std::string &path) const
if (nfd == NULL)
{
rust_error_at (UNDEF_LOCATION,
"failed to open file %<%s%> for writing: %s",
"failed to open file %qs for writing: %s",
path.c_str (), xstrerror (errno));
return;
}
@ -277,7 +277,7 @@ PublicInterface::write_to_path (const std::string &path) const
// write data
if (fwrite (kMagicHeader, sizeof (kMagicHeader), 1, nfd) < 1)
{
rust_error_at (UNDEF_LOCATION, "failed to write to file %<%s%>: %s",
rust_error_at (UNDEF_LOCATION, "failed to write to file %qs: %s",
path.c_str (), xstrerror (errno));
fclose (nfd);
return;
@ -285,7 +285,7 @@ PublicInterface::write_to_path (const std::string &path) const
if (fwrite (checksum, sizeof (checksum), 1, nfd) < 1)
{
rust_error_at (UNDEF_LOCATION, "failed to write to file %<%s%>: %s",
rust_error_at (UNDEF_LOCATION, "failed to write to file %qs: %s",
path.c_str (), xstrerror (errno));
fclose (nfd);
return;
@ -293,7 +293,7 @@ PublicInterface::write_to_path (const std::string &path) const
if (fwrite (kSzDelim, sizeof (kSzDelim), 1, nfd) < 1)
{
rust_error_at (UNDEF_LOCATION, "failed to write to file %<%s%>: %s",
rust_error_at (UNDEF_LOCATION, "failed to write to file %qs: %s",
path.c_str (), xstrerror (errno));
fclose (nfd);
return;
@ -302,7 +302,7 @@ PublicInterface::write_to_path (const std::string &path) const
if (fwrite (current_crate_name.c_str (), current_crate_name.size (), 1, nfd)
< 1)
{
rust_error_at (UNDEF_LOCATION, "failed to write to file %<%s%>: %s",
rust_error_at (UNDEF_LOCATION, "failed to write to file %qs: %s",
path.c_str (), xstrerror (errno));
fclose (nfd);
return;
@ -310,7 +310,7 @@ PublicInterface::write_to_path (const std::string &path) const
if (fwrite (kSzDelim, sizeof (kSzDelim), 1, nfd) < 1)
{
rust_error_at (UNDEF_LOCATION, "failed to write to file %<%s%>: %s",
rust_error_at (UNDEF_LOCATION, "failed to write to file %qs: %s",
path.c_str (), xstrerror (errno));
fclose (nfd);
return;
@ -318,7 +318,7 @@ PublicInterface::write_to_path (const std::string &path) const
if (fwrite (size_buffer.c_str (), size_buffer.size (), 1, nfd) < 1)
{
rust_error_at (UNDEF_LOCATION, "failed to write to file %<%s%>: %s",
rust_error_at (UNDEF_LOCATION, "failed to write to file %qs: %s",
path.c_str (), xstrerror (errno));
fclose (nfd);
return;
@ -326,7 +326,7 @@ PublicInterface::write_to_path (const std::string &path) const
if (fwrite (kSzDelim, sizeof (kSzDelim), 1, nfd) < 1)
{
rust_error_at (UNDEF_LOCATION, "failed to write to file %<%s%>: %s",
rust_error_at (UNDEF_LOCATION, "failed to write to file %qs: %s",
path.c_str (), xstrerror (errno));
fclose (nfd);
return;
@ -335,7 +335,7 @@ PublicInterface::write_to_path (const std::string &path) const
if (!buf.empty ())
if (fwrite (buf.c_str (), buf.size (), 1, nfd) < 1)
{
rust_error_at (UNDEF_LOCATION, "failed to write to file %<%s%>: %s",
rust_error_at (UNDEF_LOCATION, "failed to write to file %qs: %s",
path.c_str (), xstrerror (errno));
fclose (nfd);
return;

View file

@ -146,7 +146,7 @@ peculiar_fragment_match_compatible_fragment (
if (!is_valid)
rust_error_at (
match_locus,
"fragment specifier %<%s%> is not allowed after %<%s%> fragments",
"fragment specifier %qs is not allowed after %qs fragments",
spec.as_string ().c_str (), last_spec.as_string ().c_str ());
return is_valid;
@ -299,7 +299,7 @@ peculiar_fragment_match_compatible (const AST::MacroMatchFragment &last_match,
break;
}
rust_error_at (error_locus, "%s is not allowed after %<%s%> fragment",
rust_error_at (error_locus, "%s is not allowed after %qs fragment",
kind_str.c_str (),
last_match.get_frag_spec ().as_string ().c_str ());
auto allowed_toks_str

View file

@ -63,7 +63,7 @@ ResolvePath::resolve_path (AST::PathInExpression &expr)
if (in_middle_of_path && segment.is_lower_self_seg ())
{
rust_error_at (segment.get_locus (), ErrorCode::E0433,
"failed to resolve: %<%s%> in paths can only be used "
"failed to resolve: %qs in paths can only be used "
"in start position",
segment.as_string ().c_str ());
return UNKNOWN_NODEID;
@ -187,7 +187,7 @@ ResolvePath::resolve_path (AST::PathInExpression &expr)
else
{
rust_error_at (segment.get_locus (),
"Cannot find path %<%s%> in this scope",
"Cannot find path %qs in this scope",
segment.as_string ().c_str ());
return UNKNOWN_NODEID;
}
@ -207,7 +207,7 @@ ResolvePath::resolve_path (AST::PathInExpression &expr)
else if (is_first_segment)
{
rust_error_at (segment.get_locus (), ErrorCode::E0433,
"Cannot find path %<%s%> in this scope",
"Cannot find path %qs in this scope",
segment.as_string ().c_str ());
return UNKNOWN_NODEID;
}
@ -326,7 +326,7 @@ ResolvePath::resolve_path (AST::SimplePath &expr)
else
{
rust_error_at (segment.get_locus (),
"Cannot find path %<%s%> in this scope",
"Cannot find path %qs in this scope",
segment.as_string ().c_str ());
return UNKNOWN_NODEID;
}
@ -374,7 +374,7 @@ ResolvePath::resolve_path (AST::SimplePath &expr)
if (resolved_node_id == UNKNOWN_NODEID)
{
rust_error_at (segment.get_locus (),
"cannot find simple path segment %<%s%> in this scope",
"cannot find simple path segment %qs in this scope",
segment.as_string ().c_str ());
return UNKNOWN_NODEID;
}

View file

@ -440,7 +440,7 @@ public:
found_crate_num);
if (!found)
{
rust_error_at (extern_crate.get_locus (), "unknown crate %<%s%>",
rust_error_at (extern_crate.get_locus (), "unknown crate %qs",
extern_crate.get_referenced_crate ().c_str ());
return;
}

View file

@ -99,7 +99,7 @@ ResolveRelativeTypePath::go (AST::TypePath &path, NodeId &resolved_node_id)
if (in_middle_of_path && segment->is_lower_self_seg ())
{
rust_error_at (segment->get_locus (), ErrorCode::E0433,
"failed to resolve: %<%s%> in paths can only be used "
"failed to resolve: %qs in paths can only be used "
"in start position",
segment->as_string ().c_str ());
return false;
@ -221,7 +221,7 @@ ResolveRelativeTypePath::go (AST::TypePath &path, NodeId &resolved_node_id)
else
{
rust_error_at (segment->get_locus (),
"Cannot find path %<%s%> in this scope",
"Cannot find path %qs in this scope",
segment->as_string ().c_str ());
return false;
}

View file

@ -147,7 +147,7 @@ validate_crate_name (const std::string &crate_name, Error &error)
if (!(is_alphabetic (c.value) || is_numeric (c.value) || c.value == '_'))
{
error = Error (UNDEF_LOCATION,
"invalid character %<%s%> in crate name: %<%s%>",
"invalid character %qs in crate name: %qs",
c.as_string ().c_str (), crate_name.c_str ());
return false;
}
@ -1086,7 +1086,7 @@ Session::load_extern_crate (const std::string &crate_name, location_t locus)
if (stream == NULL // No stream and
&& proc_macros.empty ()) // no proc macros
{
rust_error_at (locus, "failed to locate crate %<%s%>",
rust_error_at (locus, "failed to locate crate %qs",
import_name.c_str ());
return UNKNOWN_NODEID;
}
@ -1110,7 +1110,7 @@ Session::load_extern_crate (const std::string &crate_name, location_t locus)
const std::string current_crate_name = mappings->get_current_crate_name ();
if (current_crate_name.compare (extern_crate.get_crate_name ()) == 0)
{
rust_error_at (locus, "current crate name %<%s%> collides with this",
rust_error_at (locus, "current crate name %qs collides with this",
current_crate_name.c_str ());
return UNKNOWN_NODEID;
}

View file

@ -921,7 +921,7 @@ TypeCheckExpr::visit (HIR::ArrayIndexExpr &expr)
r.add_range (expr.get_array_expr ()->get_locus ());
r.add_range (expr.get_index_expr ()->get_locus ());
rust_error_at (r, ErrorCode::E0277,
"the type %<%s%> cannot be indexed by %<%s%>",
"the type %qs cannot be indexed by %qs",
array_expr_ty->get_name ().c_str (),
index_expr_ty->get_name ().c_str ());
}
@ -1593,7 +1593,7 @@ TypeCheckExpr::visit (HIR::ClosureExpr &expr)
// FIXME
// we need to have a unified way or error'ing when we are missing lang
// items that is useful
rust_fatal_error (expr.get_locus (), "unable to find lang item: %<%s%>",
rust_fatal_error (expr.get_locus (), "unable to find lang item: %qs",
LangItem::ToString (lang_item_type).c_str ());
}
rust_assert (lang_item_defined);
@ -1904,7 +1904,7 @@ TypeCheckExpr::resolve_fn_trait_call (HIR::CallExpr &expr,
r.add_range (c.candidate.locus);
rust_error_at (
r, "multiple candidates found for function trait method call %<%s%>",
r, "multiple candidates found for function trait method call %qs",
method_name.as_string ().c_str ());
return false;
}

View file

@ -610,7 +610,7 @@ TypeCheckImplItemWithTrait::visit (HIR::ConstantItem &constant)
r.add_range (resolved_trait_item.get_locus ());
rust_error_at (
r, "constant %<%s%> has an incompatible type for trait %<%s%>",
r, "constant %qs has an incompatible type for trait %qs",
constant.get_identifier ().as_string ().c_str (),
trait_reference.get_name ().c_str ());
}
@ -636,7 +636,7 @@ TypeCheckImplItemWithTrait::visit (HIR::TypeAlias &type)
{
rich_location r (line_table, type.get_locus ());
r.add_range (trait_reference.get_locus ());
rust_error_at (r, "type alias %<%s%> is not a member of trait %<%s%>",
rust_error_at (r, "type alias %qs is not a member of trait %qs",
type.get_new_type_name ().as_string ().c_str (),
trait_reference.get_name ().c_str ());
return;
@ -661,7 +661,7 @@ TypeCheckImplItemWithTrait::visit (HIR::TypeAlias &type)
r.add_range (resolved_trait_item.get_locus ());
rust_error_at (
r, "type alias %<%s%> has an incompatible type for trait %<%s%>",
r, "type alias %qs has an incompatible type for trait %qs",
type.get_new_type_name ().as_string ().c_str (),
trait_reference.get_name ().c_str ());
}
@ -696,7 +696,7 @@ TypeCheckImplItemWithTrait::visit (HIR::Function &function)
{
rich_location r (line_table, function.get_locus ());
r.add_range (trait_reference.get_locus ());
rust_error_at (r, "method %<%s%> is not a member of trait %<%s%>",
rust_error_at (r, "method %qs is not a member of trait %qs",
function.get_function_name ().as_string ().c_str (),
trait_reference.get_name ().c_str ());
return;
@ -721,7 +721,7 @@ TypeCheckImplItemWithTrait::visit (HIR::Function &function)
r.add_range (resolved_trait_item.get_locus ());
rust_error_at (r, ErrorCode::E0053,
"method %<%s%> has an incompatible type for trait %<%s%>",
"method %qs has an incompatible type for trait %qs",
function.get_function_name ().as_string ().c_str (),
trait_reference.get_name ().c_str ());
}

View file

@ -767,7 +767,7 @@ TypeCheckItem::validate_trait_impl_block (
}
rust_error_at (r, ErrorCode::E0046,
"missing %s in implementation of trait %<%s%>",
"missing %s in implementation of trait %qs",
missing_items_buf.c_str (),
trait_reference->get_name ().c_str ());
}

View file

@ -279,7 +279,7 @@ TypeCheckStructExpr::visit (HIR::StructExprFieldIdentifierValue &field)
repeat_location.add_range (prev_field_locus);
rust_error_at (repeat_location, ErrorCode::E0062,
"field %<%s%> specified more than once",
"field %qs specified more than once",
field.field_name.as_string ().c_str ());
return false;
}
@ -325,7 +325,7 @@ TypeCheckStructExpr::visit (HIR::StructExprFieldIndexValue &field)
repeat_location.add_range (prev_field_locus);
rust_error_at (repeat_location, ErrorCode::E0062,
"field %<%s%> specified more than once",
"field %qs specified more than once",
field_name.c_str ());
return false;
}
@ -370,7 +370,7 @@ TypeCheckStructExpr::visit (HIR::StructExprFieldIdentifier &field)
repeat_location.add_range (prev_field_locus);
rust_error_at (repeat_location, ErrorCode::E0062,
"field %<%s%> specified more than once",
"field %qs specified more than once",
field.get_field_name ().as_string ().c_str ());
return false;
}

View file

@ -60,7 +60,7 @@ TypeCheckCallExpr::visit (ADTType &type)
{
rust_error_at (
call.get_locus (), ErrorCode::E0423,
"expected function, tuple struct or tuple variant, found struct %<%s%>",
"expected function, tuple struct or tuple variant, found struct %qs",
type.get_name ().c_str ());
return;
}

View file

@ -408,7 +408,7 @@ BaseType::bounds_compatible (const BaseType &other, location_t locus,
if (emit_error)
{
rust_error_at (r, ErrorCode::E0277,
"bounds not satisfied for %s %<%s%> is not satisfied",
"bounds not satisfied for %s %qs is not satisfied",
other.get_name ().c_str (), missing_preds.c_str ());
// rust_assert (!emit_error);
}

View file

@ -135,7 +135,7 @@ UnifyRules::emit_abi_mismatch (const TyTy::FnType &expected,
rich_location r (line_table, locus);
r.add_range (lhs.get_locus ());
r.add_range (rhs.get_locus ());
rust_error_at (r, "mistached abi %<%s%> got %<%s%>",
rust_error_at (r, "mistached abi %qs got %qs",
get_string_from_abi (expected.get_abi ()).c_str (),
get_string_from_abi (got.get_abi ()).c_str ());
}

View file

@ -653,7 +653,7 @@ AttributeChecker::visit (AST::Function &fun)
if (!attribute.has_attr_input ())
{
rust_error_at (attribute.get_locus (),
"malformed %<%s%> attribute input", name);
"malformed %qs attribute input", name);
rust_inform (
attribute.get_locus (),
"must be of the form: %<#[proc_macro_derive(TraitName, "

View file

@ -457,7 +457,7 @@ maybe_warn_read_write_only (tree fndecl, gimple *stmt, tree arg, tree ptr)
location_t parmloc = DECL_SOURCE_LOCATION (parm);
inform (parmloc, "accessing argument %u of a function declared with "
"attribute %<%s%>",
"attribute %qs",
argno + 1, access_str);
break;
@ -880,14 +880,14 @@ maybe_warn_pass_by_reference (gcall *stmt, wlimits &wlims)
{
location_t loc = DECL_SOURCE_LOCATION (fndecl);
inform (loc, "in a call to %qD declared with "
"attribute %<%s%> here", fndecl, access_str);
"attribute %qs here", fndecl, access_str);
}
else
{
/* Handle calls through function pointers. */
location_t loc = gimple_location (stmt);
inform (loc, "in a call to %qT declared with "
"attribute %<%s%>", fntype, access_str);
"attribute %qs", fntype, access_str);
}
}
else

View file

@ -648,7 +648,7 @@ cpp_valid_state (cpp_reader *r, const char *name, int fd)
if (CPP_OPTION (r, warn_invalid_pch))
cpp_warning_syshdr (r, CPP_W_INVALID_PCH,
"%s: not used because %<%.*s%> defined as "
"%<%s%> not %<%.*s%>",
"%qs not %<%.*s%>",
name, m.name_length, namebuf,
newdefn + m.name_length,
m.definition_length - m.name_length,