+2008-08-20 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ * diagnostic.c (inform): Add an explicit location_t parameter.
+ * toplev.h (inform): Update declaration.
+ * builtins.c: Update all calls to inform.
+ * c-common.c: Likewise.
+ * c-decl.c: Likewise.
+ * c-opts.c: Likewise.
+ * c-pch.c: Likewise.
+ * c-pragma.c: Likewise.
+ * c-typeck.c: Likewise.
+ * coverage.c: Likewise.
+ * opts.c: Likewise.
+ * toplev.c: Likewise.
+ * tree-cfg.c: Likewise.
+ * tree-ssa.c: Likewise.
+
2008-08-20 H.J. Lu <hongjiu.lu@intel.com>
PR target/37169
if (!gave_help && warned)
{
gave_help = true;
- inform ("(so you should pass %qT not %qT to %<va_arg%>)",
+ inform (input_location, "(so you should pass %qT not %qT to %<va_arg%>)",
promoted_type, type);
}
/* We can, however, treat "undefined" any way we please.
Call abort to encourage the user to fix the program. */
if (warned)
- inform ("if this code is reached, the program will abort");
+ inform (input_location, "if this code is reached, the program will abort");
t = build_call_expr (implicit_built_in_decls[BUILT_IN_TRAP], 0);
gimplify_and_add (t, pre_p);
if (emit_lax_note && !emitted_lax_note)
{
emitted_lax_note = true;
- inform ("use -flax-vector-conversions to permit "
+ inform (input_location, "use -flax-vector-conversions to permit "
"conversions between vectors with differing "
"element types or numbers of subparts");
}
if (TREE_CHAIN (t) == 0
&& TYPE_MAIN_VARIANT (type) != void_type_node)
{
- inform ("a parameter list with an ellipsis can%'t match "
+ inform (input_location, "a parameter list with an ellipsis can%'t match "
"an empty parameter name list declaration");
break;
}
if (c_type_promotes_to (type) != type)
{
- inform ("an argument type that has a default promotion can%'t match "
+ inform (input_location, "an argument type that has a default promotion can%'t match "
"an empty parameter name list declaration");
break;
}
if (TREE_CODE (decl) == FUNCTION_DECL && DECL_BUILT_IN (decl))
;
else if (DECL_INITIAL (decl))
- inform ("previous definition of %q+D was here", decl);
+ inform (input_location, "previous definition of %q+D was here", decl);
else if (C_DECL_IMPLICIT (decl))
- inform ("previous implicit declaration of %q+D was here", decl);
+ inform (input_location, "previous implicit declaration of %q+D was here", decl);
else
- inform ("previous declaration of %q+D was here", decl);
+ inform (input_location, "previous declaration of %q+D was here", decl);
}
/* Subroutine of duplicate_decls. Compare NEWDECL to OLDDECL.
error ("-I- specified twice");
quote_chain_split = true;
split_quote_chain ();
- inform ("obsolete option -I- used, please use -iquote instead");
+ inform (input_location, "obsolete option -I- used, please use -iquote instead");
}
break;
if (!cpp_get_options (pfile)->preprocessed)
{
error ("pch_preprocess pragma should only be used with -fpreprocessed");
- inform ("use #include instead");
+ inform (input_location, "use #include instead");
return;
}
if (c_common_valid_pch (pfile, name, fd) != 1)
{
if (!cpp_get_options (pfile)->warn_invalid_pch)
- inform ("use -Winvalid-pch for more information");
+ inform (input_location, "use -Winvalid-pch for more information");
fatal_error ("%s: PCH file was invalid", name);
}
warning (OPT_Wpragmas, "junk at end of %<#pragma message%>");
if (TREE_STRING_LENGTH (message) > 1)
- inform ("#pragma message: %s", TREE_STRING_POINTER (message));
+ inform (input_location, "#pragma message: %s", TREE_STRING_POINTER (message));
}
/* A vector of registered pragma callbacks. */
if (warning (0, "function called through a non-compatible type"))
/* We can, however, treat "undefined" any way we please.
Call abort to encourage the user to fix the program. */
- inform ("if this code is reached, the program will abort");
+ inform (input_location, "if this code is reached, the program will abort");
if (VOID_TYPE_P (return_type))
return trap;
static int warned = 0;
if (!warned++)
- inform ((flag_guess_branch_prob
+ inform (input_location, (flag_guess_branch_prob
? "file %s not found, execution counts estimated"
: "file %s not found, execution counts assumed to be zero"),
da_file_name);
if (!inhibit_warnings)
{
if (entry->checksum != checksum)
- inform ("checksum is %x instead of %x", entry->checksum, checksum);
+ inform (input_location, "checksum is %x instead of %x", entry->checksum, checksum);
else
- inform ("number of counters is %d instead of %d",
+ inform (input_location, "number of counters is %d instead of %d",
entry->summary.num, expected);
}
&& !inhibit_warnings
&& !warned++)
{
- inform ("coverage mismatch ignored due to -Wcoverage-mismatch");
- inform (flag_guess_branch_prob
+ inform (input_location, "coverage mismatch ignored due to -Wcoverage-mismatch");
+ inform (input_location, flag_guess_branch_prob
? "execution counts estimated"
: "execution counts assumed to be zero");
if (!flag_guess_branch_prob)
- inform ("this can result in poorly optimized code");
+ inform (input_location, "this can result in poorly optimized code");
}
return NULL;
+2008-08-20 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ * parser.c: Update all calls to inform.
+ * typeck.c: Likewise.
+ * init.c: Likewise.
+ * class.c: Likewise.
+ * call.c: Likewise.
+ * method.c: Likewise.
+ * friend.c: Likewise.
+ * typeck2.c: Likewise.
+ * pt.c: Likewise.
+ * name-lookup.c: Likewise.
+ * lex.c: Likewise.
+
2008-08-19 Jakub Jelinek <jakub@redhat.com>
PR debug/37156
if (TREE_CODE (candidate->fn) == IDENTIFIER_NODE)
{
if (candidate->num_convs == 3)
- inform ("%s %D(%T, %T, %T) <built-in>", msgstr, candidate->fn,
+ inform (input_location, "%s %D(%T, %T, %T) <built-in>", msgstr, candidate->fn,
candidate->convs[0]->type,
candidate->convs[1]->type,
candidate->convs[2]->type);
else if (candidate->num_convs == 2)
- inform ("%s %D(%T, %T) <built-in>", msgstr, candidate->fn,
+ inform (input_location, "%s %D(%T, %T) <built-in>", msgstr, candidate->fn,
candidate->convs[0]->type,
candidate->convs[1]->type);
else
- inform ("%s %D(%T) <built-in>", msgstr, candidate->fn,
+ inform (input_location, "%s %D(%T) <built-in>", msgstr, candidate->fn,
candidate->convs[0]->type);
}
else if (TYPE_P (candidate->fn))
- inform ("%s %T <conversion>", msgstr, candidate->fn);
+ inform (input_location, "%s %T <conversion>", msgstr, candidate->fn);
else if (candidate->viable == -1)
- inform ("%s %+#D <near match>", msgstr, candidate->fn);
+ inform (input_location, "%s %+#D <near match>", msgstr, candidate->fn);
else
- inform ("%s %+#D", msgstr, candidate->fn);
+ inform (input_location, "%s %+#D", msgstr, candidate->fn);
}
static void
&& warning (OPT_Wconversion, " for conversion from %qT to %qT",
source, w->second_conv->type))
{
- inform (" because conversion sequence for the argument is better");
+ inform (input_location, " because conversion sequence for the argument is better");
}
}
else
permerror (input_location, "assuming pointer to member %qD", fn);
if (!explained)
{
- inform ("(a pointer to member can only be formed with %<&%E%>)", fn);
+ inform (input_location, "(a pointer to member can only be formed with %<&%E%>)", fn);
explained = 1;
}
}
"%q#D declares a non-template function", decl);
if (! explained && warned)
{
- inform ("(if this is not what you intended, make sure "
+ inform (input_location, "(if this is not what you intended, make sure "
"the function template has already been declared "
"and add <> after the function name here) ");
explained = 1;
"delete operator:"))
{
cxx_incomplete_type_diagnostic (addr, type, DK_WARNING);
- inform ("neither the destructor nor the class-specific "
+ inform (input_location, "neither the destructor nor the class-specific "
"operator delete will be called, even if they are "
"declared when the class is defined.");
}
static bool hint;
if (!hint)
{
- inform ("(if you use %<-fpermissive%>, G++ will accept your "
+ inform (input_location, "(if you use %<-fpermissive%>, G++ will accept your "
"code, but allowing the use of an undeclared name is "
"deprecated)");
hint = true;
pop_deferring_access_checks ();
if (error_count != errorcount || warning_count != warningcount)
- inform ("%Hsynthesized method %qD first required here ",
- &input_location, fndecl);
+ inform (input_location, "synthesized method %qD first required here ",
+ fndecl);
}
/* Use EXTRACTOR to locate the relevant function called for each base &
static bool hint;
if (!hint)
{
- inform ("(if you use %<-fpermissive%> G++ will accept your code)");
+ inform (input_location, "(if you use %<-fpermissive%> G++ will accept your code)");
hint = true;
}
}
&& declarator->kind == cdk_function)
{
error ("%Hnew types may not be defined in a return type", &type_location);
- inform ("%H(perhaps a semicolon is missing after the definition of %qT)",
- &type_location, type);
+ inform (type_location,
+ "(perhaps a semicolon is missing after the definition of %qT)",
+ type);
}
}
if (TREE_CODE (field) == TYPE_DECL
&& DECL_NAME (field) == id)
{
- inform ("%H(perhaps %<typename %T::%E%> was intended)",
- &location, BINFO_TYPE (b), id);
+ inform (location,
+ "(perhaps %<typename %T::%E%> was intended)",
+ BINFO_TYPE (b), id);
break;
}
if (field)
{
error ("%Harray bound forbidden after parenthesized type-id",
&token->location);
- inform ("%Htry removing the parentheses around the type-id",
- &token->location);
+ inform (token->location,
+ "try removing the parentheses around the type-id");
cp_parser_direct_new_declarator (parser);
}
nelts = NULL_TREE;
"%<<::%> cannot begin a template-argument list"))
{
static bool hint = false;
- inform ("%H%<<:%> is an alternate spelling for %<[%>. Insert whitespace "
- "between %<<%> and %<::%>",
- &next_token->location);
+ inform (next_token->location,
+ "%<<:%> is an alternate spelling for %<[%>."
+ " Insert whitespace between %<<%> and %<::%>");
if (!hint && !flag_permissive)
{
- inform ("%H(if you use %<-fpermissive%> G++ will accept your code)",
- &next_token->location);
+ inform (next_token->location, "(if you use %<-fpermissive%>"
+ " G++ will accept your code)");
hint = true;
}
}
/* Explain what went wrong. */
error ("%Hnon-template %qD used as template",
&token->location, identifier);
- inform ("use %<%T::template %D%> to indicate that it is a template",
+ inform (input_location, "use %<%T::template %D%> to indicate that it is a template",
parser->scope, identifier);
/* If parsing tentatively, find the location of the "<" token. */
if (cp_parser_simulate_error (parser))
{
error ("%Hinvalid use of constructor as a template",
&declarator_id_start_token->location);
- inform ("use %<%T::%D%> instead of %<%T::%D%> to "
+ inform (input_location, "use %<%T::%D%> instead of %<%T::%D%> to "
"name the constructor in a qualified name",
class_type,
DECL_NAME (TYPE_TI_TEMPLATE (class_type)),
name = DECL_NAME (pack);
if (name)
- inform (" %qD", name);
+ inform (input_location, " %qD", name);
else
- inform (" <anonymous>");
+ inform (input_location, " <anonymous>");
parameter_packs = TREE_CHAIN (parameter_packs);
}
template arguments to %qD do not match original template %qD",
decl, DECL_TEMPLATE_RESULT (tmpl));
if (!uses_template_parms (TI_ARGS (tinfo)))
- inform ("use template<> for an explicit specialization");
+ inform (input_location, "use template<> for an explicit specialization");
/* Avoid crash in import_export_decl. */
DECL_INTERFACE_KNOWN (decl) = 1;
return error_mark_node;
{
error ("redeclared with %d template parameter(s)",
TREE_VEC_LENGTH (parms));
- inform ("previous declaration %q+D used %d template parameter(s)",
+ inform (input_location, "previous declaration %q+D used %d template parameter(s)",
tmpl, TREE_VEC_LENGTH (tmpl_parms));
return false;
}
A template-parameter may not be given default arguments
by two different declarations in the same scope. */
error ("redefinition of default argument for %q#D", parm);
- inform ("%Joriginal definition appeared here", tmpl_parm);
+ inform (input_location, "%Joriginal definition appeared here", tmpl_parm);
return false;
}
{
error ("%qE is not a valid template argument for type %qT "
"because it is a pointer", expr, type);
- inform ("try using %qE instead", TREE_OPERAND (expr, 0));
+ inform (input_location, "try using %qE instead", TREE_OPERAND (expr, 0));
return NULL_TREE;
}
error ("%qE is not a valid template argument for type %qT "
"because it is of type %qT", expr, type,
TREE_TYPE (expr));
- inform ("standard conversions are not allowed in this context");
+ inform (input_location, "standard conversions are not allowed in this context");
return NULL_TREE;
}
}
{
error ("dependent-name %qE is parsed as a non-type, but "
"instantiation yields a type", qualified_id);
- inform ("say %<typename %E%> if a type is meant", qualified_id);
+ inform (input_location, "say %<typename %E%> if a type is meant", qualified_id);
}
return error_mark_node;
}
error ("invalid use of %qE to form a pointer-to-member-function",
xarg);
if (TREE_CODE (xarg) != OFFSET_REF)
- inform (" a qualified-id is required");
+ inform (input_location, " a qualified-id is required");
return error_mark_node;
}
else
unsigned ix;
tree fn;
- inform ("%J because the following virtual functions are pure "
+ inform (input_location, "%J because the following virtual functions are pure "
"within %qT:", TYPE_MAIN_DECL (type), type);
for (ix = 0; VEC_iterate (tree, pure, ix, fn); ix++)
- inform ("\t%+#D", fn);
+ inform (input_location, "\t%+#D", fn);
/* Now truncate the vector. This leaves it non-null, so we know
there are pure virtuals, but empty so we don't list them out
again. */
VEC_truncate (tree, pure, 0);
}
else
- inform ("%J since type %qT has pure virtual functions",
+ inform (input_location, "%J since type %qT has pure virtual functions",
TYPE_MAIN_DECL (type), type);
return 1;
return report_diagnostic (&diagnostic);
}
-/* An informative note. Use this for additional details on an error
+/* An informative note at LOCATION. Use this for additional details on an error
message. */
void
-inform (const char *gmsgid, ...)
+inform (location_t location, const char *gmsgid, ...)
{
diagnostic_info diagnostic;
va_list ap;
va_start (ap, gmsgid);
- diagnostic_set_info (&diagnostic, gmsgid, &ap, input_location, DK_NOTE);
+ diagnostic_set_info (&diagnostic, gmsgid, &ap, location, DK_NOTE);
report_diagnostic (&diagnostic);
va_end (ap);
}
if (flag_exceptions && flag_reorder_blocks_and_partition)
{
- inform
- ("-freorder-blocks-and-partition does not work with exceptions");
+ inform (input_location,
+ "-freorder-blocks-and-partition does not work with exceptions");
flag_reorder_blocks_and_partition = 0;
flag_reorder_blocks = 1;
}
if (flag_unwind_tables && ! targetm.unwind_tables_default
&& flag_reorder_blocks_and_partition)
{
- inform ("-freorder-blocks-and-partition does not support unwind info");
+ inform (input_location, "-freorder-blocks-and-partition does not support unwind info");
flag_reorder_blocks_and_partition = 0;
flag_reorder_blocks = 1;
}
&& (!targetm.have_named_sections
|| (flag_unwind_tables && targetm.unwind_tables_default)))
{
- inform
- ("-freorder-blocks-and-partition does not work on this architecture");
+ inform (input_location,
+ "-freorder-blocks-and-partition does not work on this architecture");
flag_reorder_blocks_and_partition = 0;
flag_reorder_blocks = 1;
}
NULL);
}
else
- inform ("-frecord-gcc-switches is not supported by the current target");
+ inform (input_location, "-frecord-gcc-switches is not supported by the current target");
}
#ifdef ASM_COMMENT_START
ATTRIBUTE_GCC_DIAG(3,4);
extern bool permerror (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
extern void sorry (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2);
-extern void inform (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2);
+extern void inform (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
extern void verbatim (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2);
extern void rest_of_decl_compilation (tree, int, int);
if (addr)
{
debug_generic_expr (addr);
- inform ("in statement");
+ inform (input_location, "in statement");
debug_gimple_stmt (stmt);
return true;
}
if (xloc.file != floc.file
|| xloc.line < floc.line
|| xloc.line > LOCATION_LINE (cfun->function_end_locus))
- inform ("%J%qD was declared here", var, var);
+ inform (input_location, "%J%qD was declared here", var, var);
}
}