From: Qing Zhao <qing.zhao@oracle.com>
To: David Malcolm <dmalcolm@redhat.com>
Cc: 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: Thu, 30 May 2019 21:05:00 -0000 [thread overview]
Message-ID: <5BC50F9E-D0B8-4E8E-8541-DE9AA6FCC7BA@oracle.com> (raw)
In-Reply-To: <1559249198.2997.159.camel@redhat.com>
> On May 30, 2019, at 3: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.
I just checked both gcc source code and gcc documentation.
looks like that
—param name=value
is an option for “Options that Control Optimization”.
Since this new option is for preprocessor, I think that it might not be fit in?
let me know if I miss anything here.
>
> 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.
Yes, I agree.
will fix this.
Thanks.
Qing
>
> 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
next prev parent reply other threads:[~2019-05-30 20:56 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 [this message]
2019-05-31 9:01 ` Richard Biener
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=5BC50F9E-D0B8-4E8E-8541-DE9AA6FCC7BA@oracle.com \
--to=qing.zhao@oracle.com \
--cc=dmalcolm@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--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).