From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id 1BF88385DC0A for ; Thu, 23 Apr 2020 18:27:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 1BF88385DC0A Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=richard.sandiford@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A203130E; Thu, 23 Apr 2020 11:27:25 -0700 (PDT) Received: from localhost (e121540-lin.manchester.arm.com [10.32.98.126]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 139663F68F; Thu, 23 Apr 2020 11:27:24 -0700 (PDT) From: Richard Sandiford To: Qing Zhao Mail-Followup-To: Qing Zhao , "dmalcolm\@redhat.com" , Qing Zhao via Gcc-patches , richard.sandiford@arm.com Cc: "dmalcolm\@redhat.com" , Qing Zhao via Gcc-patches Subject: Re: [Version 2][PATCH][gcc][PR94230]provide an option to change the size limitation for -Wmisleading-indent References: <616B2BE0-0C66-4736-90E5-ECAD1FA4F8AD@ORACLE.COM> <47B8948D-C9BA-41EC-B55B-AF8117E79C50@ORACLE.COM> <8D4865D1-209A-491C-A265-E630E42406DE@ORACLE.COM> Date: Thu, 23 Apr 2020 19:27:23 +0100 In-Reply-To: (Qing Zhao's message of "Thu, 23 Apr 2020 15:41:17 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-25.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Apr 2020 18:27:27 -0000 Qing Zhao writes: > --- > gcc/c-family/c-indentation.c | 3 +++ > gcc/common.opt | 5 +++++ > gcc/doc/invoke.texi | 15 ++++++++++++++- > gcc/testsuite/gcc.dg/plugin/location-overflow-test-1.c | 2 +- > gcc/toplev.c | 3 +++ > 5 files changed, 26 insertions(+), 2 deletions(-) > > diff --git a/gcc/c-family/c-indentation.c b/gcc/c-family/c-indentation.c > index f737555..7074b10 100644 > --- a/gcc/c-family/c-indentation.c > +++ b/gcc/c-family/c-indentation.c > @@ -67,6 +67,9 @@ get_visual_column (expanded_location exploc, location_t loc, > "%<-Wmisleading-indentation%> is disabled from this point" > " onwards, since column-tracking was disabled due to" > " the size of the code/headers"); > + inform (loc, > + "please add %<-flarge-source-files%> to invoke more" > + " column-tracking for large source files"); > } > return false; > } This should be conditional on !flag_large_source_files. > diff --git a/gcc/common.opt b/gcc/common.opt > index 4368910..10a3d5b 100644 > --- a/gcc/common.opt > +++ b/gcc/common.opt > @@ -1597,6 +1597,11 @@ fkeep-gc-roots-live > Common Undocumented Report Var(flag_keep_gc_roots_live) Optimization > ; Always keep a pointer to a live memory block > > +flarge-source-files > +Common Report Var(flag_large_source_files) Init(0) > +Adjust GCC to cope with large source files to provide more accurate > +column information. > + I'm having difficulty suggesting wording here, but I think would be good to mention the downside. How about: ---------------------- Improve GCC's ability to track column numbers in large source files, at the expense of slower compilation. ---------------------- > floop-parallelize-all > Common Report Var(flag_loop_parallelize_all) Optimization > Mark all loops as parallel. > diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi > index 96a9516..c6ea9ef 100644 > --- a/gcc/doc/invoke.texi > +++ b/gcc/doc/invoke.texi > @@ -574,7 +574,7 @@ Objective-C and Objective-C++ Dialects}. > -fdebug-cpp -fdirectives-only -fdollars-in-identifiers @gol > -fexec-charset=@var{charset} -fextended-identifiers @gol > -finput-charset=@var{charset} -fmacro-prefix-map=@var{old}=@var{new} @gol > --fmax-include-depth=@var{depth} @gol > +-fmax-include-depth=@var{depth} -flarge-source-files @gol > -fno-canonical-system-headers -fpch-deps -fpch-preprocess @gol > -fpreprocessed -ftabstop=@var{width} -ftrack-macro-expansion @gol > -fwide-exec-charset=@var{charset} -fworking-directory @gol This should be kept in alphabetical order, so after -finput-charset. > @@ -14151,6 +14151,19 @@ This option may be useful in conjunction with the @option{-B} or > perform additional processing of the program source between > normal preprocessing and compilation. > > +@item -flarge-source-files > +@opindex flarge-source-files > +Adjust GCC to cope with large source files to provide more accurate > +column information. > +By default, GCC will lose accurate column information if the source > +file is very large. > +If this option is provided, GCC will adapt accordingly to provide more > +accurate column information. > +This option may be useful when any user hits the @option{-Wmisleading-indent} > +note, "is disabled from this point onwards, since column-tracking was disabled > +due to the size of the code/headers", or hits the limit at which columns get > +dropped from diagnostics. > + On a similar vein, how about: ---------------------- Adjust GCC to expect large source files, at the expense of slower compilation and higher memory usage. Specifically, GCC normally tracks both column numbers and line numbers within source files and it normally prints both of these numbers in diagnostics. However, once it has processed a certain number of source lines, it stops tracking column numbers and only tracks line numbers. This means that diagnostics for later lines do not include column numbers. It also means that options like @option{-Wmisleading-indent} cease to work at that point, although the compiler prints a note if this happens. Passing @option{-flarge-source-files} significantly increases the number of source lines that GCC can process before it stops tracking column numbers. ---------------------- Thanks, Richard