summaryrefslogtreecommitdiff
path: root/gcc/cppfiles.c
diff options
context:
space:
mode:
authorneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>2003-03-12 21:31:51 +0000
committerneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>2003-03-12 21:31:51 +0000
commit9e36e267115861827fc981c749a903310b24b02b (patch)
tree590fd1847cab73a5ef4b75fd3561a468bf056eab /gcc/cppfiles.c
parent667fe30ba9e2bb2c75a5e8692eed2aa788b690e0 (diff)
downloadgcc-9e36e267115861827fc981c749a903310b24b02b.tar.gz
* 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
Diffstat (limited to 'gcc/cppfiles.c')
-rw-r--r--gcc/cppfiles.c28
1 files changed, 28 insertions, 0 deletions
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 <built-in>. */
+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