This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Propagate -fdiagnostics-* options in lto-wrapper


Hi,
Currently most non-target specific options are skipped when crossing the
LTO/offload processing border, however since there are still quite a
number of warning calls in many target backends, it makes sense to
save and propagate the associated options, to preserve consistency in warning
behavior.

For example, currently:
$ x86_64-pc-linux-gnu-gcc -fopenacc test.c -fno-diagnostics-show-caret
y.c: In function 'main._omp_fn.0':
y.c:6:11: warning: using num_workers (32), ignoring 500
   #pragma acc parallel num_workers(500)
           ^
(note: this warning message is triggered by nvptx code currently only
on gomp-4_0-branch, but illustrates the point)

The caret stills shows, because -fno-diagnostics-show-caret does not
reach the accel compiler. -flto should also have a similar issue.

The attached patch allows a series of -fdiagnostics-* options to be
propagated by lto-wrapper.  I've tested this patch without regressions,
is this okay for trunk?

Thanks,
Chung-Lin

2015-09-06  Chung-Lin Tang  <cltang@codesourcery.com>

	* lto-wrapper.c (merge_and_complain): Add OPT_fdiagnostics_show_caret,
	OPT_fdiagnostics_show_option, OPT_fdiagnostics_show_location_, and
	OPT_fshow_column to handled saved option cases.
	(append_compiler_options): Do not skip the above added options.
Index: lto-wrapper.c
===================================================================
--- lto-wrapper.c	(revision 227508)
+++ lto-wrapper.c	(working copy)
@@ -232,6 +232,10 @@ merge_and_complain (struct cl_decoded_option **dec
 	    break;
 
 	  /* Fallthru.  */
+	case OPT_fdiagnostics_show_caret:
+	case OPT_fdiagnostics_show_option:
+	case OPT_fdiagnostics_show_location_:
+	case OPT_fshow_column:
 	case OPT_fPIC:
 	case OPT_fpic:
 	case OPT_fPIE:
@@ -479,6 +483,10 @@ append_compiler_options (obstack *argv_obstack, st
 	 on any CL_TARGET flag and a few selected others.  */
       switch (option->opt_index)
 	{
+	case OPT_fdiagnostics_show_caret:
+	case OPT_fdiagnostics_show_option:
+	case OPT_fdiagnostics_show_location_:
+	case OPT_fshow_column:
 	case OPT_fPIC:
 	case OPT_fpic:
 	case OPT_fPIE:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]