On Wed, Oct 29, 2025 at 2:19 PM Joseph Myers <[email protected]> wrote: > > On Sun, 12 Oct 2025, Lewis Hyatt wrote: > > > > > One issue that came up is the treatment of command-line-defined macros. > > > > From > > > > the perspective of the generic line_map data structures, the > > > > command-line > > > > location is not distinguishable from other locations; it's just an > > > > ordinary > > > > location created by the front ends with a fake file name by convention. > > > > (At > > > > the moment, it is always the string `<command-line>', subject to > > > > translation.) Since libcpp needs to assign macros to that location, it > > > > needs to know what location to use, so I added a new member > > > > line_maps::cmdline_location for the front ends to set, similar to how > > > > line_maps::builtin_location is handled. > > Do I understand correctly that cmdline_location does not have to be set by > front ends not doing PCH (in particular, Fortran, which uses libcpp)? > > If so, then the patch is OK in the absence of objections within the next > week.
Thanks very much for reviewing it. That's correct, it is currently only used for PCH. I could add a comment to this effect if you think it's helpful? Like this perhaps: diff --git a/libcpp/include/line-map.h b/libcpp/include/line-map.h index 799a58036d5..2cd54d0770e 100644 --- a/libcpp/include/line-map.h +++ b/libcpp/include/line-map.h @@ -879,7 +879,9 @@ public: location_t builtin_location; /* The special location value to be used for tokens originating on the - command line. */ + command line. This is currently only needed by the C-family front ends + for PCH support; if it would be used for another purpose in the future, + then other libcpp-using front ends may need to set it as well. */ location_t cmdline_location; /* The default value of range_bits in ordinary line maps. */
