[mainline] PATCH do c-decl.c: Remove xxx_with_file_and_line

Gabriel Dos Reis gdr@integrable-solutions.net
Thu May 8 15:10:00 GMT 2003


Hi,

This removes uses of  xxx_with_and_line functions from c-decl.c.

Bootstrapped and regtested on an i686-pc-linux-gnu.

-- Gaby
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ChangeLog,v
retrieving revision 1.17734
diff -p -r1.17734 ChangeLog
*** ChangeLog	8 May 2003 13:45:27 -0000	1.17734
--- ChangeLog	8 May 2003 14:06:13 -0000
***************
*** 1,3 ****
--- 1,15 ----
+ 2003-05-08  Gabriel Dos Reis  <gdr@integrable-solutions.net>
+ 
+ 	* c-decl.c (define_label): Tidy.  Don't use any of
+ 	error_with_file_and_line or warning_with_file_and_file.
+ 	(pending_xref_error): Likewise.
+ 	(store_parm_decls): Likewise.
+ 	(current_function_prototype_locus): New object.  Package from
+ 	current_function_prototype_file and current_function_prototype_line.
+ 	(start_function): Use it.
+ 	(current_function_prototype_file): Remove.
+ 	(current_function_prototype_line): Remove;
+ 
  2003-05-08  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
  
  	* builtins.c (readonly_data_expr): New function.
Index: c-decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-decl.c,v
retrieving revision 1.385
diff -p -r1.385 c-decl.c
*** c-decl.c	3 May 2003 13:28:31 -0000	1.385
--- c-decl.c	8 May 2003 14:06:16 -0000
*************** static tree current_function_parm_tags;
*** 100,107 ****
  
  /* Similar, for the file and line that the prototype came from if this is
     an old-style definition.  */
! static const char *current_function_prototype_file;
! static int current_function_prototype_line;
  
  /* The current statement tree.  */
  
--- 100,106 ----
  
  /* Similar, for the file and line that the prototype came from if this is
     an old-style definition.  */
! static location_t current_function_prototype_locus;
  
  /* The current statement tree.  */
  
*************** shadow_label (name)
*** 2070,2081 ****
     Otherwise return 0.  */
  
  tree
! define_label (filename, line, name)
!      const char *filename;
!      int line;
!      tree name;
  {
    tree decl = lookup_label (name);
  
    /* If label with this name is known from an outer context, shadow it.  */
    if (decl != 0 && DECL_CONTEXT (decl) != current_function_decl)
--- 2069,2080 ----
     Otherwise return 0.  */
  
  tree
! define_label (const char* filename, int line, tree name)
  {
+   location_t locus;
    tree decl = lookup_label (name);
+   locus.file = file;
+   locus.line = line;
  
    /* If label with this name is known from an outer context, shadow it.  */
    if (decl != 0 && DECL_CONTEXT (decl) != current_function_decl)
*************** define_label (filename, line, name)
*** 2086,2099 ****
      }
  
    if (warn_traditional && !in_system_header && lookup_name (name))
!     warning_with_file_and_line (filename, line,
! 				"traditional C lacks a separate namespace for labels, identifier `%s' conflicts",
! 				IDENTIFIER_POINTER (name));
  
    if (DECL_INITIAL (decl) != 0)
      {
!       error_with_file_and_line (filename, line, "duplicate label `%s'",
! 				IDENTIFIER_POINTER (name));
        return 0;
      }
    else
--- 2085,2096 ----
      }
  
    if (warn_traditional && !in_system_header && lookup_name (name))
!     warning ("%Htraditional C lacks a separate namespace for labels, "
!              "identifier `%s' conflicts", &locus, IDENTIFIER_POINTER (name));
  
    if (DECL_INITIAL (decl) != 0)
      {
!       error ("%Hduplicate label `%s'", &locus, IDENTIFIER_POINTER (name));
        return 0;
      }
    else
*************** define_label (filename, line, name)
*** 2101,2108 ****
        /* Mark label as having been defined.  */
        DECL_INITIAL (decl) = error_mark_node;
        /* Say where in the source.  */
