Hi! On Tue, Jan 05, 2016 at 03:19:04PM -0500, David Malcolm wrote: > Isn't the line_table available from the cpp_reader as a field, though? > cpp_included_before could in theory access pfile->line_table.
You are right, that works too. So I'm offering an alternate patch too: 2016-01-07 Jakub Jelinek <ja...@redhat.com> PR c++/69145 * files.c (cpp_included_before): If IS_ADHOC_LOC (location), lookup real location from the line_table. * g++.dg/ext/pr69145-1.C: New test. * g++.dg/ext/pr69145-2-very-long-filename.cc: New file. * g++.dg/ext/pr69145-2.h: New file. --- libcpp/files.c.jj 2016-01-05 12:26:58.000000000 +0100 +++ libcpp/files.c 2016-01-07 10:01:35.958676922 +0100 @@ -1224,10 +1224,16 @@ bool cpp_included_before (cpp_reader *pfile, const char *fname, source_location location) { - struct cpp_file_hash_entry *entry; + struct cpp_file_hash_entry *entry + = (struct cpp_file_hash_entry *) + htab_find_with_hash (pfile->file_hash, fname, htab_hash_string (fname)); - entry = (struct cpp_file_hash_entry *) - htab_find_with_hash (pfile->file_hash, fname, htab_hash_string (fname)); + if (IS_ADHOC_LOC (location)) + { + location &= MAX_SOURCE_LOCATION; + location + = pfile->line_table->location_adhoc_data_map.data[location].locus; + } while (entry && (entry->start_dir == NULL || entry->u.file->err_no || entry->location > location)) --- gcc/testsuite/g++.dg/ext/pr69145-1.C.jj 2016-01-05 12:22:58.206729760 +0100 +++ gcc/testsuite/g++.dg/ext/pr69145-1.C 2016-01-05 12:22:52.017818392 +0100 @@ -0,0 +1,4 @@ +// PR c++/69145 +// { dg-do compile } +#pragma implementation "pr69145-2-very-long-filename.cc" // { dg-bogus "appears after file is included" } +#include "pr69145-2-very-long-filename.cc" --- gcc/testsuite/g++.dg/ext/pr69145-2-very-long-filename.cc.jj 2016-01-05 12:23:47.151028824 +0100 +++ gcc/testsuite/g++.dg/ext/pr69145-2-very-long-filename.cc 2016-01-05 12:23:42.629093583 +0100 @@ -0,0 +1,3 @@ +// PR c++/69145 +// { dg-do compile } */ +#include "pr69145-2.h" --- gcc/testsuite/g++.dg/ext/pr69145-2.h.jj 2016-01-05 12:23:49.963988539 +0100 +++ gcc/testsuite/g++.dg/ext/pr69145-2.h 2016-01-05 12:06:42.000000000 +0100 @@ -0,0 +1,3 @@ +#ifndef PR69145_2_H +# define PR69145_2_H +#endif Jakub