diff options
author | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-03-15 09:57:29 +0000 |
---|---|---|
committer | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-03-15 09:57:29 +0000 |
commit | 249faa350297cdc1cfd517af4edac7f82e5ca896 (patch) | |
tree | 70731acae4b8c0682512aff60d80deeae2d69531 /gcc/cp | |
parent | de2e64645bc50b7f6715db7d7494a476974acf10 (diff) | |
download | gcc-249faa350297cdc1cfd517af4edac7f82e5ca896.tar.gz |
/c-family
2012-03-15 Manuel López-Ibáñez <manu@gcc.gnu.org>
PR c++/44783
* c.opt (ftemplate-backtrace-limit) Add.
/cp
2012-03-15 Manuel López-Ibáñez <manu@gcc.gnu.org>
PR c++/44783
* error.c (print_instantiation_partial_context): Use
template_backtrace_limit.
/doc
2012-03-15 Manuel López-Ibáñez <manu@gcc.gnu.org>
PR c++/44783
* doc/invoke.texi [C++ Language Options]: Document
-ftemplate-backtrace-limit.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@185424 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 12 | ||||
-rw-r--r-- | gcc/cp/error.c | 24 |
2 files changed, 27 insertions, 9 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 4c99decd755..f4f46fec4a0 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2012-03-15 Manuel López-Ibáñez <manu@gcc.gnu.org> + + PR c++/44783 + * error.c (print_instantiation_partial_context): Use + template_backtrace_limit. + 2012-03-14 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> * Make-lang.in (doc/g++.1): Remove IRIX 6.5 reference. @@ -13,10 +19,10 @@ PR c++/51641 * cp-tree.h (template_type_parameter_p): Declare new function. - (parameter_of_template_p): Remove - * pt.c (template_type_parameter_p): Define new function. (parameter_of_template_p): Remove. - * name-lookup.c (binding_to_template_parms_of_scope_p): Don't rely + * pt.c (template_type_parameter_p): Define new function. + (parameter_of_template_p): Remove. + * name-lookup.c (binding_to_template_parms_of_scope_p): Don't rely on parameter_of_template_p anymore. Compare the level of the template parameter to the depth of the template. diff --git a/gcc/cp/error.c b/gcc/cp/error.c index 4ec263b0c3f..ee8f0e082a5 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -3076,10 +3076,20 @@ print_instantiation_partial_context (diagnostic_context *context, t = t0; - if (n_total >= 12) + if (template_backtrace_limit + && n_total > template_backtrace_limit) { - int skip = n_total - 10; - for (n = 0; n < 5; n++) + int skip = n_total - template_backtrace_limit; + int head = template_backtrace_limit / 2; + + /* Avoid skipping just 1. If so, skip 2. */ + if (skip == 1) + { + skip = 2; + head = (template_backtrace_limit - 1) / 2; + } + + for (n = 0; n < head; n++) { gcc_assert (t != NULL); if (loc != t->locus) @@ -3088,17 +3098,19 @@ print_instantiation_partial_context (diagnostic_context *context, loc = t->locus; t = t->next; } - if (t != NULL && skip > 1) + if (t != NULL && skip > 0) { expanded_location xloc; xloc = expand_location (loc); if (context->show_column) pp_verbatim (context->printer, - _("%s:%d:%d: [ skipping %d instantiation contexts ]\n"), + _("%s:%d:%d: [ skipping %d instantiation contexts, " + "use -ftemplate-backtrace-limit=0 to disable ]\n"), xloc.file, xloc.line, xloc.column, skip); else pp_verbatim (context->printer, - _("%s:%d: [ skipping %d instantiation contexts ]\n"), + _("%s:%d: [ skipping %d instantiation contexts, " + "use -ftemplate-backtrace-limit=0 to disable ]\n"), xloc.file, xloc.line, skip); do { |