diff options
author | dmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-08-16 18:02:43 +0000 |
---|---|---|
committer | dmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-08-16 18:02:43 +0000 |
commit | 9a02e392a4537b0dfee4ceb7aadfe41475f31d2c (patch) | |
tree | b7b9c8817db01180af43f706c9d64db290fb525c /gcc/input.c | |
parent | 2e9474475753a0bb5b5ec5a90ea80099abc4aafd (diff) | |
download | gcc-9a02e392a4537b0dfee4ceb7aadfe41475f31d2c.tar.gz |
Move class temp_source_file from input.c to selftest.c/h
gcc/ChangeLog:
* input.c (class selftest::temp_source_file): Move to
selftest.h.
(selftest::temp_source_file::temp_source_file): Move to
selftest.c.
(selftest::temp_source_file::~temp_source_file): Likewise.
* selftest.c (selftest::temp_source_file::temp_source_file): Move
here from input.c.
(selftest::temp_source_file::~temp_source_file): Likewise.
* selftest.h (class selftest::temp_source_file): Move here from
input.c
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@239509 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/input.c')
-rw-r--r-- | gcc/input.c | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/gcc/input.c b/gcc/input.c index 790de936bac..0c5f817e83a 100644 --- a/gcc/input.c +++ b/gcc/input.c @@ -1472,48 +1472,6 @@ namespace selftest { /* Selftests of location handling. */ -/* A class for writing out a temporary sourcefile for use in selftests - of input handling. */ - -class temp_source_file -{ - public: - temp_source_file (const location &loc, const char *suffix, - const char *content); - ~temp_source_file (); - - const char *get_filename () const { return m_filename; } - - private: - char *m_filename; -}; - -/* Constructor. Create a tempfile using SUFFIX, and write CONTENT to - it. Abort if anything goes wrong, using LOC as the effective - location in the problem report. */ - -temp_source_file::temp_source_file (const location &loc, const char *suffix, - const char *content) -{ - m_filename = make_temp_file (suffix); - ASSERT_NE (m_filename, NULL); - - FILE *out = fopen (m_filename, "w"); - if (!out) - ::selftest::fail_formatted (loc, "unable to open tempfile: %s", - m_filename); - fprintf (out, "%s", content); - fclose (out); -} - -/* Destructor. Delete the tempfile. */ - -temp_source_file::~temp_source_file () -{ - unlink (m_filename); - free (m_filename); -} - /* Helper function for verifying location data: when location_t values are > LINE_MAP_MAX_LOCATION_WITH_COLS, they are treated as having column 0. */ |