On Mon, 2019-12-16 at 11:18 +0000, Bader, Lucas wrote:
> Hello,
> 
> within a compile cluster, only the preprocessed output of GCC is transferred 
> to remote nodes for compilation. 
> When GCC produces advanced diagnostics (with -fdiagnostics-show-caret), e.g. 
> prints out the affected source
> line and fixit hints, it attempts to read the source file again, even when 
> compiling a preprocessed file (-fpreprocessed). 
> This leads to wrong diagnostics when building with a compile cluster, or, 
> more generally, when changing or deleting the original source file.
> 
> This patch attempts to alter the behavior by implementing a 
> location_get_source_line_preprocessed 
> function that can be used in diagnostic-show-locus.c in case a preprocessed 
> file is compiled.
> There was some previous discussion on this behavior on PR preprocessor/79106.
> 
> This is my first patch to GCC, so in case something is wrong with the format, 
> please let me know.
> 
> Best regards
> Lucas
> 
> 2019-12-16  Lucas Bader  <lucas.ba...@sap.com>
> 
>       PR preprocessor/79106
>       * c-opts.c (c_common_handle_option): pass -fpreprocessed 
>       option value to global diagnostic configuration
>       
>       * diagnostic-show-locus.c (layout::layout): read line from source or 
> preprocessed
>       file based on -fpreprocessed value
>       (source_line::source_line): read line from source or preprocessed
>       file based on -fpreprocessed value
>       (layout::print_line): read line from source or preprocessed
>       file based on -fpreprocessed value
>       
>       * diagnostic.h (diagnostic_context): new members for reading
>       source lines from preprocessed files
>       * diagnostic.c (diagnostic_initialize): initialize new members
>       
>       * input.c (location_get_source_line_preprocessed): new function
>       to read source lines from preprocessed files
>       (test_reading_source_line_preprocessed): new test case
>       (input_c_tests): execute new test case
>       
>       * opts-global.c (read_cmdline_options): pass input filename to global
>       diagnostic context
Note this is not forgotten.  But it seems more appropriate for gcc-11
rather than gcc-10.

Jeff
> 

Reply via email to