summaryrefslogtreecommitdiff
path: root/gcc/fix-header.c
diff options
context:
space:
mode:
authorneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>2000-11-27 08:00:04 +0000
committerneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>2000-11-27 08:00:04 +0000
commitd7503801e5662ff8d132df1e21bdfcbeaa3a5174 (patch)
tree6ecb94c4e9edb0c2004142e389531669ea20c416 /gcc/fix-header.c
parent15155f829e7ddc1a5dd4a45cecdcf9d173c74380 (diff)
downloadgcc-d7503801e5662ff8d132df1e21bdfcbeaa3a5174.tar.gz
* c-lex.c (cb_enter_file, cb_leave_file, cb_rename_file):
Combine into the new function cb_change_file. (init_c_lex): Update. * cppfiles.c (stack_include_file): Use _cpp_do_file_change. (cpp_syshdr_flags): Delete. * cpphash.h (_cpp_do_file_change): New prototype. Move struct cpp_buffer here from... * cpplib.h (struct cpp_buffer): ... here. (enum cpp_fc_reason, struct cpp_file_loc, struct_cpp_file_change, change_file): New. (enter_file, leave_file, rename_file, cpp_syshdr_flags): Delete. * cpplib.c (do_line): Update for new cb_change_file callback. (_cpp_do_file_change): New function. (_cpp_pop_buffer): Update to use it. * cppmain.c (move_printer): Delete. (main): Set up single callback cb_change_file. (cb_enter_file, cb_leave_file, cb_rename_file): Delete. (cb_change_file): New. * fix-header.c (cur_file, cb_change_file): New. (recognized_function, read_scan_file): Update. * scan-decls.c (scan_decls): Update. * scan.h (recognized_function): Update prototype. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@37784 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fix-header.c')
-rw-r--r--gcc/fix-header.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/gcc/fix-header.c b/gcc/fix-header.c
index b3138488086..5fb2c6a2916 100644
--- a/gcc/fix-header.c
+++ b/gcc/fix-header.c
@@ -114,6 +114,7 @@ static char *files_to_ignore[] = {
char *inf_buffer;
char *inf_limit;
char *inf_ptr;
+static const char *cur_file;
/* Certain standard files get extra treatment */
@@ -198,6 +199,7 @@ static int inf_skip_spaces PARAMS ((int));
static int inf_read_upto PARAMS ((sstring *, int));
static int inf_scan_ident PARAMS ((sstring *, int));
static int check_protection PARAMS ((int *, int *));
+static void cb_change_file PARAMS ((cpp_reader *, const cpp_file_change *));
static void
add_symbols (flags, names)
@@ -511,18 +513,16 @@ recognized_extern (name)
}
/* Called by scan_decls if it saw a function definition for a function
- named FNAME, in source file FILE_SEEN on line LINE_SEEN. KIND is
- 'I' for an inline function; 'F' if a normal function declaration
- preceded by 'extern "C"' (or nested inside 'extern "C"' braces); or
- 'f' for other function declarations. */
+ named FNAME. KIND is 'I' for an inline function; 'F' if a normal
+ function declaration preceded by 'extern "C"' (or nested inside
+ 'extern "C"' braces); or 'f' for other function declarations. */
void
-recognized_function (fname, line, kind, have_arg_list, file_seen)
+recognized_function (fname, line, kind, have_arg_list)
const cpp_token *fname;
unsigned int line;
int kind; /* One of 'f' 'F' or 'I' */
int have_arg_list;
- const char *file_seen;
{
struct partial_proto *partial;
int i;
@@ -552,9 +552,9 @@ recognized_function (fname, line, kind, have_arg_list, file_seen)
/* If the partial prototype was included from some other file,
we don't need to patch it up (in this run). */
- i = strlen (file_seen);
+ i = strlen (cur_file);
if (i < inc_filename_length
- || strcmp (inc_filename, file_seen + (i - inc_filename_length)) != 0)
+ || strcmp (inc_filename, cur_file + (i - inc_filename_length)) != 0)
return;
if (fn == NULL)
@@ -598,6 +598,15 @@ check_macro_names (pfile, names)
}
static void
+cb_change_file (pfile, fc)
+ cpp_reader *pfile ATTRIBUTE_UNUSED;
+ const cpp_file_change *fc;
+{
+ /* Just keep track of current file name. */
+ cur_file = fc->to.filename;
+}
+
+static void
read_scan_file (in_fname, argc, argv)
char *in_fname;
int argc;
@@ -612,6 +621,7 @@ read_scan_file (in_fname, argc, argv)
cpp_init (); /* Initialize cpplib. */
cpp_reader_init (&scan_in, CLK_GNUC89);
+ scan_in.cb.change_file = cb_change_file;
/* We are going to be scanning a header file out of its proper context,
so ignore warnings and errors. */