public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Sandiford <richard.sandiford@arm.com>
To: Qing Zhao <QING.ZHAO@ORACLE.COM>
Cc: "dmalcolm\@redhat.com" <dmalcolm@redhat.com>,
	Qing Zhao via Gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [Version 2][PATCH][gcc][PR94230]provide an option to change the size limitation for -Wmisleading-indent
Date: Thu, 23 Apr 2020 19:27:23 +0100	[thread overview]
Message-ID: <mpth7xa3vn8.fsf@arm.com> (raw)
In-Reply-To: <FD35E535-6ECE-4E16-83ED-254259D1869A@ORACLE.COM> (Qing Zhao's message of "Thu, 23 Apr 2020 15:41:17 +0100")

Qing Zhao <QING.ZHAO@ORACLE.COM> 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

  reply	other threads:[~2020-04-23 18:27 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-03 19:55 [PATCH][gcc][PR94230]provide " Qing Zhao
2020-04-08 19:39 ` PING " Qing Zhao
2020-04-15 20:30   ` Fwd: " Qing Zhao
2020-04-21 14:04   ` Richard Sandiford
2020-04-21 15:21     ` David Malcolm
2020-04-21 18:46       ` Richard Sandiford
2020-04-22 14:22         ` Qing Zhao
2020-04-23 14:41           ` [Version 2][PATCH][gcc][PR94230]provide " Qing Zhao
2020-04-23 18:27             ` Richard Sandiford [this message]
2020-04-23 19:52               ` Qing Zhao
2020-04-23 21:05               ` [Version 3][PATCH][gcc][PR94230]provide " Qing Zhao
2020-04-23 22:13                 ` David Malcolm
2020-04-24 22:22                   ` [Version 4][PATCH][gcc][PR94230]provide " Qing Zhao
2020-04-24 22:36                     ` David Malcolm
2020-04-27 14:23                       ` Qing Zhao
2020-05-06 18:40                   ` Committed [Version 3][PATCH][gcc][PR94230]provide " Qing Zhao

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=mpth7xa3vn8.fsf@arm.com \
    --to=richard.sandiford@arm.com \
    --cc=QING.ZHAO@ORACLE.COM \
    --cc=dmalcolm@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    /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).