From 53290e072ae4d8e5d61f82d651b6fba309fed6f1 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 8 Jan 2016 07:43:31 +0100 Subject: [PATCH] =?utf8?q?re=20PR=20c++/69145=20(Bogus=20'warning:=20#prag?= =?utf8?q?ma=20implementation=20for=20=E2=80=98...=E2=80=99=20appears=20af?= =?utf8?q?ter=20file=20is=20included')?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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. From-SVN: r232150 --- gcc/testsuite/ChangeLog | 7 +++++++ gcc/testsuite/g++.dg/ext/pr69145-1.C | 4 ++++ gcc/testsuite/g++.dg/ext/pr69145-2-very-long-filename.cc | 3 +++ gcc/testsuite/g++.dg/ext/pr69145-2.h | 3 +++ libcpp/ChangeLog | 6 ++++++ libcpp/files.c | 8 +++++--- 6 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/g++.dg/ext/pr69145-1.C create mode 100644 gcc/testsuite/g++.dg/ext/pr69145-2-very-long-filename.cc create mode 100644 gcc/testsuite/g++.dg/ext/pr69145-2.h diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5840815..aaee559 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2016-01-08 Jakub Jelinek + + PR c++/69145 + * 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. + 2016-01-07 Martin Sebor PR c/68966 diff --git a/gcc/testsuite/g++.dg/ext/pr69145-1.C b/gcc/testsuite/g++.dg/ext/pr69145-1.C new file mode 100644 index 0000000..be0def7 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/pr69145-1.C @@ -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" diff --git a/gcc/testsuite/g++.dg/ext/pr69145-2-very-long-filename.cc b/gcc/testsuite/g++.dg/ext/pr69145-2-very-long-filename.cc new file mode 100644 index 0000000..dd68fe0 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/pr69145-2-very-long-filename.cc @@ -0,0 +1,3 @@ +// PR c++/69145 +// { dg-do compile } */ +#include "pr69145-2.h" diff --git a/gcc/testsuite/g++.dg/ext/pr69145-2.h b/gcc/testsuite/g++.dg/ext/pr69145-2.h new file mode 100644 index 0000000..342aa85 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/pr69145-2.h @@ -0,0 +1,3 @@ +#ifndef PR69145_2_H +# define PR69145_2_H +#endif diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index 1151ad2..7845795 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,9 @@ +2016-01-08 Jakub Jelinek + + PR c++/69145 + * files.c (cpp_included_before): If IS_ADHOC_LOC (location), lookup + real location from the line_table. + 2016-01-04 Jakub Jelinek Update copyright years. diff --git a/libcpp/files.c b/libcpp/files.c index 1952774..22b1d05 100644 --- a/libcpp/files.c +++ b/libcpp/files.c @@ -1224,10 +1224,12 @@ 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 = get_location_from_adhoc_loc (pfile->line_table, location); while (entry && (entry->start_dir == NULL || entry->u.file->err_no || entry->location > location)) -- 2.7.4