diff options
author | Tom Tromey <tromey@redhat.com> | 2007-11-12 00:38:48 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2007-11-12 00:38:48 +0000 |
commit | f1e207107a8fca7d0f8792502b576688ede5df58 (patch) | |
tree | 3f463456ccd4e5d3927d4137b115dbd7bb507c51 /gcc | |
parent | b131ad7c3db37bb79f21f5f6532447d0e030acaa (diff) | |
download | gcc-f1e207107a8fca7d0f8792502b576688ede5df58.zip gcc-f1e207107a8fca7d0f8792502b576688ede5df58.tar.gz gcc-f1e207107a8fca7d0f8792502b576688ede5df58.tar.bz2 |
re PR c++/17577 (#pragma implementation no longer diagnoses use after file to which it applies)
gcc/cp
PR c++/17577:
* lex.c (handle_pragma_implementation): Use cpp_included_before.
gcc/testsuite
PR c++/17577:
* g++.dg/ext/pr17577.h: New file.
* g++.dg/ext/pr17577.C: New file.
libcpp
PR c++/17557:
* include/cpplib.h (cpp_included_before): Declare.
* files.c (struct file_hash_entry) <location>: New field.
(_cpp_find_file): Initialize new field.
(make_cpp_dir): Likewise.
(cpp_included_before): New function.
From-SVN: r130093
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/lex.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/ext/pr17577.C | 6 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/ext/pr17577.h | 2 |
5 files changed, 21 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index cfeea80..1cc3895 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2007-11-11 Tom Tromey <tromey@redhat.com> + + PR c++/17577: + * lex.c (handle_pragma_implementation): Use cpp_included_before. + 2007-11-12 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR c++/8570 diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c index 3bb1bf4..136260b 100644 --- a/gcc/cp/lex.c +++ b/gcc/cp/lex.c @@ -572,14 +572,14 @@ handle_pragma_implementation (cpp_reader* dfile ATTRIBUTE_UNUSED ) else { filename = ggc_strdup (TREE_STRING_POINTER (fname)); -#if 0 +#ifdef USE_MAPPED_LOCATION /* We currently cannot give this diagnostic, as we reach this point only after cpplib has scanned the entire translation unit, so cpp_included always returns true. A plausible fix is to compare the current source-location cookie with the first source-location cookie (if any) of the filename, but this requires completing the --enable-mapped-location project first. See PR 17577. */ - if (cpp_included (parse_in, filename)) + if (cpp_included_before (parse_in, filename, input_location)) warning (0, "#pragma implementation for %qs appears after " "file is included", filename); #endif diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3c9a1a0..b55f3c0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2007-11-11 Tom Tromey <tromey@redhat.com> + + PR c++/17577: + * g++.dg/ext/pr17577.h: New file. + * g++.dg/ext/pr17577.C: New file. + 2007-11-12 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR c++/8570 diff --git a/gcc/testsuite/g++.dg/ext/pr17577.C b/gcc/testsuite/g++.dg/ext/pr17577.C new file mode 100644 index 0000000..29b1d17 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/pr17577.C @@ -0,0 +1,6 @@ +// Test for PR c++/17577. + +/* { dg-do compile } */ + +#include "pr17577.h" +#pragma implementation "pr17577.h" /* { dg-warning "appears after file" } */ diff --git a/gcc/testsuite/g++.dg/ext/pr17577.h b/gcc/testsuite/g++.dg/ext/pr17577.h new file mode 100644 index 0000000..6ff0add --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/pr17577.h @@ -0,0 +1,2 @@ +// Test for PR c++/17577. +#pragma interface |