This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [incremental] Patch: FYI: rearrange BUILTINS_LOCATION
- From: Tom Tromey <tromey at redhat dot com>
- To: Tom Tromey <tromey at redhat dot com>
- Cc: Gcc Patch List <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 5 Mar 2008 11:01:44 -0700
- Subject: Re: [incremental] Patch: FYI: rearrange BUILTINS_LOCATION
- References: <18382.57205.189771.842465@fleche.redhat.com>
- Reply-to: Tom Tromey <tromey at redhat dot com>
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;