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]

[cs] c-format.c patch


I checked in the attached patch into the compile-server branch.
--
	--Per Bothner
per@bothner.com   http://per.bothner.com/


2003-11-23  Per Bothner  <pbothner@apple.com>

	* c-format.c (init_dynamic_diag_info):  An identifier may exist yet
	not have a global value, e.g. when the compiler sercer sees a new file.

Index: c-format.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-format.c,v
retrieving revision 1.48
diff -u -p -r1.48 c-format.c
--- c-format.c	18 Jul 2003 23:05:53 -0000	1.48
+++ c-format.c	23 Nov 2003 20:28:32 -0000
@@ -2541,7 +2541,7 @@ init_dynamic_asm_fprintf_info (void)
 static void
 init_dynamic_diag_info (void)
 {
-  static tree t, loc, hwi;
+  static tree t, loc, hwi, tmp;
       
   if (!loc || !t || !hwi)
     {
@@ -2555,20 +2555,23 @@ init_dynamic_diag_info (void)
 	 you shouldn't use the specifiers requiring these types.
 	 However we don't force a hard ICE because we may see only one
 	 or the other type.  */
-      if ((loc = maybe_get_identifier ("location_t")))
-	loc = TREE_TYPE (identifier_global_value (loc));
+      if ((tmp = maybe_get_identifier ("location_t"))
+	  && (tmp = identifier_global_value (tmp)))
+	loc = TREE_TYPE (tmp);
 
       /* We need to grab the underlying `union tree_node' so peek into
 	 an extra type level.  */
-      if ((t = maybe_get_identifier ("tree")))
-	t = TREE_TYPE (TREE_TYPE (identifier_global_value (t)));
+      if ((tmp = maybe_get_identifier ("tree"))
+	  && (tmp = identifier_global_value (tmp)))
+	t = TREE_TYPE (TREE_TYPE (tmp));
     
       /* Find the underlying type for HOST_WIDE_INT.  For the %w
 	 length modifier to work, one must have issued: "typedef
 	 HOST_WIDE_INT __gcc_host_wide_int__;" in one's source code
 	 prior to using that modifier.  */
-      if ((hwi = maybe_get_identifier ("__gcc_host_wide_int__")))
-	hwi = DECL_ORIGINAL_TYPE (identifier_global_value (hwi));
+      if ((tmp = maybe_get_identifier ("__gcc_host_wide_int__"))
+	  && (tmp = identifier_global_value (tmp)))
+	hwi = DECL_ORIGINAL_TYPE (tmp);
       
       /* Assign the new data for use.  */
 

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