!       DECL_SOURCE_FILE (decl) = filename;
!       DECL_SOURCE_LINE (decl) = line;
        return decl;
      }
  }
--- 2098,2104 ----
        /* Mark label as having been defined.  */
        DECL_INITIAL (decl) = error_mark_node;
        /* Say where in the source.  */
!       DECL_SOURCE_LOCATION (decl) = locus;
        return decl;
      }
  }
*************** void
*** 2202,2211 ****
  pending_xref_error ()
  {
    if (pending_invalid_xref != 0)
!     error_with_file_and_line (pending_invalid_xref_location.file,
! 			      pending_invalid_xref_location.line,
! 			      "`%s' defined as wrong kind of tag",
! 			      IDENTIFIER_POINTER (pending_invalid_xref));
    pending_invalid_xref = 0;
  }
  
--- 2198,2206 ----
  pending_xref_error ()
  {
    if (pending_invalid_xref != 0)
!     error ("%H`%s' defined as wrong kind of tag",
!            &pending_invalid_xref_location,
!            IDENTIFIER_POINTER (pending_invalid_xref));
    pending_invalid_xref = 0;
  }
  
*************** start_function (declspecs, declarator, a
*** 5536,5543 ****
        && TYPE_ARG_TYPES (TREE_TYPE (decl1)) == 0)
      {
        TREE_TYPE (decl1) = TREE_TYPE (old_decl);
!       current_function_prototype_file = DECL_SOURCE_FILE (old_decl);
!       current_function_prototype_line = DECL_SOURCE_LINE (old_decl);
      }
  
    /* Optionally warn of old-fashioned def with no previous prototype.  */
--- 5531,5537 ----
        && TYPE_ARG_TYPES (TREE_TYPE (decl1)) == 0)
      {
        TREE_TYPE (decl1) = TREE_TYPE (old_decl);
!       current_function_prototype_locus = DECL_SOURCE_LOCATION (old_decl);
      }
  
    /* Optionally warn of old-fashioned def with no previous prototype.  */
*************** store_parm_decls ()
*** 5966,5974 ****
  		  || TYPE_MAIN_VARIANT (TREE_VALUE (type)) == void_type_node)
  		{
  		  error ("number of arguments doesn't match prototype");
! 		  error_with_file_and_line (current_function_prototype_file,
! 					    current_function_prototype_line,
! 					    "prototype declaration");
  		  break;
  		}
  	      /* Type for passing arg must be consistent with that
--- 5960,5967 ----
  		  || TYPE_MAIN_VARIANT (TREE_VALUE (type)) == void_type_node)
  		{
  		  error ("number of arguments doesn't match prototype");
! 		  error ("%Hprototype declaration",
!                          &current_function_prototype_locus);
  		  break;
  		}
  	      /* Type for passing arg must be consistent with that
*************** store_parm_decls ()
*** 5997,6015 ****
  			{
  			  pedwarn ("promoted argument `%s' doesn't match prototype",
  				   IDENTIFIER_POINTER (DECL_NAME (parm)));
! 			  warning_with_file_and_line
! 			    (current_function_prototype_file,
! 			     current_function_prototype_line,
! 			     "prototype declaration");
  			}
  		    }
  		  else
  		    {
  		      error ("argument `%s' doesn't match prototype",
  			     IDENTIFIER_POINTER (DECL_NAME (parm)));
! 		      error_with_file_and_line (current_function_prototype_file,
! 						current_function_prototype_line,
! 						"prototype declaration");
  		    }
  		}
  	    }
--- 5990,6005 ----
  			{
  			  pedwarn ("promoted argument `%s' doesn't match prototype",
  				   IDENTIFIER_POINTER (DECL_NAME (parm)));
! 			  warning ("%Hprototype declaration",
!                                    &current_function_prototype_locus);
  			}
  		    }
  		  else
  		    {
  		      error ("argument `%s' doesn't match prototype",
  			     IDENTIFIER_POINTER (DECL_NAME (parm)));
! 		      error ("%Hprototype declaration",
!                              &current_function_prototype_locus);
  		    }
  		}
  	    }



More information about the Gcc-patches mailing list