https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69485

--- Comment #3 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to janus from comment #2)
> There is a note about this in the load_line documentation:
> 
>    NOTE: The error machinery isn't available at this point, so we can't
>        easily report line and column numbers consistent with other 
>        parts of gfortran.
> 
> Unfortunately I have too little knowledge of the GCC error machinery to
> estimate how much work is needed to accomplish this ...

This comment predates the transition to the common machinery, so I'm not sure
what it means.

The only thing necessary should be to setup the line_table to create locations.
This is done already by gfortran (see linemap_*); but I don't know when that
happens with respect to this warning. Perhaps the handling of the line_table
can be moved earlier or these warnings can be moved where the linemaps is built
or linemap locations can be generated and saved for warning later. (If gfortran
used libcpp for tokenizing, then it would get back a stream of tokens with
locations).

 Then one can do things like:

  linemap_line_start (line_table, current_file->line, 80);
  gfc_warning_now_at (linemap_position_for_column (line_table, 2), 0,
                      "Illegal preprocessor directive");

Reply via email to