Handle -fdiagnostics-color in lto
2016-02-08 Tom de Vries <tom@codesourcery.com>
PR lto/69707
* lto-opts.c (lto_write_options): Allow fdiagnostics-color.
* lto-wrapper.c (merge_and_complain, append_compiler_options): Handle
OPT_fdiagnostics_color_.
* testsuite/libgomp.oacc-c-c++-common/parallel-dims-2.c: New test.
---
gcc/lto-opts.c | 21 ++++++++++++++++++---
gcc/lto-wrapper.c | 2 ++
.../libgomp.oacc-c-c++-common/parallel-dims-2.c | 19 +++++++++++++++++++
3 files changed, 39 insertions(+), 3 deletions(-)
@@ -200,9 +200,24 @@ lto_write_options (void)
which includes things like -o and -v or -fhelp for example.
We do not need those. The only exception is -foffload option, if we
write it in offload_lto section. Also drop all diagnostic options. */
- if ((cl_options[option->opt_index].flags & (CL_DRIVER|CL_WARNING))
- && (!lto_stream_offload_p || option->opt_index != OPT_foffload_))
- continue;
+ if (cl_options[option->opt_index].flags & (CL_DRIVER|CL_WARNING))
+ {
+ bool keep = false;
+ switch (option->opt_index)
+ {
+ case OPT_foffload_:
+ keep = lto_stream_offload_p;
+ break;
+ case OPT_fdiagnostics_color_:
+ keep = true;
+ break;
+ default:
+ break;
+ }
+
+ if (!keep)
+ continue;
+ }
for (j = 0; j < option->canonical_option_num_elements; ++j)
append_to_collect_gcc_options (&temporary_obstack, &first_p,
@@ -232,6 +232,7 @@ merge_and_complain (struct cl_decoded_option **decoded_options,
break;
/* Fallthru. */
+ case OPT_fdiagnostics_color_:
case OPT_fdiagnostics_show_caret:
case OPT_fdiagnostics_show_option:
case OPT_fdiagnostics_show_location_:
@@ -497,6 +498,7 @@ append_compiler_options (obstack *argv_obstack, struct cl_decoded_option *opts,
on any CL_TARGET flag and a few selected others. */
switch (option->opt_index)
{
+ case OPT_fdiagnostics_color_:
case OPT_fdiagnostics_show_caret:
case OPT_fdiagnostics_show_option:
case OPT_fdiagnostics_show_location_:
new file mode 100644
@@ -0,0 +1,19 @@
+/* { dg-do run { target { openacc_nvidia_accel_selected && lto } } } */
+/* { dg-additional-options "-flto -fno-use-linker-plugin" } */
+
+/* Worker and vector size checks. Picked an outrageously large
+ value. */
+
+int main ()
+{
+#pragma acc parallel num_workers (2<<20) /* { dg-error "using num_workers" } */
+ {
+ }
+
+#pragma acc parallel vector_length (2<<20) /* { dg-error "using vector_length" } */
+ {
+ }
+
+ return 0;
+}
+