From 9e36e267115861827fc981c749a903310b24b02b Mon Sep 17 00:00:00 2001 From: neil Date: Wed, 12 Mar 2003 21:31:51 +0000 Subject: * cppfiles.c (cpp_rename_file, cpp_push_include): New. * cppinit.c (push_include): Move with changes to cppfiles.c. (cpp_read_main_file): Mark named operators here... (cpp_finish_options): ...not here. Update. (_cpp_maybe_push_include_file): Update. * cpplib.h (cpp_push_include, cpp_rename_file): New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@64266 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cppfiles.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'gcc/cppfiles.c') diff --git a/gcc/cppfiles.c b/gcc/cppfiles.c index 9e35d0f4d24..9bcdb9edb5d 100644 --- a/gcc/cppfiles.c +++ b/gcc/cppfiles.c @@ -756,6 +756,16 @@ cpp_make_system_header (pfile, syshdr, externc) SOURCE_LINE (pfile->map, pfile->line), flags); } +/* Allow the client to rename the current file. Used by the front end + to achieve pseudo-file names like . */ +void +cpp_rename_file (pfile, new_name) + cpp_reader *pfile; + const char *new_name; +{ + _cpp_do_file_change (pfile, LC_RENAME, new_name, 1, 0); +} + /* Report on all files that might benefit from a multiple include guard. Triggered by -H. */ void @@ -884,6 +894,24 @@ _cpp_read_file (pfile, fname) return stack_include_file (pfile, f); } +/* Pushes the given file onto the buffer stack. Returns nonzero if + successful. */ +bool +cpp_push_include (pfile, filename) + cpp_reader *pfile; + const char *filename; +{ + cpp_token header; + + header.type = CPP_STRING; + header.val.str.text = (const unsigned char *) filename; + header.val.str.len = strlen (filename); + /* Make the command line directive take up a line. */ + pfile->line++; + + return _cpp_execute_include (pfile, &header, IT_CMDLINE); +} + /* Do appropriate cleanup when a file INC's buffer is popped off the input stack. */ void -- cgit v1.2.3