From 9ba2e1ef8028112b47eb48041ae387c60acea6b1 Mon Sep 17 00:00:00 2001 From: Neil Booth Date: Thu, 7 Dec 2000 07:14:42 +0000 Subject: c-common.c (parse_in): Make a cpp_reader *. * c-common.c (parse_in): Make a cpp_reader *. * cppfiles.c (_cpp_fake_include): Remove. * cpphash.h: Similarly. * cpplib.c (do_line): Don't call _cpp_fake_include. A valid #line always creates a callback; FC_RENAME if there are no #line flags. * fix-header.c (read_scan_file): cpp_push_buffer cannot fail. The first EOF must be our get_char buffer. From-SVN: r38101 --- gcc/cpplib.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'gcc/cpplib.c') diff --git a/gcc/cpplib.c b/gcc/cpplib.c index 26c2ece..537e477 100644 --- a/gcc/cpplib.c +++ b/gcc/cpplib.c @@ -721,7 +721,7 @@ do_line (pfile) cpp_buffer *buffer = pfile->buffer; const char *filename = buffer->nominal_fname; unsigned int lineno = buffer->lineno; - enum cpp_fc_reason reason = (enum cpp_fc_reason) -1; + enum cpp_fc_reason reason = FC_RENAME; unsigned long new_lineno; unsigned int cap; cpp_token token; @@ -749,19 +749,14 @@ do_line (pfile) unsigned int len; int action_number = 0; + /* FIXME: memory leak. */ len = token.val.str.len; - fname = alloca (len + 1); + fname = xmalloc (len + 1); memcpy (fname, token.val.str.text, len); fname[len] = '\0'; - if (strcmp (fname, buffer->nominal_fname)) - { - reason = FC_RENAME; - if (!strcmp (fname, buffer->inc->name)) - buffer->nominal_fname = buffer->inc->name; - else - buffer->nominal_fname = _cpp_fake_include (pfile, fname); - } + _cpp_simplify_pathname (fname); + buffer->nominal_fname = fname; if (read_line_number (pfile, &action_number) != 0) { @@ -803,8 +798,7 @@ do_line (pfile) /* Our line number is incremented after the directive is processed. */ buffer->lineno = new_lineno - 1; - if (reason != (enum cpp_fc_reason) -1) - _cpp_do_file_change (pfile, reason, filename, lineno); + _cpp_do_file_change (pfile, reason, filename, lineno); } /* Arrange the file_change callback. The assumption is that the -- cgit v1.1