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]

[F PATCH]: use location_t


Hi,
Here's the obvious set of fortran fixes. I've installed after
testing 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-05-03  Nathan Sidwell  <nathan@codesourcery.com>

	* com.c (ffecom_do_entry_): Use location_t and input_location
	directly.
	(ffecom_gen_sfuncdef_): Likewise.
	(ffecom_start_progunit_): Likewise.
	(ffecom_sym_transform_): Likewise.
	(ffecom_sym_transform_assign_): Likewise.
	* lex.c (ffelex_hash_): Likewise.
	(ffelex_include_): Likewise.
	* std.c (ffestd_exec_begin): Likewise.
	(ffestd_exec_end): Likewise.
	* ste.c (struct gbe_block): Likewise.
	(ffeste_start_block_): Likewise.
	(ffeste_start_stmt_): Likewise.

Index: f/com.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/f/com.c,v
retrieving revision 1.191
diff -c -3 -p -r1.191 com.c
*** f/com.c	1 May 2003 16:13:35 -0000	1.191
--- f/com.c	3 May 2003 13:58:52 -0000
*************** ffecom_do_entry_ (ffesymbol fn, int entr
*** 2582,2590 ****
  				   CHARACTER. */
    bool cmplxfunc;		/* Use f2c way of returning COMPLEX. */
    bool multi;			/* Master fn has multiple return types. */
!   bool altreturning = FALSE;	/* This entry point has alternate returns. */
!   int old_lineno = input_line;
!   const char *old_input_filename = input_filename;
  
    input_filename = ffesymbol_where_filename (fn);
    input_line = ffesymbol_where_filelinenum (fn);
--- 2582,2590 ----
  				   CHARACTER. */
    bool cmplxfunc;		/* Use f2c way of returning COMPLEX. */
    bool multi;			/* Master fn has multiple return types. */
!   bool altreturning = FALSE;	/* This entry point has alternate
! 				   returns. */
!   location_t old_loc = input_location;
  
    input_filename = ffesymbol_where_filename (fn);
    input_line = ffesymbol_where_filelinenum (fn);
*************** ffecom_do_entry_ (ffesymbol fn, int entr
*** 2917,2925 ****
  
    finish_function (0);
  
!   input_line = old_lineno;
!   input_filename = old_input_filename;
! 
    ffecom_doing_entry_ = FALSE;
  }
  
--- 2917,2924 ----
  
    finish_function (0);
  
!   input_location = old_loc;
!   
    ffecom_doing_entry_ = FALSE;
  }
  
