From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 115159 invoked by alias); 30 May 2019 20:56:44 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 115151 invoked by uid 89); 30 May 2019 20:56:44 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-12.6 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,HTML_MESSAGE,KAM_NUMSUBJECT,KAM_SHORT,SPF_HELO_PASS,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 spammy=H*c:alternative X-HELO: aserp2130.oracle.com Received: from aserp2130.oracle.com (HELO aserp2130.oracle.com) (141.146.126.79) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 30 May 2019 20:56:42 +0000 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x4UKs0Wp127693; Thu, 30 May 2019 20:56:39 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : message-id : content-type : mime-version : subject : date : in-reply-to : cc : to : references; s=corp-2018-07-02; bh=DbFZPh29Y5sJIWj2AvEODCxCchwIf2DQ9Dl8l1W011k=; b=4LMpfCeIhcO6T7mcVi2Jy9gPMby9lO/pVpXrOeFP5qIPls8jNzlo3/1szhbzH3/Mm2c4 CqgVJZebFFt2B67SRrXytR4mgNE+xVoHSh1hMpM9nVa8gUyJvzRB14CrP/JOjNYsg/Ny 98SdSPtylouyV8XIuHfOCg50EsgPWgV0qwKFySRivTpt5NC7HHe3TinDJZGZrHHblQW4 /SbFMM1LNGt8oUi7/OEDwpGEKml6kGN7FBCoDXqggBG9e/gJL7BGOGn7uoO1CKlwtQok 4TuD0G4DdecKYa4O7UGVvgPDt/uihFIIh/rRtiAWoNV6cN2xLtDeUcE+eIVEvF2uCx7P Ew== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2130.oracle.com with ESMTP id 2spu7dtwnv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 30 May 2019 20:56:39 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x4UKtUt2086848; Thu, 30 May 2019 20:56:38 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userp3030.oracle.com with ESMTP id 2ss1fpa5bp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 30 May 2019 20:56:38 +0000 Received: from abhmp0017.oracle.com (abhmp0017.oracle.com [141.146.116.23]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x4UKubcG012239; Thu, 30 May 2019 20:56:37 GMT Received: from dhcp-10-159-246-187.vpn.oracle.com (/10.159.246.187) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 30 May 2019 13:56:37 -0700 From: Qing Zhao Message-Id: <5BC50F9E-D0B8-4E8E-8541-DE9AA6FCC7BA@oracle.com> Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: [PATCH][Preprocessor]patch to fix PR 90581 Date: Thu, 30 May 2019 21:05:00 -0000 In-Reply-To: <1559249198.2997.159.camel@redhat.com> Cc: gcc Patches , bernhard Reutner-Fischer To: David Malcolm References: <1559249198.2997.159.camel@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2019-05/txt/msg02060.txt.bz2 > On May 30, 2019, at 3:46 PM, David Malcolm wrote: >=20 > On Thu, 2019-05-30 at 11:23 -0500, Qing Zhao wrote: >> Hi, >>=20 >> PR 90581 (provide an option to adjust the maximum depth of nested >> #include) >> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D90581 >>=20 >> is to add a new cpp option -fmax-inlcude-depth to set the maximum >> depth of nested #include. >>=20 >> '-fmax-include-depth=3DDEPTH' >> Set the maximum depth of the nested include. The default value >> is >> 200. >>=20 >> Please check the attached patch. >> I have done bootstrap and regression test on X86, no any issue. >>=20 >> thanks a lot. >>=20 >> Qing. >>=20 > 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.=20 looks like that=20 =E2=80=94param name=3Dvalue=20 is an option for =E2=80=9COptions that Control Optimization=E2=80=9D. Since this new option is for preprocessor, I think that it might not be fit= in? let me know if I miss anything here. >=20 > One idea that occurred to me looking at the patch... >=20 >> index 3ee8bc4..480c282 100644 >> --- a/libcpp/directives.c >> +++ b/libcpp/directives.c >> @@ -831,7 +831,7 @@ do_include_common (cpp_reader *pfile, enum include_t= ype type) >> } >>=20 >> /* Prevent #include recursion. */ >> - if (pfile->line_table->depth >=3D CPP_STACK_MAX) >> + if (pfile->line_table->depth >=3D CPP_OPTION (pfile, max_include_dept= h)) >> cpp_error (pfile, CPP_DL_ERROR, "#include nested too deeply"); >=20 > ...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 >=20 > Maybe something like: >=20 > cpp_error (pfile, CPP_DL_ERROR, > "%<#include%> nested too deeply (depth %i);" > " use %<--param max-include-depth=3DLIMIT%> to support deeper nesting", > pfile->line_table->depth); >=20 > (though probably that would be better as a followup "note") >=20 > Dave