add a new option -flarge-source-files.
authorqing zhao <qing.zhao@oracle.com>
Wed, 6 May 2020 17:46:09 +0000 (10:46 -0700)
committerqing zhao <qing.zhao@oracle.com>
Wed, 6 May 2020 17:46:09 +0000 (10:46 -0700)
gcc/ChangeLog:

PR c/94230
* common.opt: Add -flarge-source-files.
* doc/invoke.texi: Document it.
* toplev.c (process_options): set line_table->default_range_bits
to 0 when flag_large_source_files is true.

gcc/c-family/ChangeLog:

PR c/94230
* c-indentation.c (get_visual_column): Add a hint to use the new
-flarge-source-files option.

gcc/testsuite/ChangeLog:

PR c/94230
* gcc.dg/plugin/location-overflow-test-1.c (fn_1): New message to
provide hint to use the new -flarge-source-files option.

gcc/ChangeLog
gcc/c-family/ChangeLog
gcc/c-family/c-indentation.c
gcc/common.opt
gcc/doc/invoke.texi
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/plugin/location-overflow-test-1.c
gcc/toplev.c

index bc27083b7d3903a59fbee4ed1de63018fb1d03c8..18800ec605aaf5f66143fdf7f87df25dffdaa75a 100644 (file)
@@ -1,3 +1,11 @@
+2020-05-06  qing zhao  <qing.zhao@oracle.com>
+
+       PR c/94230
+       * common.opt: Add -flarge-source-files.
+       * doc/invoke.texi: Document it.
+       * toplev.c (process_options): set line_table->default_range_bits
+       to 0 when flag_large_source_files is true.
+
 2020-05-06  Uroš Bizjak  <ubizjak@gmail.com>
 
        PR target/94913
index fe6cfe721165f563686cb3b245b8667ae9a368c6..a7faf829bd6ddf96e4b4d9341ddda41faa8aa64f 100644 (file)
@@ -1,3 +1,9 @@
+2020-05-06  qing zhao  <qing.zhao@oracle.com>
+
+       PR c/94230
+       * c-indentation.c (get_visual_column): Add a hint to use the new
+       -flarge-source-files option.
+
 2020-05-05  Stefan Schulze Frielinghaus  <stefansf@linux.ibm.com>
 
        * c-attribs.c (handle_vector_size_attribute): Add attribute
index f737555db0ee490924b73f41aa2f505d23febcce..9fba3bcc67cbccad4d8c799102722660c6f94f70 100644 (file)
@@ -67,6 +67,11 @@ 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");
+         if (!flag_large_source_files)
+           inform (loc,
+                   "adding %<-flarge-source-files%> will allow for more" 
+                   " column-tracking support, at the expense of compilation"
+                   " time and memory");
        }
       return false;
     }
index d33383b523cfe9556695c7ce0521287d084f1e9c..30d05734d167fa6bf9bae8bb4473e3d7495353f6 100644 (file)
@@ -1609,6 +1609,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)
+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.
index 3537a81d9628c5f478988fde270278fa49eec585..c97318f046591fe4cdf11637b10bec408a5c3dd3 100644 (file)
@@ -574,8 +574,8 @@ Objective-C and Objective-C++ Dialects}.
 -dD  -dI  -dM  -dN  -dU @gol
 -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
+-finput-charset=@var{charset}  -flarge-source-files  @gol
+-fmacro-prefix-map=@var{old}=@var{new} -fmax-include-depth=@var{depth} @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
@@ -14174,6 +14174,21 @@ 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 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-indentation} 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 columns.
+
 @end table
 
 @node Assembler Options
index ccdbf989089ae3972ff545d9a16adaf963707243..6aa437871229d2306eb8658c125a426e5fa3412b 100644 (file)
@@ -1,3 +1,9 @@
+2020-05-06  qing zhao  <qing.zhao@oracle.com>
+
+       PR c/94230
+       * gcc.dg/plugin/location-overflow-test-1.c (fn_1): New message to 
+       provide hint to use the new -flarge-source-files option.
+
 2020-05-06  Uroš Bizjak  <ubizjak@gmail.com>
 
        PR target/94913
index 1a80a668a0fa06af663a4d8dece717b1e0763dac..a3ac12d3b466a53360982746b0f235739f182f2b 100644 (file)
@@ -13,7 +13,7 @@ int
 fn_1 (int flag)
 {
   int x = 4, y = 5;
-  if (flag) x = 3; y = 2; /* { dg-message "-:disabled from this point" } */
+  if (flag) x = 3; y = 2; /* { dg-message "-:disabled from this point" "adding '-flarge-source-files'" } */
   return x * y;
 }
 
index 5c026feece28c6527ab04459626d0376c22013d1..96316fbd23b67a1da30bf6e910237ce99e84bda3 100644 (file)
@@ -1854,6 +1854,9 @@ process_options (void)
     hash_table_sanitize_eq_limit
       = param_hash_table_verification_limit;
 
+  if (flag_large_source_files)
+    line_table->default_range_bits = 0;
+
   /* Please don't change global_options after this point, those changes won't
      be reflected in optimization_{default,current}_node.  */
 }