*************** ffecom_gen_sfuncdef_ (ffesymbol s, ffein
*** 6110,6117 ****
    tree result;
    bool charfunc = (bt == FFEINFO_basictypeCHARACTER);
    static bool recurse = FALSE;
!   int old_lineno = input_line;
!   const char *old_input_filename = input_filename;
  
    ffecom_nested_entry_ = s;
  
--- 6109,6115 ----
    tree result;
    bool charfunc = (bt == FFEINFO_basictypeCHARACTER);
    static bool recurse = FALSE;
!   location_t old_loc = input_location;
  
    ffecom_nested_entry_ = s;
  
*************** ffecom_gen_sfuncdef_ (ffesymbol s, ffein
*** 6221,6228 ****
  
    recurse = FALSE;
  
!   input_line = old_lineno;
!   input_filename = old_input_filename;
  
    ffecom_nested_entry_ = NULL;
  
--- 6219,6225 ----
  
    recurse = FALSE;
  
!   input_location = old_loc;
  
    ffecom_nested_entry_ = NULL;
  
*************** ffecom_start_progunit_ ()
*** 7080,7087 ****
    && (ffecom_primary_entry_kind_ == FFEINFO_kindFUNCTION)
    && (ffecom_master_bt_ == FFEINFO_basictypeNONE);
    bool main_program = FALSE;
!   int old_lineno = input_line;
!   const char *old_input_filename = input_filename;
  
    assert (fn != NULL);
    assert (ffesymbol_hook (fn).decl_tree == NULL_TREE);
--- 7077,7083 ----
    && (ffecom_primary_entry_kind_ == FFEINFO_kindFUNCTION)
    && (ffecom_master_bt_ == FFEINFO_basictypeNONE);
    bool main_program = FALSE;
!   location_t old_loc = input_location;
  
    assert (fn != NULL);
    assert (ffesymbol_hook (fn).decl_tree == NULL_TREE);
*************** ffecom_start_progunit_ ()
*** 7269,7276 ****
    /* Disallow temp vars at this level.  */
    current_binding_level->prep_state = 2;
  
!   input_line = old_lineno;
!   input_filename = old_input_filename;
  
    /* This handles any symbols still untransformed, in case -g specified.
       This used to be done in ffecom_finish_progunit, but it turns out to
--- 7265,7271 ----
    /* Disallow temp vars at this level.  */
    current_binding_level->prep_state = 2;
  
!   input_location = old_loc;
  
    /* This handles any symbols still untransformed, in case -g specified.
       This used to be done in ffecom_finish_progunit, but it turns out to
*************** ffecom_sym_transform_ (ffesymbol s)
*** 7298,7306 ****
    ffeinfoBasictype bt;
    ffeinfoKindtype kt;
    ffeglobal g;
!   int old_lineno = input_line;
!   const char *old_input_filename = input_filename;
! 
    /* Must ensure special ASSIGN variables are declared at top of outermost
       block, else they'll end up in the innermost block when their first
       ASSIGN is seen, which leaves them out of scope when they're the
--- 7293,7300 ----
    ffeinfoBasictype bt;
    ffeinfoKindtype kt;
    ffeglobal g;
!   location_t old_loc = input_location;
!   
    /* Must ensure special ASSIGN variables are declared at top of outermost
       block, else they'll end up in the innermost block when their first
       ASSIGN is seen, which leaves them out of scope when they're the
*************** ffecom_sym_transform_ (ffesymbol s)
*** 8294,8301 ****
    ffesymbol_hook (s).length_tree = tlen;
    ffesymbol_hook (s).addr = addr;
  
!   input_line = old_lineno;
!   input_filename = old_input_filename;
  
    return s;
  }
--- 8288,8294 ----
    ffesymbol_hook (s).length_tree = tlen;
    ffesymbol_hook (s).addr = addr;
  
!   input_location = old_loc;
  
    return s;
  }
*************** static ffesymbol
*** 8312,8319 ****
  ffecom_sym_transform_assign_ (ffesymbol s)
  {
    tree t;			/* Transformed thingy. */
!   int old_lineno = input_line;
!   const char *old_input_filename = input_filename;
  
    if (ffesymbol_sfdummyparent (s) == NULL)
      {
--- 8305,8311 ----
  ffecom_sym_transform_assign_ (ffesymbol s)
  {
    tree t;			/* Transformed thingy. */
!   location_t old_loc = input_location;
  
    if (ffesymbol_sfdummyparent (s) == NULL)
      {
*************** ffecom_sym_transform_assign_ (ffesymbol 
*** 8375,8382 ****
  
    ffesymbol_hook (s).assign_tree = t;
  
!   input_line = old_lineno;
!   input_filename = old_input_filename;
  
    return s;
  }
--- 8367,8373 ----
  
    ffesymbol_hook (s).assign_tree = t;
  
!   input_location = old_loc;
  
    return s;
  }
Index: f/lex.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/f/lex.c,v
retrieving revision 1.38
diff -c -3 -p -r1.38 lex.c
*** f/lex.c	2 May 2003 11:33:05 -0000	1.38
--- f/lex.c	3 May 2003 13:59:00 -0000
*************** ffelex_hash_ (FILE *finput)
*** 1193,1200 ****
    if ((token != NULL)
        && (ffelex_token_type (token) == FFELEX_typeNUMBER))
      {
!       int old_lineno = input_line;
!       const char *old_input_filename = input_filename;
        ffewhereFile wf;
  
        /* subtract one, because it is the following line that
--- 1193,1199 ----
    if ((token != NULL)
        && (ffelex_token_type (token) == FFELEX_typeNUMBER))
      {
!       location_t old_loc = input_location;
        ffewhereFile wf;
  
        /* subtract one, because it is the following line that
*************** ffelex_hash_ (FILE *finput)
*** 1281,1294 ****
  	  if (ffelex_kludge_flag_)
  	    {
  	      input_line = 1;
! 	      input_filename = old_input_filename;
  	      error ("use `#line ...' instead of `# ...' in first line");
  	    }
  
  	  if (num == 1)
  	    {
  	      /* Pushing to a new file.  */
! 	      ffelex_file_push_ (old_lineno, input_filename);
  	    }
  	  else if (num == 2)
  	    {
--- 1280,1293 ----
  	  if (ffelex_kludge_flag_)
  	    {
  	      input_line = 1;
! 	      input_filename = old_loc.file;
  	      error ("use `#line ...' instead of `# ...' in first line");
  	    }
  
  	  if (num == 1)
  	    {
  	      /* Pushing to a new file.  */
! 	      ffelex_file_push_ (old_loc.line, input_filename);
  	    }
  	  else if (num == 2)
  	    {
*************** ffelex_hash_ (FILE *finput)
*** 1325,1331 ****
  	  && ffelex_kludge_flag_)
  	{
  	  input_line = 1;
! 	  input_filename = old_input_filename;
  	  error ("use `#line ...' instead of `# ...' in first line");
  	}
        if (c == '\n' || c == EOF)
--- 1324,1330 ----
  	  && ffelex_kludge_flag_)
  	{
  	  input_line = 1;
! 	  input_filename = old_loc.file;
  	  error ("use `#line ...' instead of `# ...' in first line");
  	}
        if (c == '\n' || c == EOF)
*************** ffelex_include_ ()
*** 1470,1477 ****
    ffewhereLineNumber linecount_current = ffelex_linecount_current_;
    ffewhereLineNumber linecount_offset
      = ffewhere_line_filelinenum (current_wl);
!   int old_lineno = input_line;
!   const char *old_input_filename = input_filename;
  
    if (card_length != 0)
      {
--- 1469,1475 ----
    ffewhereLineNumber linecount_current = ffelex_linecount_current_;
    ffewhereLineNumber linecount_offset
      = ffewhere_line_filelinenum (current_wl);
!   location_t old_loc = input_location;
  
    if (card_length != 0)
      {
*************** ffelex_include_ ()
*** 1489,1495 ****
  
    ffewhere_file_set (include_wherefile, TRUE, 0);
  
!   ffelex_file_push_ (old_lineno, ffewhere_file_name (include_wherefile));
  
    if (ffelex_include_free_form_)
      ffelex_file_free (include_wherefile, include_file);
--- 1487,1493 ----
  
    ffewhere_file_set (include_wherefile, TRUE, 0);
  
!   ffelex_file_push_ (old_loc.line, ffewhere_file_name (include_wherefile));
  
    if (ffelex_include_free_form_)
      ffelex_file_free (include_wherefile, include_file);
*************** ffelex_include_ ()
*** 1512,1519 ****
      }
    ffelex_card_image_[card_length] = '\0';
  
!   input_filename = old_input_filename;
!   input_line = old_lineno;
    ffelex_linecount_current_ = linecount_current;
    ffelex_current_wf_ = current_wf;
    ffelex_final_nontab_column_ = final_nontab_column;
--- 1510,1516 ----
      }
    ffelex_card_image_[card_length] = '\0';
  
!   input_location = old_loc;
    ffelex_linecount_current_ = linecount_current;
    ffelex_current_wf_ = current_wf;
    ffelex_final_nontab_column_ = final_nontab_column;
Index: f/std.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/f/std.c,v
retrieving revision 1.18
diff -c -3 -p -r1.18 std.c
*** f/std.c	1 May 2003 16:13:35 -0000	1.18
--- f/std.c	3 May 2003 13:59:08 -0000
*************** ffestd_exec_begin ()
*** 1423,1430 ****
  void
  ffestd_exec_end ()
  {
!   int old_lineno = input_line;
!   const char *old_input_filename = input_filename;
  
    ffecom_end_transition ();
  
--- 1423,1429 ----
  void
  ffestd_exec_end ()
  {
!   location_t old_loc = input_location;
  
    ffecom_end_transition ();
  
*************** ffestd_exec_end ()
*** 1456,1463 ****
    ffestd_stmt_list_.last = NULL;
    ffestd_2pass_entrypoints_ = 0;
  
!   input_line = old_lineno;
!   input_filename = old_input_filename;
  }
  
  /* ffestd_init_3 -- Initialize for any program unit
--- 1455,1461 ----
    ffestd_stmt_list_.last = NULL;
    ffestd_2pass_entrypoints_ = 0;
  
!   input_location = old_loc;
  }
  
  /* ffestd_init_3 -- Initialize for any program unit
Index: f/ste.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/f/ste.c,v
retrieving revision 1.35
diff -c -3 -p -r1.35 ste.c
*** f/ste.c	1 May 2003 16:13:35 -0000	1.35
--- f/ste.c	3 May 2003 13:59:16 -0000
*************** typedef struct gbe_block
*** 387,394 ****
  {
    struct gbe_block *outer;
    ffestw block;
!   int lineno;
!   const char *filename;
    bool is_stmt;
  } *gbe_block;
  
--- 387,393 ----
  {
    struct gbe_block *outer;
    ffestw block;
!   location_t location;
    bool is_stmt;
  } *gbe_block;
  
*************** ffeste_start_block_ (ffestw block)
*** 401,408 ****
  
    b->outer = ffeste_top_block_;
    b->block = block;
!   b->lineno = input_line;
!   b->filename = input_filename;
    b->is_stmt = FALSE;
  
    ffeste_top_block_ = b;
--- 400,406 ----
  
    b->outer = ffeste_top_block_;
    b->block = block;
!   b->location = input_location;
    b->is_stmt = FALSE;
  
    ffeste_top_block_ = b;
*************** ffeste_start_stmt_(void)
*** 443,450 ****
  
    b->outer = ffeste_top_block_;
    b->block = NULL;
!   b->lineno = input_line;
!   b->filename = input_filename;
    b->is_stmt = TRUE;
  
    ffeste_top_block_ = b;
--- 441,447 ----
  
    b->outer = ffeste_top_block_;
    b->block = NULL;
!   b->location = input_location;
    b->is_stmt = TRUE;
  
    ffeste_top_block_ = b;

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