aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/error.c
diff options
context:
space:
mode:
authorManuel López-Ibáñez <manu@gcc.gnu.org>2012-03-15 09:57:29 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2012-03-15 09:57:29 +0000
commita12bf402815d0aa90dd32eb3a279281ca3a1dffd (patch)
tree70731acae4b8c0682512aff60d80deeae2d69531 /gcc/cp/error.c
parent1f163ef7ac70375b21ab891ec543a2bca7205dda (diff)
downloadgcc-a12bf402815d0aa90dd32eb3a279281ca3a1dffd.zip
gcc-a12bf402815d0aa90dd32eb3a279281ca3a1dffd.tar.gz
gcc-a12bf402815d0aa90dd32eb3a279281ca3a1dffd.tar.bz2
re PR c++/44783 (implement -ftemplate-backtrace-limit=)
/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. From-SVN: r185424
Diffstat (limited to 'gcc/cp/error.c')
-rw-r--r--gcc/cp/error.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index 4ec263b..ee8f0e0 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 {