https://gcc.gnu.org/bugzilla/show_bug.cgi?id=28901
--- Comment #31 from Manuel López-Ibáñez <manu at gcc dot gnu.org> --- (In reply to Mark Wielaard from comment #29) > > > + || filename_cmp (main_input_filename, > > > + DECL_SOURCE_FILE (decl)) == 0))) > > > > Better use MAIN_FILE_P(DECL_SOURCE_LOCATION (decl)) > > MAIN_FILE_P doesn't take a source location, but a line_map_ordinary, which > seems more cumbersome to get at from a decl then the filename to compare > against. Ah, yes, sorry. One needs to lookup the map for the location before being able to use MAIN_FILE_P. I was hoping that there was already a convenient overload or similar function in input.h or line-map.h, but alas, there isn't. I think it is still worth it to add something like in_main_file_at(location_t), similar to the existing in_system_header_at(), even if you wish to use filename_cmp within it. Somebody else in the future may decide to replace that implementation with something using MAIN_FILE_P, since it is much faster.