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]

[PATCH]: Location_tize tree.c


Hi,
I've installed the attached obvious patch which dinks a file/lineno pair
in tree.c and c-decl.c. I tested this with an abort, should input_filename
be NULL in tree.c.

I chose '<internal>' to be consistent with cc1plus. As Zack suggests we'll
probably change this to some magic location in the future.

I have a couple of patches awaiting review. To avoid confusion, they are,
http://gcc.gnu.org/ml/gcc-patches/2003-06/msg03130.html (pretty obvious)
http://gcc.gnu.org/ml/gcc-patches/2003-06/msg03057.html

booted & tested on i686-pc-linux-gnu.

nathan
--
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
         The voices in my head said this was stupid too
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk

2003-06-29  Nathan Sidwell  <nathan@codesourcery.com>

	* c-decl.c (c_init_decl_processing): Use a location_t. Set input
	filename to <internal>.
	* tree.c (make_node): Just copy the current location.

Index: tree.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree.c,v
retrieving revision 1.309
diff -c -3 -p -r1.309 tree.c
*** tree.c	16 Jun 2003 21:41:06 -0000	1.309
--- tree.c	29 Jun 2003 09:41:37 -0000
*************** make_node (code)
*** 308,316 ****
  	DECL_ALIGN (t) = 1;
        DECL_USER_ALIGN (t) = 0;
        DECL_IN_SYSTEM_HEADER (t) = in_system_header;
!       DECL_SOURCE_LINE (t) = input_line;
!       DECL_SOURCE_FILE (t) =
! 	(input_filename) ? input_filename : "<built-in>";
        DECL_UID (t) = next_decl_uid++;
  
        /* We have not yet computed the alias set for this declaration.  */
--- 308,314 ----
  	DECL_ALIGN (t) = 1;
        DECL_USER_ALIGN (t) = 0;
        DECL_IN_SYSTEM_HEADER (t) = in_system_header;
!       DECL_SOURCE_LOCATION (t) = input_location;
        DECL_UID (t) = next_decl_uid++;
  
        /* We have not yet computed the alias set for this declaration.  */
Index: c-decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-decl.c,v
retrieving revision 1.398
diff -c -3 -p -r1.398 c-decl.c
*** c-decl.c	27 Jun 2003 09:05:44 -0000	1.398
--- c-decl.c	29 Jun 2003 09:41:50 -0000
*************** c_init_decl_processing (void)
*** 2232,2239 ****
  {
    tree endlink;
    tree ptr_ftype_void, ptr_ftype_ptr;
!   const char *save_input_filename;
! 
    /* Adds some ggc roots, and reserved words for c-parse.in.  */
    c_parse_init ();
  
--- 2232,2239 ----
  {
    tree endlink;
    tree ptr_ftype_void, ptr_ftype_ptr;
!   location_t save_loc = input_location;
!   
    /* Adds some ggc roots, and reserved words for c-parse.in.  */
    c_parse_init ();
  
*************** c_init_decl_processing (void)
*** 2248,2255 ****
    /* Declarations from c_common_nodes_and_builtins must not be associated
       with this input file, lest we get differences between using and not
       using preprocessed headers.  */
!   save_input_filename = input_filename;
!   input_filename = NULL;
  
    build_common_tree_nodes (flag_signed_char);
  
--- 2248,2255 ----
    /* Declarations from c_common_nodes_and_builtins must not be associated
       with this input file, lest we get differences between using and not
       using preprocessed headers.  */
!   input_location.file = "<internal>";
!   input_location.line = 0;
  
    build_common_tree_nodes (flag_signed_char);
  
*************** c_init_decl_processing (void)
*** 2277,2283 ****
      = build_function_type (ptr_type_node,
  			   tree_cons (NULL_TREE, ptr_type_node, endlink));
  
!   input_filename = save_input_filename;
  
    pedantic_lvalues = pedantic;
  
--- 2277,2283 ----
      = build_function_type (ptr_type_node,
  			   tree_cons (NULL_TREE, ptr_type_node, endlink));
  
!   input_location = save_loc;
  
    pedantic_lvalues = pedantic;
  

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