dpatel 02/10/01 16:12:05
Modified: gcc cpplex.c
Log:
FSF merge cleanup for indexing.
Revision Changes Path
1.45 +35 -27 gcc3/gcc/cpplex.c
Index: cpplex.c
===================================================================
RCS file: /cvs/Darwin/gcc3/gcc/cpplex.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- cpplex.c 2002/09/19 02:40:29 1.44
+++ cpplex.c 2002/10/01 23:12:05 1.45
@@ -900,6 +900,9 @@
{
cpp_buffer *buffer = pfile->buffer;
bool more = false;
+ /* APPLE LOCAL indexing dpatel */
+ bool index = true;
+ char *saved_name = pfile->map->to_file;
buffer->saved_flags = BOL;
if (CPP_OPTION (pfile, traditional))
@@ -929,6 +932,8 @@
/* APPLE LOCAL end -Wnewline-eof 2001-08-23 sts */
cpp_error (pfile, DL_PEDWARN, "no newline at end of file");
handle_newline (pfile);
+ /* APPLE LOCAL indexing dpatel */
+ index = false;
}
/* Similarly, finish an in-progress directive with CPP_EOF
@@ -941,6 +946,35 @@
}
}
+ /* APPLE LOCAL begin indexing dpatel */
+ if (index)
+ {
+ if (flag_gen_index_original
+ && strcmp (pfile->map->to_file, "<built-in>")
+ && strcmp (pfile->map->to_file, "<command line>"))
+ {
+ if (buffer->prev)
+ process_header_indexing ((char *)saved_name, PB_INDEX_END);
+ else
+ {
+ if (pfile->map->to_file[0] != '/')
+ {
+ /* Append current pwd. We need absolute path. */
+ char *apath;
+ int alen = MAXPATHLEN + strlen (saved_name) + 2;
+ apath = (char *) xmalloc (sizeof (char) * alen);
+ apath = getcwd (apath, alen);
+ strcat (apath, "/");
+ strcat (apath, saved_name);
+ gen_indexing_info (INDEX_FILE_END, apath, -1);
+ free (apath);
+ }
+ else
+ gen_indexing_info (INDEX_FILE_END, saved_name, -1);
+ }
+ }
+ }
+ /* APPLE LOCAL end indexing dpatel */
return more;
}
@@ -994,34 +1028,8 @@
if (skip_whitespace (pfile, c))
goto skipped_white;
- /* APPLE LOCAL begin indexing dpatel */
- if (flag_gen_index_original
- && strcmp (pfile->map->to_file, "<built-in>")
- && strcmp (pfile->map->to_file, "<command line>"))
- {
- if (buffer->prev)
- process_header_indexing ((char *)pfile->map->to_file, PB_INDEX_END);
- else
- {
- if (pfile->map->to_file[0] != '/')
- {
- /* Append current pwd. We need absolute path. */
- char *apath;
- int alen = MAXPATHLEN + strlen (pfile->map->to_file) + 2;
- apath = (char *) xmalloc (sizeof (char) * alen);
- apath = getcwd (apath, alen);
- strcat (apath, "/");
- strcat (apath, pfile->map->to_file);
- gen_indexing_info (INDEX_FILE_END, apath, -1);
- free (apath);
- }
- else
- gen_indexing_info (INDEX_FILE_END, pfile->map->to_file, -1);
- }
- }
- /* APPLE LOCAL end indexing dpatel */
- /* End of buffer. */
buffer->cur--;
+ /* End of buffer. */
if (continue_after_nul (pfile))
goto fresh_line;
result->type = CPP_EOF;