diff options
author | Jakub Jelinek <jakub@redhat.com> | 2007-09-27 09:24:58 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2007-09-27 09:24:58 +0200 |
commit | c94ed7a1ae35d90b76e04cc7d8a9d72a7aa1451c (patch) | |
tree | da9ad83a363c4d770588541c6c1fc6b8fc3e0b7a /gcc/builtins.c | |
parent | dcbb0d145f6999926d17f7d7a3e6b84f6f2182b0 (diff) | |
download | gcc-c94ed7a1ae35d90b76e04cc7d8a9d72a7aa1451c.zip gcc-c94ed7a1ae35d90b76e04cc7d8a9d72a7aa1451c.tar.gz gcc-c94ed7a1ae35d90b76e04cc7d8a9d72a7aa1451c.tar.bz2 |
builtins.c (expand_builtin, [...]): Use new %K format string specifier for diagnostics.
* builtins.c (expand_builtin, expand_builtin_object_size,
expand_builtin_memory_chk, maybe_emit_chk_warning,
maybe_emit_sprintf_chk_warning): Use new %K format string specifier
for diagnostics.
* expr.c (expand_expr_real_1): Likewise.
* langhooks-def.h (struct diagnostic_info): Add forward decl.
(lhd_print_error_function): Add third argument.
* langhooks.h (struct diagnostic_info): Add forward decl.
(struct lang_hooks): Add third argument to print_error_function.
* diagnostic.h (diagnostic_info): Add abstract_origin field.
(diagnostic_last_function_changed, diagnostic_set_last_function): Add
second argument.
(diagnostic_report_current_function): Likewise.
* toplev.c (announce_function): Pass NULL as second argument to
diagnostic_set_last_function.
* diagnostic.c (diagnostic_report_current_function): Add second
argument, pass it as third argument to lang_hooks.print_error_function.
(default_diagnostic_starter): Pass DIAGNOSTIC as second argument
to diagnostic_report_current_function.
(diagnostic_report_diagnostic): Initialize diagnostic->abstract_origin
and message.abstract_origin.
(verbatim): Initialize abstract_origin.
* pretty-print.h (text_info): Add abstract_origin field.
* pretty-print.c (pp_base_format): Handle %K.
* langhooks.c (lhd_print_error_function): Add third argument. If
diagnostic->abstract_origin, print virtual backtrace.
* c-format.c (gcc_diag_char_table, gcc_tdiag_char_table,
gcc_cdiag_char_table, gcc_cxxdiag_char_table): Support %K.
(init_dynamic_diag_info): Likewise.
cp/
* error.c (cxx_print_error_function): Add third argument, pass
it over to lhd_print_error_function.
(cp_print_error_function): If diagnostic->abstract_origin, print
virtual backtrace.
* cp-tree.h (struct diagnostic_info): New forward decl.
(cxx_print_error_function): Add third argument.
java/
* lang.c (java_print_error_function): Add third argument.
testsuite/
* lib/prune.exp: Prune also "^In function .*$" lines and
"^ inlined from .*$" lines.
From-SVN: r128830
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r-- | gcc/builtins.c | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c index bb43ab6..bafdce0 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -6273,13 +6273,13 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode, case BUILT_IN_VA_ARG_PACK: /* All valid uses of __builtin_va_arg_pack () are removed during inlining. */ - error ("invalid use of %<__builtin_va_arg_pack ()%>"); + error ("%Kinvalid use of %<__builtin_va_arg_pack ()%>", exp); return const0_rtx; case BUILT_IN_VA_ARG_PACK_LEN: /* All valid uses of __builtin_va_arg_pack_len () are removed during inlining. */ - error ("invalid use of %<__builtin_va_arg_pack_len ()%>"); + error ("%Kinvalid use of %<__builtin_va_arg_pack_len ()%>", exp); return const0_rtx; /* Return the address of the first anonymous stack arg. */ @@ -11466,12 +11466,11 @@ expand_builtin_object_size (tree exp) tree ost; int object_size_type; tree fndecl = get_callee_fndecl (exp); - location_t locus = EXPR_LOCATION (exp); if (!validate_arglist (exp, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE)) { - error ("%Hfirst argument of %D must be a pointer, second integer constant", - &locus, fndecl); + error ("%Kfirst argument of %D must be a pointer, second integer constant", + exp, fndecl); expand_builtin_trap (); return const0_rtx; } @@ -11483,8 +11482,8 @@ expand_builtin_object_size (tree exp) || tree_int_cst_sgn (ost) < 0 || compare_tree_int (ost, 3) > 0) { - error ("%Hlast argument of %D is not integer constant between 0 and 3", - &locus, fndecl); + error ("%Klast argument of %D is not integer constant between 0 and 3", + exp, fndecl); expand_builtin_trap (); return const0_rtx; } @@ -11527,9 +11526,8 @@ expand_builtin_memory_chk (tree exp, rtx target, enum machine_mode mode, if (! integer_all_onesp (size) && tree_int_cst_lt (size, len)) { - location_t locus = EXPR_LOCATION (exp); - warning (0, "%Hcall to %D will always overflow destination buffer", - &locus, get_callee_fndecl (exp)); + warning (0, "%Kcall to %D will always overflow destination buffer", + exp, get_callee_fndecl (exp)); return NULL_RTX; } @@ -11636,7 +11634,6 @@ maybe_emit_chk_warning (tree exp, enum built_in_function fcode) { int is_strlen = 0; tree len, size; - location_t locus; switch (fcode) { @@ -11683,9 +11680,8 @@ maybe_emit_chk_warning (tree exp, enum built_in_function fcode) src = c_strlen (src, 1); if (! src || ! host_integerp (src, 1)) { - locus = EXPR_LOCATION (exp); - warning (0, "%Hcall to %D might overflow destination buffer", - &locus, get_callee_fndecl (exp)); + warning (0, "%Kcall to %D might overflow destination buffer", + exp, get_callee_fndecl (exp)); return; } else if (tree_int_cst_lt (src, size)) @@ -11694,9 +11690,8 @@ maybe_emit_chk_warning (tree exp, enum built_in_function fcode) else if (! host_integerp (len, 1) || ! tree_int_cst_lt (size, len)) return; - locus = EXPR_LOCATION (exp); - warning (0, "%Hcall to %D will always overflow destination buffer", - &locus, get_callee_fndecl (exp)); + warning (0, "%Kcall to %D will always overflow destination buffer", + exp, get_callee_fndecl (exp)); } /* Emit warning if a buffer overflow is detected at compile time @@ -11754,9 +11749,8 @@ maybe_emit_sprintf_chk_warning (tree exp, enum built_in_function fcode) if (! tree_int_cst_lt (len, size)) { - location_t locus = EXPR_LOCATION (exp); - warning (0, "%Hcall to %D will always overflow destination buffer", - &locus, get_callee_fndecl (exp)); + warning (0, "%Kcall to %D will always overflow destination buffer", + exp, get_callee_fndecl (exp)); } } |