diff options
author | David Malcolm <dmalcolm@redhat.com> | 2016-08-18 13:07:53 +0000 |
---|---|---|
committer | David Malcolm <dmalcolm@gcc.gnu.org> | 2016-08-18 13:07:53 +0000 |
commit | f89b03b6bec154b41041b08df7bf53203524a826 (patch) | |
tree | 16edeb7bb8574ddbbe228f6cc852ec20e0ca6e1e /gcc/selftest.c | |
parent | f02510201aff3a572f7c67fcce3ee90c127ecd76 (diff) | |
download | gcc-f89b03b6bec154b41041b08df7bf53203524a826.zip gcc-f89b03b6bec154b41041b08df7bf53203524a826.tar.gz gcc-f89b03b6bec154b41041b08df7bf53203524a826.tar.bz2 |
Evict selftest tempfiles from the diagnostics file cache
Selftests can use class selftest::temp_source_file to write out files
for testing input-handling, and the files are unlinked in the dtor.
This leads to stale entries in input.c's cache of file content, which
could lead to errors if a temporary filename gets reused during a run
of the selftests.
We don't normally expect files to be "deleted from under us", so
special-case this by adding a special way for temp_source_file's
dtor to purge any cache entries referring to it.
gcc/ChangeLog:
* input.c (diagnostics_file_cache_forcibly_evict_file): New
function.
* input.h (diagnostics_file_cache_forcibly_evict_file): New
declaration.
* selftest.c (selftest::temp_source_file::~temp_source_file):
Evict m_filename from the diagnostic file cache.
From-SVN: r239570
Diffstat (limited to 'gcc/selftest.c')
-rw-r--r-- | gcc/selftest.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/gcc/selftest.c b/gcc/selftest.c index 0a7192e..d25f5c0 100644 --- a/gcc/selftest.c +++ b/gcc/selftest.c @@ -111,6 +111,7 @@ selftest::temp_source_file::temp_source_file (const location &loc, selftest::temp_source_file::~temp_source_file () { unlink (m_filename); + diagnostics_file_cache_forcibly_evict_file (m_filename); free (m_filename); } |