+2017-10-31 David Malcolm <dmalcolm@redhat.com>
+
+ * auto-profile.c (autofdo_source_profile::read): Use
+ UNKNOWN_LOCATION rather than 0.
+ * diagnostic-core.h (warning_at_rich_loc): Rename to...
+ (warning_at): ...this overload.
+ (warning_at_rich_loc_n): Rename to...
+ (warning_n): ...this overload.
+ (error_at_rich_loc): Rename to...
+ (error_at): ...this overload.
+ (pedwarn_at_rich_loc): Rename to...
+ (pedwarn): ...this overload.
+ (permerror_at_rich_loc): Rename to...
+ (permerror): ...this overload.
+ (inform_at_rich_loc): Rename to...
+ (inform): ...this overload.
+ * diagnostic.c: (diagnostic_n_impl): Delete location_t-based decl.
+ (diagnostic_n_impl_richloc): Rename to...
+ (diagnostic_n_impl): ...this rich_location *-based decl.
+ (inform_at_rich_loc): Rename to...
+ (inform): ...this, and add an assertion.
+ (inform_n): Update for removal of location_t-based diagnostic_n_impl.
+ (warning_at_rich_loc): Rename to...
+ (warning_at): ...this, and add an assertion.
+ (warning_at_rich_loc_n): Rename to...
+ (warning_n): ...this, and add an assertion.
+ (warning_n): Update location_t-based implementation for removal of
+ location_t-based diagnostic_n_impl.
+ (pedwarn_at_rich_loc): Rename to...
+ (pedwarn): ...this, and add an assertion.
+ (permerror_at_rich_loc): Rename to...
+ (permerror): ...this, and add an assertion.
+ (error_n): Update for removal of location_t-based diagnostic_n_impl.
+ (error_at_rich_loc): Rename to...
+ (error_at): ...this, and add an assertion.
+ * gcc.c (do_spec_1): Use UNKNOWN_LOCATION rather than 0.
+ (driver::do_spec_on_infiles): Likewise.
+ * substring-locations.c (format_warning_va): Update for renaming
+ of inform_at_rich_loc.
+
2017-10-31 Michael Meissner <meissner@linux.vnet.ibm.com>
* builtins.def (DEF_FLOATN_BUILTIN): Change most _Float<N> and
{
if (gcov_read_unsigned () != GCOV_TAG_AFDO_FUNCTION)
{
- inform (0, "Not expected TAG.");
+ inform (UNKNOWN_LOCATION, "Not expected TAG.");
return false;
}
+2017-10-31 David Malcolm <dmalcolm@redhat.com>
+
+ * c-common.c (binary_op_error): Update for renaming of
+ error_at_rich_loc.
+ (c_parse_error): Likewise.
+ * c-warn.c (warn_logical_not_parentheses): Likewise for
+ renaming of inform_at_rich_loc.
+ (warn_for_restrict): Likewise for renaming of
+ warning_at_rich_loc_n.
+
2017-10-30 Joseph Myers <joseph@codesourcery.com>
* c.opt (std=c17, std=gnu17, std=iso9899:2017): New options.
default:
gcc_unreachable ();
}
- error_at_rich_loc (richloc,
- "invalid operands to binary %s (have %qT and %qT)",
- opname, type0, type1);
+ error_at (richloc,
+ "invalid operands to binary %s (have %qT and %qT)",
+ opname, type0, type1);
}
\f
/* Given an expression as a tree, return its original type. Do this
else
message = catenate_messages (gmsgid, " before %s'\\x%x'");
- error_at_rich_loc (richloc, message, prefix, val);
+ error_at (richloc, message, prefix, val);
free (message);
message = NULL;
}
else if (token_type == CPP_NAME)
{
message = catenate_messages (gmsgid, " before %qE");
- error_at_rich_loc (richloc, message, value);
+ error_at (richloc, message, value);
free (message);
message = NULL;
}
else if (token_type < N_TTYPES)
{
message = catenate_messages (gmsgid, " before %qs token");
- error_at_rich_loc (richloc, message, cpp_type2name (token_type, token_flags));
+ error_at (richloc, message, cpp_type2name (token_type, token_flags));
free (message);
message = NULL;
}
else
- error_at_rich_loc (richloc, gmsgid);
+ error_at (richloc, gmsgid);
if (message)
{
- error_at_rich_loc (richloc, message);
+ error_at (richloc, message);
free (message);
}
#undef catenate_messages
rich_location richloc (line_table, lhs_loc);
richloc.add_fixit_insert_before (lhs_loc, "(");
richloc.add_fixit_insert_after (lhs_loc, ")");
- inform_at_rich_loc (&richloc, "add parentheses around left hand side "
- "expression to silence this warning");
+ inform (&richloc, "add parentheses around left hand side "
+ "expression to silence this warning");
}
}
richloc.add_range (EXPR_LOCATION (arg), false);
}
- warning_at_rich_loc_n (&richloc, OPT_Wrestrict, arg_positions.length (),
- "passing argument %i to restrict-qualified parameter"
- " aliases with argument %Z",
- "passing argument %i to restrict-qualified parameter"
- " aliases with arguments %Z",
- param_pos + 1, arg_positions.address (),
- arg_positions.length ());
+ warning_n (&richloc, OPT_Wrestrict, arg_positions.length (),
+ "passing argument %i to restrict-qualified parameter"
+ " aliases with argument %Z",
+ "passing argument %i to restrict-qualified parameter"
+ " aliases with arguments %Z",
+ param_pos + 1, arg_positions.address (),
+ arg_positions.length ());
}
/* Callback function to determine whether an expression TP or one of its
+2017-10-31 David Malcolm <dmalcolm@redhat.com>
+
+ * c-decl.c (implicit_decl_warning): Update for renaming of
+ pedwarn_at_rich_loc and warning_at_rich_loc.
+ (implicitly_declare): Likewise for renaming of inform_at_rich_loc.
+ (undeclared_variable): Likewise for renaming of error_at_rich_loc.
+ * c-parser.c (c_parser_declaration_or_fndef): Likewise.
+ (c_parser_struct_or_union_specifier): Likewise for renaming of
+ pedwarn_at_rich_loc.
+ (c_parser_parameter_declaration): Likewise for renaming of
+ error_at_rich_loc.
+ * c-typeck.c (build_component_ref): Likewise.
+ (build_unary_op): Likewise for renaming of inform_at_rich_loc.
+ (pop_init_level): Likewise for renaming of warning_at_rich_loc.
+ (set_init_label): Likewise for renaming of error_at_rich_loc.
+
2017-10-30 Richard Biener <rguenther@suse.de>
* gimple-parser.c (c_parser_gimple_statement): Parse conditional
{
gcc_rich_location richloc (loc);
richloc.add_fixit_replace (hint);
- warned = pedwarn_at_rich_loc
- (&richloc, OPT_Wimplicit_function_declaration,
- "implicit declaration of function %qE; did you mean %qs?",
- id, hint);
+ warned = pedwarn (&richloc, OPT_Wimplicit_function_declaration,
+ "implicit declaration of function %qE;"
+ " did you mean %qs?",
+ id, hint);
}
else
warned = pedwarn (loc, OPT_Wimplicit_function_declaration,
{
gcc_rich_location richloc (loc);
richloc.add_fixit_replace (hint);
- warned = warning_at_rich_loc
+ warned = warning_at
(&richloc, OPT_Wimplicit_function_declaration,
G_("implicit declaration of function %qE; did you mean %qs?"),
id, hint);
{
rich_location richloc (line_table, loc);
maybe_add_include_fixit (&richloc, header);
- inform_at_rich_loc
- (&richloc,
- "include %qs or provide a declaration of %qD",
- header, decl);
+ inform (&richloc,
+ "include %qs or provide a declaration of %qD",
+ header, decl);
}
newtype = TREE_TYPE (decl);
}
{
gcc_rich_location richloc (loc);
richloc.add_fixit_replace (guessed_id);
- error_at_rich_loc (&richloc,
- "%qE undeclared here (not in a function);"
- " did you mean %qs?",
- id, guessed_id);
+ error_at (&richloc,
+ "%qE undeclared here (not in a function);"
+ " did you mean %qs?",
+ id, guessed_id);
}
else
error_at (loc, "%qE undeclared here (not in a function)", id);
{
gcc_rich_location richloc (loc);
richloc.add_fixit_replace (guessed_id);
- error_at_rich_loc
- (&richloc,
- "%qE undeclared (first use in this function);"
- " did you mean %qs?",
- id, guessed_id);
+ error_at (&richloc,
+ "%qE undeclared (first use in this function);"
+ " did you mean %qs?",
+ id, guessed_id);
}
else
error_at (loc, "%qE undeclared (first use in this function)", id);
{
/* This is not C++ with its implicit typedef. */
richloc.add_fixit_insert_before ("struct ");
- error_at_rich_loc (&richloc,
- "unknown type name %qE;"
- " use %<struct%> keyword to refer to the type",
- name);
+ error_at (&richloc,
+ "unknown type name %qE;"
+ " use %<struct%> keyword to refer to the type",
+ name);
}
else if (tag_exists_p (UNION_TYPE, name))
{
richloc.add_fixit_insert_before ("union ");
- error_at_rich_loc (&richloc,
- "unknown type name %qE;"
- " use %<union%> keyword to refer to the type",
- name);
+ error_at (&richloc,
+ "unknown type name %qE;"
+ " use %<union%> keyword to refer to the type",
+ name);
}
else if (tag_exists_p (ENUMERAL_TYPE, name))
{
richloc.add_fixit_insert_before ("enum ");
- error_at_rich_loc (&richloc,
- "unknown type name %qE;"
- " use %<enum%> keyword to refer to the type",
- name);
+ error_at (&richloc,
+ "unknown type name %qE;"
+ " use %<enum%> keyword to refer to the type",
+ name);
}
else
{
if (hint)
{
richloc.add_fixit_replace (hint);
- error_at_rich_loc (&richloc,
- "unknown type name %qE; did you mean %qs?",
- name, hint);
+ error_at (&richloc,
+ "unknown type name %qE; did you mean %qs?",
+ name, hint);
}
else
error_at (here, "unknown type name %qE", name);
= c_parser_peek_token (parser)->location;
gcc_rich_location richloc (semicolon_loc);
richloc.add_fixit_remove ();
- pedwarn_at_rich_loc
- (&richloc, OPT_Wpedantic,
- "extra semicolon in struct or union specified");
+ pedwarn (&richloc, OPT_Wpedantic,
+ "extra semicolon in struct or union specified");
c_parser_consume_token (parser);
continue;
}
{
gcc_rich_location richloc (token->location);
richloc.add_fixit_replace (hint);
- error_at_rich_loc (&richloc,
- "unknown type name %qE; did you mean %qs?",
- token->value, hint);
+ error_at (&richloc,
+ "unknown type name %qE; did you mean %qs?",
+ token->value, hint);
}
else
error_at (token->location, "unknown type name %qE", token->value);
gcc_rich_location rich_loc (reported_loc);
if (component_loc != UNKNOWN_LOCATION)
rich_loc.add_fixit_misspelled_id (component_loc, guessed_id);
- error_at_rich_loc
- (&rich_loc,
- "%qT has no member named %qE; did you mean %qE?",
- type, component, guessed_id);
+ error_at (&rich_loc,
+ "%qT has no member named %qE; did you mean %qE?",
+ type, component, guessed_id);
}
else
error_at (loc, "%qT has no member named %qE", type, component);
rich_location richloc (line_table, loc);
/* "loc" should be the "." token. */
richloc.add_fixit_replace ("->");
- error_at_rich_loc (&richloc,
- "%qE is a pointer; did you mean to use %<->%>?",
- datum);
+ error_at (&richloc,
+ "%qE is a pointer; did you mean to use %<->%>?",
+ datum);
return error_mark_node;
}
else if (code != ERROR_MARK)
{
gcc_rich_location richloc (location);
richloc.add_fixit_insert_before (location, "!");
- inform_at_rich_loc (&richloc, "did you mean to use logical "
- "not?");
+ inform (&richloc, "did you mean to use logical not?");
}
if (!noconvert)
arg = default_conversion (arg);
&& !constructor_zeroinit)
{
gcc_assert (initializer_stack->missing_brace_richloc);
- warning_at_rich_loc (initializer_stack->missing_brace_richloc,
- OPT_Wmissing_braces,
- "missing braces around initializer");
+ warning_at (initializer_stack->missing_brace_richloc,
+ OPT_Wmissing_braces,
+ "missing braces around initializer");
}
/* Warn when some struct elements are implicitly initialized to zero. */
{
gcc_rich_location rich_loc (fieldname_loc);
rich_loc.add_fixit_misspelled_id (fieldname_loc, guessed_id);
- error_at_rich_loc
- (&rich_loc,
- "%qT has no member named %qE; did you mean %qE?",
- constructor_type, fieldname, guessed_id);
+ error_at (&rich_loc,
+ "%qT has no member named %qE; did you mean %qE?",
+ constructor_type, fieldname, guessed_id);
}
else
error_at (fieldname_loc, "%qT has no member named %qE",
+2017-10-31 David Malcolm <dmalcolm@redhat.com>
+
+ * class.c (explain_non_literal_class): Use UNKNOWN_LOCATION rather
+ than 0.
+ * name-lookup.c (suggest_alternatives_for): Update for renaming of
+ inform_at_rich_loc.
+ (maybe_suggest_missing_header): Likewise.
+ (suggest_alternative_in_explicit_scope): Likewise.
+ * parser.c (cp_parser_diagnose_invalid_type_name): Likewise for
+ renaming of error_at_rich_loc.
+ (cp_parser_string_literal): Likewise.
+ (cp_parser_nested_name_specifier_opt): Likewise.
+ (cp_parser_cast_expression): Likewise for renaming of
+ warning_at_rich_loc.
+ (cp_parser_decl_specifier_seq): Likewise for renaming of
+ error_at_rich_loc and warning_at_rich_loc.
+ (cp_parser_elaborated_type_specifier): Likewise for renaming of
+ pedwarn_at_rich_loc.
+ (cp_parser_cv_qualifier_seq_opt): Likewise for renaming of
+ error_at_rich_loc.
+ (cp_parser_virt_specifier_seq_opt): Likewise.
+ (cp_parser_class_specifier_1): Likewise.
+ (cp_parser_class_head): Likewise.
+ (cp_parser_member_declaration): Likewise for renaming of
+ pedwarn_at_rich_loc, warning_at_rich_loc, and error_at_rich_loc.
+ (cp_parser_enclosed_template_argument_list): Likewise for renaming
+ of error_at_rich_loc.
+ (set_and_check_decl_spec_loc): Likewise.
+ * pt.c (listify): Likewise.
+ * rtti.c (typeid_ok_p): Likewise.
+ * semantics.c (process_outer_var_ref): Use UNKNOWN_LOCATION rather
+ than 0.
+ * typeck.c (access_failure_info::maybe_suggest_accessor): Update
+ for renaming of inform_at_rich_loc.
+ (finish_class_member_access_expr): Likewise for renaming of
+ error_at_rich_loc.
+
2017-10-31 Nathan Sidwell <nathan@acm.org>
* cp-tree.h (struct operator_name_info_t): Rename to ...
/* Already explained. */
return;
- inform (0, "%q+T is not literal because:", t);
+ inform (UNKNOWN_LOCATION, "%q+T is not literal because:", t);
if (cxx_dialect < cxx17 && LAMBDA_TYPE_P (t))
- inform (0, " %qT is a closure type, which is only literal in "
+ inform (UNKNOWN_LOCATION,
+ " %qT is a closure type, which is only literal in "
"C++17 and later", t);
else if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t))
- inform (0, " %q+T has a non-trivial destructor", t);
+ inform (UNKNOWN_LOCATION, " %q+T has a non-trivial destructor", t);
else if (CLASSTYPE_NON_AGGREGATE (t)
&& !TYPE_HAS_TRIVIAL_DFLT (t)
&& !LAMBDA_TYPE_P (t)
&& !TYPE_HAS_CONSTEXPR_CTOR (t))
{
- inform (0, " %q+T is not an aggregate, does not have a trivial "
+ inform (UNKNOWN_LOCATION,
+ " %q+T is not an aggregate, does not have a trivial "
"default constructor, and has no constexpr constructor that "
"is not a copy or move constructor", t);
if (type_has_non_user_provided_default_constructor (t))
tree basetype = TREE_TYPE (base_binfo);
if (!CLASSTYPE_LITERAL_P (basetype))
{
- inform (0, " base class %qT of %q+T is non-literal",
+ inform (UNKNOWN_LOCATION,
+ " base class %qT of %q+T is non-literal",
basetype, t);
explain_non_literal_class (basetype);
return;
gcc_rich_location richloc (location);
richloc.add_fixit_replace (fuzzy);
- inform_at_rich_loc (&richloc, "suggested alternative: %qs", fuzzy);
+ inform (&richloc, "suggested alternative: %qs", fuzzy);
}
}
gcc_rich_location richloc (location);
maybe_add_include_fixit (&richloc, header_hint);
- inform_at_rich_loc (&richloc,
- "%<std::%s%> is defined in header %qs;"
- " did you forget to %<#include %s%>?",
- name_str, header_hint, header_hint);
+ inform (&richloc,
+ "%<std::%s%> is defined in header %qs;"
+ " did you forget to %<#include %s%>?",
+ name_str, header_hint, header_hint);
return true;
}
{
gcc_rich_location richloc (location);
richloc.add_fixit_replace (fuzzy_name);
- inform_at_rich_loc (&richloc, "suggested alternative: %qs",
- fuzzy_name);
+ inform (&richloc, "suggested alternative: %qs",
+ fuzzy_name);
return true;
}
{
gcc_rich_location richloc (location);
richloc.add_fixit_replace (suggestion);
- error_at_rich_loc (&richloc,
- "%qE does not name a type; did you mean %qs?",
- id, suggestion);
+ error_at (&richloc,
+ "%qE does not name a type; did you mean %qs?",
+ id, suggestion);
}
else
error_at (location, "%qE does not name a type", id);
{
rich_location rich_loc (line_table, tok->location);
rich_loc.add_range (last_tok_loc, false);
- error_at_rich_loc (&rich_loc,
- "unsupported non-standard concatenation "
- "of string literals");
+ error_at (&rich_loc,
+ "unsupported non-standard concatenation "
+ "of string literals");
}
}
{
gcc_rich_location richloc (token->location);
richloc.add_fixit_replace ("::");
- error_at_rich_loc (&richloc,
- "found %<:%> in nested-name-specifier, "
- "expected %<::%>");
+ error_at (&richloc,
+ "found %<:%> in nested-name-specifier, "
+ "expected %<::%>");
token->type = CPP_SCOPE;
}
gcc_rich_location rich_loc (input_location);
maybe_add_cast_fixit (&rich_loc, open_paren_loc, close_paren_loc,
expr, type);
- warning_at_rich_loc (&rich_loc, OPT_Wold_style_cast,
- "use of old-style cast to %q#T", type);
+ warning_at (&rich_loc, OPT_Wold_style_cast,
+ "use of old-style cast to %q#T", type);
}
/* Only type conversions to integral or enumeration types
{
gcc_rich_location richloc (token->location);
richloc.add_fixit_remove ();
- error_at_rich_loc (&richloc, "%<friend%> used outside of class");
+ error_at (&richloc, "%<friend%> used outside of class");
cp_lexer_purge_token (parser->lexer);
}
else
we're complaining about C++0x compatibility. */
gcc_rich_location richloc (token->location);
richloc.add_fixit_remove ();
- warning_at_rich_loc (&richloc, OPT_Wc__11_compat,
- "%<auto%> changes meaning in C++11; "
- "please remove it");
+ warning_at (&richloc, OPT_Wc__11_compat,
+ "%<auto%> changes meaning in C++11; "
+ "please remove it");
/* Set the storage class anyway. */
cp_parser_set_storage_class (parser, decl_specs, RID_AUTO,
gcc_rich_location richloc (token->location);
richloc.add_range (input_location, false);
richloc.add_fixit_remove ();
- pedwarn_at_rich_loc (&richloc, 0, "elaborated-type-specifier for "
- "a scoped enum must not use the %qD keyword",
- token->u.value);
+ pedwarn (&richloc, 0, "elaborated-type-specifier for "
+ "a scoped enum must not use the %qD keyword",
+ token->u.value);
/* Consume the `struct' or `class' and parse it anyway. */
cp_lexer_consume_token (parser->lexer);
}
{
gcc_rich_location richloc (token->location);
richloc.add_fixit_remove ();
- error_at_rich_loc (&richloc, "duplicate cv-qualifier");
+ error_at (&richloc, "duplicate cv-qualifier");
cp_lexer_purge_token (parser->lexer);
}
else
{
gcc_rich_location richloc (token->location);
richloc.add_fixit_remove ();
- error_at_rich_loc (&richloc, "duplicate virt-specifier");
+ error_at (&richloc, "duplicate virt-specifier");
cp_lexer_purge_token (parser->lexer);
}
else
richloc.add_fixit_insert_before (next_loc, ";");
if (CLASSTYPE_DECLARED_CLASS (type))
- error_at_rich_loc (&richloc,
- "expected %<;%> after class definition");
+ error_at (&richloc,
+ "expected %<;%> after class definition");
else if (TREE_CODE (type) == RECORD_TYPE)
- error_at_rich_loc (&richloc,
- "expected %<;%> after struct definition");
+ error_at (&richloc,
+ "expected %<;%> after struct definition");
else if (TREE_CODE (type) == UNION_TYPE)
- error_at_rich_loc (&richloc,
- "expected %<;%> after union definition");
+ error_at (&richloc,
+ "expected %<;%> after union definition");
else
gcc_unreachable ();
rich_location richloc (line_table, reported_loc);
richloc.add_fixit_insert_before (class_head_start_location,
"template <> ");
- error_at_rich_loc
- (&richloc,
- "an explicit specialization must be preceded by %<template <>%>");
+ error_at (&richloc,
+ "an explicit specialization must be preceded by"
+ " %<template <>%>");
invalid_explicit_specialization_p = true;
/* Take the same action that would have been taken by
cp_parser_explicit_specialization. */
{
gcc_rich_location richloc (token->location);
richloc.add_fixit_remove ();
- pedwarn_at_rich_loc (&richloc, OPT_Wpedantic, "extra %<;%>");
+ pedwarn (&richloc, OPT_Wpedantic, "extra %<;%>");
}
}
else
= cp_lexer_consume_token (parser->lexer)->location;
gcc_rich_location richloc (semicolon_loc);
richloc.add_fixit_remove ();
- warning_at_rich_loc (&richloc, OPT_Wextra_semi,
- "extra %<;%> after in-class "
- "function definition");
+ warning_at (&richloc, OPT_Wextra_semi,
+ "extra %<;%> after in-class "
+ "function definition");
}
goto out;
}
cp_token *token = cp_lexer_previous_token (parser->lexer);
gcc_rich_location richloc (token->location);
richloc.add_fixit_remove ();
- error_at_rich_loc (&richloc, "stray %<,%> at end of "
- "member declaration");
+ error_at (&richloc, "stray %<,%> at end of "
+ "member declaration");
}
}
/* If the next token isn't a `;', then we have a parse error. */
cp_token *token = cp_lexer_previous_token (parser->lexer);
gcc_rich_location richloc (token->location);
richloc.add_fixit_insert_after (";");
- error_at_rich_loc (&richloc, "expected %<;%> at end of "
- "member declaration");
+ error_at (&richloc, "expected %<;%> at end of "
+ "member declaration");
/* Assume that the user meant to provide a semicolon. If
we were to cp_parser_skip_to_end_of_statement, we might
cp_token *token = cp_lexer_peek_token (parser->lexer);
gcc_rich_location richloc (token->location);
richloc.add_fixit_replace ("> >");
- error_at_rich_loc (&richloc, "%<>>%> should be %<> >%> "
- "within a nested template argument list");
+ error_at (&richloc, "%<>>%> should be %<> >%> "
+ "within a nested template argument list");
token->type = CPP_GREATER;
}
{
gcc_rich_location richloc (location);
richloc.add_fixit_remove ();
- error_at_rich_loc (&richloc, "duplicate %qD", token->u.value);
+ error_at (&richloc, "duplicate %qD", token->u.value);
}
}
else
};
gcc_rich_location richloc (location);
richloc.add_fixit_remove ();
- error_at_rich_loc (&richloc, "duplicate %qs", decl_spec_names[ds]);
+ error_at (&richloc, "duplicate %qs", decl_spec_names[ds]);
}
}
}
{
gcc_rich_location richloc (input_location);
maybe_add_include_fixit (&richloc, "<initializer_list>");
- error_at_rich_loc (&richloc,
- "deducing from brace-enclosed initializer list"
- " requires #include <initializer_list>");
+ error_at (&richloc,
+ "deducing from brace-enclosed initializer list"
+ " requires #include <initializer_list>");
return error_mark_node;
}
{
gcc_rich_location richloc (input_location);
maybe_add_include_fixit (&richloc, "<typeinfo>");
- error_at_rich_loc (&richloc,
- "must %<#include <typeinfo>%> before using"
- " %<typeid%>");
+ error_at (&richloc,
+ "must %<#include <typeinfo>%> before using"
+ " %<typeid%>");
return false;
}
inform (location_of (closure),
"the lambda has no capture-default");
else if (TYPE_CLASS_SCOPE_P (closure))
- inform (0, "lambda in local class %q+T cannot "
+ inform (UNKNOWN_LOCATION, "lambda in local class %q+T cannot "
"capture variables from the enclosing context",
TYPE_CONTEXT (closure));
inform (DECL_SOURCE_LOCATION (decl), "%q#D declared here", decl);
pretty_printer pp;
pp_printf (&pp, "%s()", IDENTIFIER_POINTER (DECL_NAME (accessor)));
richloc.add_fixit_replace (pp_formatted_text (&pp));
- inform_at_rich_loc (&richloc, "field %q#D can be accessed via %q#D",
- m_field_decl, accessor);
+ inform (&richloc, "field %q#D can be accessed via %q#D",
+ m_field_decl, accessor);
}
/* This function is called by the parser to process a class member
gcc_rich_location rich_loc (bogus_component_loc);
rich_loc.add_fixit_misspelled_id (bogus_component_loc,
guessed_id);
- error_at_rich_loc
- (&rich_loc,
- "%q#T has no member named %qE; did you mean %qE?",
- TREE_CODE (access_path) == TREE_BINFO
- ? TREE_TYPE (access_path) : object_type, name,
- guessed_id);
+ error_at (&rich_loc,
+ "%q#T has no member named %qE;"
+ " did you mean %qE?",
+ TREE_CODE (access_path) == TREE_BINFO
+ ? TREE_TYPE (access_path) : object_type,
+ name, guessed_id);
}
else
error ("%q#T has no member named %qE",
extern bool warning (int, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
extern bool warning_n (location_t, int, int, const char *, const char *, ...)
ATTRIBUTE_GCC_DIAG(4,6) ATTRIBUTE_GCC_DIAG(5,6);
+extern bool warning_n (rich_location *, int, int, const char *,
+ const char *, ...)
+ ATTRIBUTE_GCC_DIAG(4, 6) ATTRIBUTE_GCC_DIAG(5, 6);
extern bool warning_at (location_t, int, const char *, ...)
ATTRIBUTE_GCC_DIAG(3,4);
-extern bool warning_at_rich_loc (rich_location *, int, const char *, ...)
+extern bool warning_at (rich_location *, int, const char *, ...)
ATTRIBUTE_GCC_DIAG(3,4);
-extern bool warning_at_rich_loc_n (rich_location *, int, int, const char *,
- const char *, ...)
- ATTRIBUTE_GCC_DIAG(4, 6) ATTRIBUTE_GCC_DIAG(5, 6);
extern void error (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2);
extern void error_n (location_t, int, const char *, const char *, ...)
ATTRIBUTE_GCC_DIAG(3,5) ATTRIBUTE_GCC_DIAG(4,5);
extern void error_at (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
-extern void error_at_rich_loc (rich_location *, const char *, ...)
+extern void error_at (rich_location *, const char *, ...)
ATTRIBUTE_GCC_DIAG(2,3);
extern void fatal_error (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3)
ATTRIBUTE_NORETURN;
/* Pass one of the OPT_W* from options.h as the second parameter. */
extern bool pedwarn (location_t, int, const char *, ...)
ATTRIBUTE_GCC_DIAG(3,4);
-extern bool pedwarn_at_rich_loc (rich_location *, int, const char *, ...)
+extern bool pedwarn (rich_location *, int, const char *, ...)
ATTRIBUTE_GCC_DIAG(3,4);
extern bool permerror (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
-extern bool permerror_at_rich_loc (rich_location *, const char *,
+extern bool permerror (rich_location *, const char *,
...) ATTRIBUTE_GCC_DIAG(2,3);
extern void sorry (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2);
extern void inform (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
-extern void inform_at_rich_loc (rich_location *, const char *,
- ...) ATTRIBUTE_GCC_DIAG(2,3);
+extern void inform (rich_location *, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
extern void inform_n (location_t, int, const char *, const char *, ...)
ATTRIBUTE_GCC_DIAG(3,5) ATTRIBUTE_GCC_DIAG(4,5);
extern void verbatim (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2);
/* Prototypes. */
static bool diagnostic_impl (rich_location *, int, const char *,
va_list *, diagnostic_t) ATTRIBUTE_GCC_DIAG(3,0);
-static bool diagnostic_n_impl (location_t, int, int, const char *,
+static bool diagnostic_n_impl (rich_location *, int, int, const char *,
const char *, va_list *,
diagnostic_t) ATTRIBUTE_GCC_DIAG(5,0);
-static bool diagnostic_n_impl_richloc (rich_location *, int, int, const char *,
- const char *, va_list *,
- diagnostic_t) ATTRIBUTE_GCC_DIAG(5,0);
static void error_recursion (diagnostic_context *) ATTRIBUTE_NORETURN;
static void real_abort (void) ATTRIBUTE_NORETURN;
va_end (ap);
}
-/* Implement emit_diagnostic, inform, inform_at_rich_loc, warning, warning_at,
- warning_at_rich_loc, pedwarn, permerror, permerror_at_rich_loc, error,
- error_at, error_at_rich_loc, sorry, fatal_error, internal_error, and
- internal_error_no_backtrace, as documented and defined below. */
+/* Implement emit_diagnostic, inform, warning, warning_at, pedwarn,
+ permerror, error, error_at, error_at, sorry, fatal_error, internal_error,
+ and internal_error_no_backtrace, as documented and defined below. */
static bool
diagnostic_impl (rich_location *richloc, int opt,
const char *gmsgid,
return diagnostic_report_diagnostic (global_dc, &diagnostic);
}
-/* Same as diagonostic_n_impl taking rich_location instead of location_t. */
+/* Implement inform_n, warning_n, and error_n, as documented and
+ defined below. */
static bool
-diagnostic_n_impl_richloc (rich_location *richloc, int opt, int n,
- const char *singular_gmsgid,
- const char *plural_gmsgid,
- va_list *ap, diagnostic_t kind)
+diagnostic_n_impl (rich_location *richloc, int opt, int n,
+ const char *singular_gmsgid,
+ const char *plural_gmsgid,
+ va_list *ap, diagnostic_t kind)
{
diagnostic_info diagnostic;
diagnostic_set_info_translated (&diagnostic,
if (kind == DK_WARNING)
diagnostic.option_index = opt;
return diagnostic_report_diagnostic (global_dc, &diagnostic);
-}
-
-/* Implement inform_n, warning_n, and error_n, as documented and
- defined below. */
-static bool
-diagnostic_n_impl (location_t location, int opt, int n,
- const char *singular_gmsgid,
- const char *plural_gmsgid,
- va_list *ap, diagnostic_t kind)
-{
- rich_location richloc (line_table, location);
- return diagnostic_n_impl_richloc (&richloc, opt, n,
- singular_gmsgid, plural_gmsgid, ap, kind);
}
/* Wrapper around diagnostic_impl taking a variable argument list. */
va_end (ap);
}
-/* Same as "inform", but at RICHLOC. */
+/* Same as "inform" above, but at RICHLOC. */
void
-inform_at_rich_loc (rich_location *richloc, const char *gmsgid, ...)
+inform (rich_location *richloc, const char *gmsgid, ...)
{
+ gcc_assert (richloc);
+
va_list ap;
va_start (ap, gmsgid);
diagnostic_impl (richloc, -1, gmsgid, &ap, DK_NOTE);
{
va_list ap;
va_start (ap, plural_gmsgid);
- diagnostic_n_impl (location, -1, n, singular_gmsgid, plural_gmsgid,
+ rich_location richloc (line_table, location);
+ diagnostic_n_impl (&richloc, -1, n, singular_gmsgid, plural_gmsgid,
&ap, DK_NOTE);
va_end (ap);
}
return ret;
}
-/* Same as warning at, but using RICHLOC. */
+/* Same as "warning at" above, but using RICHLOC. */
bool
-warning_at_rich_loc (rich_location *richloc, int opt, const char *gmsgid, ...)
+warning_at (rich_location *richloc, int opt, const char *gmsgid, ...)
{
+ gcc_assert (richloc);
+
va_list ap;
va_start (ap, gmsgid);
bool ret = diagnostic_impl (richloc, opt, gmsgid, &ap, DK_WARNING);
return ret;
}
-/* Same as warning_at_rich_loc but for plural variant. */
+/* Same as warning_n plural variant below, but using RICHLOC. */
bool
-warning_at_rich_loc_n (rich_location *richloc, int opt, int n,
- const char *singular_gmsgid, const char *plural_gmsgid, ...)
+warning_n (rich_location *richloc, int opt, int n,
+ const char *singular_gmsgid, const char *plural_gmsgid, ...)
{
+ gcc_assert (richloc);
+
va_list ap;
va_start (ap, plural_gmsgid);
- bool ret = diagnostic_n_impl_richloc (richloc, opt, n,
- singular_gmsgid, plural_gmsgid,
- &ap, DK_WARNING);
+ bool ret = diagnostic_n_impl (richloc, opt, n,
+ singular_gmsgid, plural_gmsgid,
+ &ap, DK_WARNING);
va_end (ap);
return ret;
}
{
va_list ap;
va_start (ap, plural_gmsgid);
- bool ret = diagnostic_n_impl (location, opt, n,
+ rich_location richloc (line_table, location);
+ bool ret = diagnostic_n_impl (&richloc, opt, n,
singular_gmsgid, plural_gmsgid,
&ap, DK_WARNING);
va_end (ap);
return ret;
}
-/* Same as pedwarn, but using RICHLOC. */
+/* Same as pedwarn above, but using RICHLOC. */
bool
-pedwarn_at_rich_loc (rich_location *richloc, int opt, const char *gmsgid, ...)
+pedwarn (rich_location *richloc, int opt, const char *gmsgid, ...)
{
+ gcc_assert (richloc);
+
va_list ap;
va_start (ap, gmsgid);
bool ret = diagnostic_impl (richloc, opt, gmsgid, &ap, DK_PEDWARN);
return ret;
}
-/* Same as "permerror", but at RICHLOC. */
+/* Same as "permerror" above, but at RICHLOC. */
bool
-permerror_at_rich_loc (rich_location *richloc, const char *gmsgid, ...)
+permerror (rich_location *richloc, const char *gmsgid, ...)
{
+ gcc_assert (richloc);
+
va_list ap;
va_start (ap, gmsgid);
bool ret = diagnostic_impl (richloc, -1, gmsgid, &ap, DK_PERMERROR);
{
va_list ap;
va_start (ap, plural_gmsgid);
- diagnostic_n_impl (location, -1, n, singular_gmsgid, plural_gmsgid,
+ rich_location richloc (line_table, location);
+ diagnostic_n_impl (&richloc, -1, n, singular_gmsgid, plural_gmsgid,
&ap, DK_ERROR);
va_end (ap);
}
/* Same as above, but use RICH_LOC. */
void
-error_at_rich_loc (rich_location *richloc, const char *gmsgid, ...)
+error_at (rich_location *richloc, const char *gmsgid, ...)
{
+ gcc_assert (richloc);
+
va_list ap;
va_start (ap, gmsgid);
diagnostic_impl (richloc, -1, gmsgid, &ap, DK_ERROR);
buf = (char *) alloca (p - q + 1);
strncpy (buf, q, p - q);
buf[p - q] = 0;
- inform (0, "%s", _(buf));
+ inform (UNKNOWN_LOCATION, "%s", _(buf));
if (*p)
p++;
}
else if (compare_debug && debug_check_temp_file[0])
{
if (verbose_flag)
- inform (0, "recompiling with -fcompare-debug");
+ inform (UNKNOWN_LOCATION,
+ "recompiling with -fcompare-debug");
compare_debug = -compare_debug;
n_switches = n_switches_debug_check[1];
debug_check_temp_file[1]));
if (verbose_flag)
- inform (0, "comparing final insns dumps");
+ inform (UNKNOWN_LOCATION, "comparing final insns dumps");
if (compare_files (debug_check_temp_file))
this_file_error = 1;
+2017-10-31 David Malcolm <dmalcolm@redhat.com>
+
+ * objc-gnu-runtime-abi-01.c (objc_gnu_runtime_abi_01_init): Use
+ UNKNOWN_LOCATION rather than 0.
+
2017-10-17 Nathan Sidwell <nathan@acm.org>
* objc-act.c (objc_common_tree_size): Return size of TYPE nodes.
/* GNU runtime does not need the compiler to change code in order to do GC. */
if (flag_objc_gc)
{
- warning_at (0, 0, "%<-fobjc-gc%> is ignored for %<-fgnu-runtime%>");
+ warning_at (UNKNOWN_LOCATION, 0,
+ "%<-fobjc-gc%> is ignored for %<-fgnu-runtime%>");
flag_objc_gc = 0;
}
if (corrected_substring)
substring_richloc.add_fixit_replace (fmt_substring_range,
corrected_substring);
- inform_at_rich_loc (&substring_richloc,
- "format string is defined here");
+ inform (&substring_richloc,
+ "format string is defined here");
}
return warned;
+2017-10-31 David Malcolm <dmalcolm@redhat.com>
+
+ * gcc.dg/plugin/diagnostic_plugin_show_trees.c (show_tree): Update
+ for renaming of error_at_rich_loc and inform_at_rich_loc.
+ * gcc.dg/plugin/diagnostic_plugin_test_show_locus.c
+ (test_show_locus): Likewise for renaming of warning_at_rich_loc.
+
2017-10-31 Martin Liska <mliska@suse.cz>
* g++.dg/gcov/loop.C: New test.
if (richloc.get_num_locations () < 2)
{
- error_at_rich_loc (&richloc, "range not found");
+ error_at (&richloc, "range not found");
return;
}
enum tree_code code = TREE_CODE (node);
location_range *range = richloc.get_range (1);
- inform_at_rich_loc (&richloc, "%s", get_tree_code_name (code));
+ inform (&richloc, "%s", get_tree_code_name (code));
/* Recurse. */
int min_idx = 0;
rich_location richloc (line_table, get_loc (line, 15));
add_range (&richloc, get_loc (line, 10), get_loc (line, 14), false);
add_range (&richloc, get_loc (line, 16), get_loc (line, 16), false);
- warning_at_rich_loc (&richloc, 0, "test");
+ warning_at (&richloc, 0, "test");
}
if (0 == strcmp (fnname, "test_simple_2"))
rich_location richloc (line_table, get_loc (line, 24));
add_range (&richloc, get_loc (line, 6), get_loc (line, 22), false);
add_range (&richloc, get_loc (line, 26), get_loc (line, 43), false);
- warning_at_rich_loc (&richloc, 0, "test");
+ warning_at (&richloc, 0, "test");
}
if (0 == strcmp (fnname, "test_multiline"))
add_range (&richloc, get_loc (line, 7), get_loc (line, 23), false);
add_range (&richloc, get_loc (line + 1, 9), get_loc (line + 1, 26),
false);
- warning_at_rich_loc (&richloc, 0, "test");
+ warning_at (&richloc, 0, "test");
}
if (0 == strcmp (fnname, "test_many_lines"))
add_range (&richloc, get_loc (line, 7), get_loc (line + 4, 65), false);
add_range (&richloc, get_loc (line + 5, 9), get_loc (line + 10, 61),
false);
- warning_at_rich_loc (&richloc, 0, "test");
+ warning_at (&richloc, 0, "test");
}
/* Example of a rich_location where the range is larger than
location_t start = get_loc (line, 12);
location_t finish = get_loc (line, 16);
rich_location richloc (line_table, make_location (start, start, finish));
- warning_at_rich_loc (&richloc, 0, "test");
+ warning_at (&richloc, 0, "test");
}
/* Example of a single-range location where the range starts
add_range (&richloc, caret_b, caret_b, true);
global_dc->caret_chars[0] = 'A';
global_dc->caret_chars[1] = 'B';
- warning_at_rich_loc (&richloc, 0, "test");
+ warning_at (&richloc, 0, "test");
global_dc->caret_chars[0] = '^';
global_dc->caret_chars[1] = '^';
}
rich_location richloc (line_table, make_location (start, start, finish));
richloc.add_fixit_insert_before ("{");
richloc.add_fixit_insert_after ("}");
- warning_at_rich_loc (&richloc, 0, "example of insertion hints");
+ warning_at (&richloc, 0, "example of insertion hints");
}
if (0 == strcmp (fnname, "test_fixit_insert_newline"))
location_t case_loc = make_location (case_start, case_start, case_finish);
rich_location richloc (line_table, case_loc);
richloc.add_fixit_insert_before (line_start, " break;\n");
- warning_at_rich_loc (&richloc, 0, "example of newline insertion hint");
+ warning_at (&richloc, 0, "example of newline insertion hint");
}
if (0 == strcmp (fnname, "test_fixit_remove"))
src_range.m_start = start;
src_range.m_finish = finish;
richloc.add_fixit_remove (src_range);
- warning_at_rich_loc (&richloc, 0, "example of a removal hint");
+ warning_at (&richloc, 0, "example of a removal hint");
}
if (0 == strcmp (fnname, "test_fixit_replace"))
src_range.m_start = start;
src_range.m_finish = finish;
richloc.add_fixit_replace (src_range, "gtk_widget_show_all");
- warning_at_rich_loc (&richloc, 0, "example of a replacement hint");
+ warning_at (&richloc, 0, "example of a replacement hint");
}
if (0 == strcmp (fnname, "test_mutually_exclusive_suggestions"))
rich_location richloc (line_table, make_location (start, start, finish));
richloc.add_fixit_replace (src_range, "replacement_1");
richloc.fixits_cannot_be_auto_applied ();
- warning_at_rich_loc (&richloc, 0, "warning 1");
+ warning_at (&richloc, 0, "warning 1");
}
{
rich_location richloc (line_table, make_location (start, start, finish));
richloc.add_fixit_replace (src_range, "replacement_2");
richloc.fixits_cannot_be_auto_applied ();
- warning_at_rich_loc (&richloc, 0, "warning 2");
+ warning_at (&richloc, 0, "warning 2");
}
}
richloc.add_range (caret_b, true);
global_dc->caret_chars[0] = '1';
global_dc->caret_chars[1] = '2';
- warning_at_rich_loc (&richloc, 0, "test");
+ warning_at (&richloc, 0, "test");
global_dc->caret_chars[0] = '^';
global_dc->caret_chars[1] = '^';
}
statically-allocated buffer in class rich_location,
and then trigger a reallocation of the dynamic buffer. */
gcc_assert (richloc.get_num_locations () > 3 + (2 * 16));
- warning_at_rich_loc (&richloc, 0, "test of %i locations",
- richloc.get_num_locations ());
+ warning_at (&richloc, 0, "test of %i locations",
+ richloc.get_num_locations ());
}
}
+2017-10-31 David Malcolm <dmalcolm@redhat.com>
+
+ * directives.c (_cpp_handle_directive): Update for renaming of
+ cpp_error_at_richloc to cpp_error_at.
+ * errors.c (cpp_diagnostic_at_richloc): Rename to...
+ (cpp_diagnostic_at): ...this, dropping the location_t-based
+ implementation.
+ (cpp_diagnostic): Update for removal of location_t-based
+ cpp_diagnostic_at.
+ (cpp_error_at): Likewise.
+ (cpp_error_at_richloc): Rename to...
+ (cpp_error_at): ...this, and update for renaming of
+ cpp_diagnostic_at_richloc.
+ * include/cpplib.h (cpp_error_at_richloc): Rename to...
+ (cpp_error_at): ...this.
+
2017-10-30 Joseph Myers <joseph@codesourcery.com>
* include/cpplib.h (enum c_lang): Add CLK_GNUC17 and CLK_STDC17.
source_range misspelled_token_range
= get_range_from_loc (pfile->line_table, dname->src_loc);
richloc.add_fixit_replace (misspelled_token_range, hint);
- cpp_error_at_richloc (pfile, CPP_DL_ERROR, &richloc,
- "invalid preprocessing directive #%s;"
- " did you mean #%s?",
- unrecognized, hint);
+ cpp_error_at (pfile, CPP_DL_ERROR, &richloc,
+ "invalid preprocessing directive #%s;"
+ " did you mean #%s?",
+ unrecognized, hint);
}
else
cpp_error (pfile, CPP_DL_ERROR,
/* Print a diagnostic at the given location. */
-ATTRIBUTE_FPTR_PRINTF(5,0)
-static bool
-cpp_diagnostic_at_richloc (cpp_reader * pfile, int level, int reason,
- rich_location *richloc,
- const char *msgid, va_list *ap)
-{
- bool ret;
-
- if (!pfile->cb.error)
- abort ();
- ret = pfile->cb.error (pfile, level, reason, richloc, _(msgid), ap);
-
- return ret;
-}
-
-/* Print a diagnostic at the given location. */
-
ATTRIBUTE_FPTR_PRINTF(5,0)
static bool
cpp_diagnostic_at (cpp_reader * pfile, int level, int reason,
- source_location src_loc,
+ rich_location *richloc,
const char *msgid, va_list *ap)
{
bool ret;
if (!pfile->cb.error)
abort ();
- rich_location richloc (pfile->line_table, src_loc);
- ret = pfile->cb.error (pfile, level, reason, &richloc, _(msgid), ap);
+ ret = pfile->cb.error (pfile, level, reason, richloc, _(msgid), ap);
return ret;
}
{
src_loc = pfile->cur_token[-1].src_loc;
}
- return cpp_diagnostic_at (pfile, level, reason, src_loc, msgid, ap);
+ rich_location richloc (pfile->line_table, src_loc);
+ return cpp_diagnostic_at (pfile, level, reason, &richloc, msgid, ap);
}
/* Print a warning or error, depending on the value of LEVEL. */
va_start (ap, msgid);
- ret = cpp_diagnostic_at (pfile, level, CPP_W_NONE, src_loc,
+ rich_location richloc (pfile->line_table, src_loc);
+ ret = cpp_diagnostic_at (pfile, level, CPP_W_NONE, &richloc,
msgid, &ap);
va_end (ap);
a column override. */
bool
-cpp_error_at_richloc (cpp_reader * pfile, int level, rich_location *richloc,
- const char *msgid, ...)
+cpp_error_at (cpp_reader * pfile, int level, rich_location *richloc,
+ const char *msgid, ...)
{
va_list ap;
bool ret;
va_start (ap, msgid);
- ret = cpp_diagnostic_at_richloc (pfile, level, CPP_W_NONE, richloc,
- msgid, &ap);
+ ret = cpp_diagnostic_at (pfile, level, CPP_W_NONE, richloc,
+ msgid, &ap);
va_end (ap);
return ret;
source_location src_loc, const char *msgid, ...)
ATTRIBUTE_PRINTF_4;
-extern bool cpp_error_at_richloc (cpp_reader * pfile, int level,
- rich_location *richloc, const char *msgid,
- ...)
+extern bool cpp_error_at (cpp_reader * pfile, int level,
+ rich_location *richloc, const char *msgid,
+ ...)
ATTRIBUTE_PRINTF_4;
/* In lex.c */