This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [incremental] Patch: FYI: rearrange BUILTINS_LOCATION


Tom> This updates all the other front ends, but I have not tried them
Tom> at all yet.

Oops, I forgot to append the libcpp part of the patch.
This is a pretty awful hack.  I may revisit it.

Tom

libcpp/ChangeLog:
2008-03-04  Tom Tromey  <tromey@redhat.com>

	* internal.h (struct cpp_reader) <entered_main_file>: New field.
	* files.c (_cpp_stack_file): Treat main file specially.

Index: libcpp/files.c
===================================================================
--- libcpp/files.c	(revision 132841)
+++ libcpp/files.c	(working copy)
@@ -1,6 +1,6 @@
 /* Part of CPP library.  File handling.
    Copyright (C) 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1998,
-   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
+   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
    Free Software Foundation, Inc.
    Written by Per Bothner, 1994.
    Based on CCCP program by Paul Rubin, June 1986
@@ -788,6 +788,7 @@
 {
   cpp_buffer *buffer;
   int sysp;
+  bool entered_main;
 
   if (!should_stack_file (pfile, file, import))
       return false;
@@ -820,8 +821,12 @@
   pfile->mi_cmacro = 0;
 
   /* Generate the call back.  */
-  _cpp_do_file_change (pfile, LC_ENTER, file->path, 1, sysp,
-		       file->st.st_uid == getuid ());
+  entered_main = pfile->entered_main_file;
+  pfile->entered_main_file = true;
+  if (! entered_main && ! pfile->line_table->maps)
+    entered_main = true;
+  _cpp_do_file_change (pfile, entered_main ? LC_ENTER : LC_RENAME,
+		       file->path, 1, sysp, file->st.st_uid == getuid ());
 
   return true;
 }
Index: libcpp/internal.h
===================================================================
--- libcpp/internal.h	(revision 132841)
+++ libcpp/internal.h	(working copy)
@@ -1,5 +1,5 @@
 /* Part of CPP library.
-   Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007
+   Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008
    Free Software Foundation, Inc.
 
 This program is free software; you can redistribute it and/or modify it
@@ -374,6 +374,9 @@
      been used.  */
   bool seen_once_only;
 
+  /* Nonzero if we have entered the main file into the line table.  */
+  bool entered_main_file;
+
   /* Multiple include optimization.  */
   const cpp_hashnode *mi_cmacro;
   const cpp_hashnode *mi_ind_cmacro;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]