aboutsummaryrefslogtreecommitdiff
path: root/gcc/cppfiles.c
diff options
context:
space:
mode:
authorNeil Booth <neil@daikokuya.co.uk>2003-03-12 21:31:51 +0000
committerNeil Booth <neil@gcc.gnu.org>2003-03-12 21:31:51 +0000
commitc19b12cb004dd81035fe2779438612804a27d3a9 (patch)
tree590fd1847cab73a5ef4b75fd3561a468bf056eab /gcc/cppfiles.c
parentad9c4d9f7b601d599c3119e21d28c4a75cc94298 (diff)
downloadgcc-c19b12cb004dd81035fe2779438612804a27d3a9.zip
gcc-c19b12cb004dd81035fe2779438612804a27d3a9.tar.gz
gcc-c19b12cb004dd81035fe2779438612804a27d3a9.tar.bz2
cppfiles.c (cpp_rename_file, [...]): New.
* 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. From-SVN: r64266
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 9e35d0f..9bcdb9e 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