public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: David Malcolm <dmalcolm@redhat.com>
Cc: Qing Zhao <qing.zhao@oracle.com>,
	gcc Patches <gcc-patches@gcc.gnu.org>,
		bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Subject: Re: [PATCH][Preprocessor]patch to fix PR 90581
Date: Fri, 31 May 2019 09:01:00 -0000	[thread overview]
Message-ID: <CAFiYyc36+N2P1RBa+qf=bR6bSbd3Y8N+Oc+6DDRSr8=WYL3XPw@mail.gmail.com> (raw)
In-Reply-To: <1559249198.2997.159.camel@redhat.com>

On Thu, May 30, 2019 at 10:46 PM David Malcolm <dmalcolm@redhat.com> wrote:
>
> On Thu, 2019-05-30 at 11:23 -0500, Qing Zhao wrote:
> > Hi,
> >
> > PR 90581 (provide an option to adjust the maximum depth of nested
> > #include)
> > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90581
> >
> > is to add a new cpp option -fmax-inlcude-depth to set the maximum
> > depth of nested #include.
> >
> > '-fmax-include-depth=DEPTH'
> >      Set the maximum depth of the nested include.  The default value
> > is
> >      200.
> >
> > Please check the attached patch.
> > I have done bootstrap and regression test on X86, no any issue.
> >
> > thanks a lot.
> >
> > Qing.
> >
> Thanks for working on this.  It's looking promising, but I agree that a
> param would be better than an option.

Not sure - this is for language limits and we do have existing
like -ftemplate-backtrace-limit and -ftemplate-depth.

> One idea that occurred to me looking at the patch...
>
> > index 3ee8bc4..480c282 100644
> > --- a/libcpp/directives.c
> > +++ b/libcpp/directives.c
> > @@ -831,7 +831,7 @@ do_include_common (cpp_reader *pfile, enum include_type type)
> >      }
> >
> >    /* Prevent #include recursion.  */
> > -  if (pfile->line_table->depth >= CPP_STACK_MAX)
> > +  if (pfile->line_table->depth >= CPP_OPTION (pfile, max_include_depth))
> >      cpp_error (pfile, CPP_DL_ERROR, "#include nested too deeply");
>
> ...a nice usability tweak here would be to give a hint about the new
> param, to give the user an idea on how to increase the limit.
>
> Maybe something like:
>
> cpp_error (pfile, CPP_DL_ERROR,
>           "%<#include%> nested too deeply (depth %i);"
>           " use %<--param max-include-depth=LIMIT%> to support deeper nesting",
>           pfile->line_table->depth);
>
> (though probably that would be better as a followup "note")
>
> Dave

  parent reply	other threads:[~2019-05-31  8:50 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-30 16:26 Qing Zhao
2019-05-30 19:20 ` Bernhard Reutner-Fischer
2019-05-30 20:35   ` Qing Zhao
2019-05-30 20:42     ` David Malcolm
2019-05-30 20:46       ` Qing Zhao
2019-05-30 20:49 ` David Malcolm
2019-05-30 21:05   ` Qing Zhao
2019-05-31  9:01   ` Richard Biener [this message]
2019-06-03 14:49 ` [PATCH][Preprocessor][Version 2]patch " Qing Zhao
2019-06-03 15:03   ` Paolo Carlini
2019-06-03 16:42     ` [PATCH][Preprocessor][Version 3]patch " Qing Zhao
2019-06-03 16:46   ` Qing Zhao
2019-06-07  8:26     ` Richard Biener

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFiYyc36+N2P1RBa+qf=bR6bSbd3Y8N+Oc+6DDRSr8=WYL3XPw@mail.gmail.com' \
    --to=richard.guenther@gmail.com \
    --cc=dmalcolm@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=qing.zhao@oracle.com \
    --cc=rep.dot.nop@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).