[PATCH, PR69707] Handle -fdiagnostics-color in lto
Tom de Vries
Tom_deVries@mentor.com
Mon Feb 8 21:05:00 GMT 2016
On 08/02/16 14:54, Jakub Jelinek wrote:
> On Mon, Feb 08, 2016 at 02:38:17PM +0100, Tom de Vries wrote:
>> hmm, indeed removing the 'Driver' flag from the fdiagnostics-color= entry in
>> common.opt breaks the functioning of fdiagnostics-color= in the gcc driver.
>>
>> This patch leaves the 'Driver' flag alone, and instead explicitly allows
>> fdiagnostics-color= in lto_write_options.
>>
>> Is this approach ok?
>
> Doesn't that mean storing -fdiagnostics-color= into the LTO option section and
> then using whatever was recorded from the first TU that recorded anything?
Yes.
> That doesn't look right for such diagnostics options either.
> I mean, if I
> $ gcc -fdiagnostics-color=always -c -flto a.c
> on another terminal
> $ gcc -fdiagnostics-color=never -c -flto b.c
> on yet another terminal
> $ gcc -flto -o a a.o b.o
> then I'd expect the default setting for -fdiagnostics-color= for all
> diagnostics while linking/LTO optimizing it, and for say
> $ gcc -fdiagnostics-color=always -flto -o a a.o b.o
> to have it always colorized, similarly for never.
> IMHO we should just honor what has been specified on the linker command
> line if anything.
Agreed.
> So, the question is, is -fdiagnostics-color=never passed
> in the testsuite just to the compilation and not to linking (that would be
> IMHO a testsuite bug),
In libgomp.exp we have:
...
# Disable color diagnostics
lappend ALWAYS_CFLAGS "additional_flags=-fdiagnostics-color=never"
...
The test setup looks ok to me.
> or is it passed on the linking command line, but not
> passed through to lto1?
Yes.
I've now realized this is specific to mkoffload.
If we're doing lto, in lto-wrapper.c:run_gcc, we have:
...
append_compiler_options (&argv_obstack, fdecoded_options,
fdecoded_options_count);
append_linker_options (&argv_obstack, decoded_options,
decoded_options_count);
...
And the last line will propagate the fdiagnostics-color setting.
But for calling mkoffload, we just have this:
...
/* Append options from offload_lto sections. */
append_compiler_options (&argv_obstack, compiler_opts,
compiler_opt_count);
...
Followed by this, which just filters the -foffload options:
...
/* Append options specified by -foffload last. In case of
conflicting options we expect offload compiler to choose
the latest. */
append_offload_options (&argv_obstack, target, compiler_opts,
compiler_opt_count);
append_offload_options (&argv_obstack, target, linker_opts,
linker_opt_count);
...
Attached patch adds the diagnostics flags to mkoffload.
Bootstrapped and reg-tested on x86_64.
OK for trunk, stage1?
Thanks,
- Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-Handle-fdiagnostics-color-in-lto.patch
Type: text/x-patch
Size: 2773 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20160208/431309ef/attachment.bin>
More information about the Gcc-patches
mailing list