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]

Patch installed for java warning nits


This patch fixes some java dir format and cast-qual warnings.  It also
condenses a lengthy string construction into a single call to the
`concat' function.  Bootstrapped on solaris2.7 and installed as
obvious.


Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/ChangeLog,v
retrieving revision 1.707
diff -u -p -r1.707 ChangeLog
--- ChangeLog	2001/03/28 19:22:05	1.707
+++ ChangeLog	2001/03/28 19:30:34
@@ -1,3 +1,12 @@
+2001-03-28  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+	* expr.c (pop_type_0): Call `concat' rather than building the
+	string manually.
+	(pop_type): Add format specifier in call to `error'.
+
+	* parse.y (patch_method_invocation): Avoid casting away
+	const-ness.
+
 2001-03-21  Alexandre Petit-Bianco  <apbianco@redhat.com>
 
 	* parse.y (qualify_ambiguous_name): Broaden `length'
Index: expr.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/expr.c,v
retrieving revision 1.107
diff -u -p -r1.107 expr.c
--- expr.c	2001/03/28 11:01:47	1.107
+++ expr.c	2001/03/28 19:30:35
@@ -355,24 +355,11 @@ pop_type_0 (type, messagep)
       else if (CLASS_INTERFACE (TYPE_NAME (TREE_TYPE (type))))
 	return object_ptr_type_node;
     }
-  {
-    const char *str1 = "expected type '";
-    const char *str3 = "' but stack contains '";
-    const char *str5 = "'";
-    int len1 = strlen (str1);
-    int len2 = strlen (lang_printable_name (type, 0));
-    int len3 = strlen (str3);
-    int len4 = strlen (lang_printable_name (t, 0));
-    int len5 = strlen (str5);
-    char *msg = xmalloc (len1 + len2 + len3 + len4 + len5 + 1);
-    *messagep = msg;
-    strcpy (msg, str1);  msg += len1;
-    strcpy (msg, lang_printable_name (type, 0));  msg += len2;
-    strcpy (msg, str3);  msg += len3;
-    strcpy (msg, lang_printable_name (t, 0));  msg += len4;
-    strcpy (msg, str5);
-    return type;
-  }
+
+  *messagep = concat ("expected type '", lang_printable_name (type, 0),
+		      "' but stack contains '", lang_printable_name (t, 0),
+		      "'", NULL);
+  return type;
 }
 
 /* Pop a type from the type stack.
@@ -387,7 +374,7 @@ pop_type (type)
   type = pop_type_0 (type, &message);
   if (message != NULL)
     {
-      error (message);
+      error ("%s", message);
       free (message);
     }
   return type;
Index: parse.y
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/parse.y,v
retrieving revision 1.272
diff -u -p -r1.272 parse.y
--- parse.y	2001/03/28 19:22:05	1.272
+++ parse.y	2001/03/28 19:30:39
@@ -9963,12 +9963,15 @@ patch_method_invocation (patch, primary,
       /* Calls to clone() on array types are permitted as a special-case. */
       && !is_array_clone_call)
     {
-      char *fct_name = (char *) IDENTIFIER_POINTER (DECL_NAME (list));
-      char *access = java_accstring_lookup (get_access_flags_from_decl (list));
-      char *klass = (char *) IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (list))));
-      char *refklass = (char *) IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class)));
-      char *what = (char *) (DECL_CONSTRUCTOR_P (list)
-			     ? "constructor" : "method");
+      const char *fct_name = IDENTIFIER_POINTER (DECL_NAME (list));
+      const char *access =
+	java_accstring_lookup (get_access_flags_from_decl (list));
+      const char *klass =
+	IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (list))));
+      const char *refklass =
+	IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class)));
+      const char *what = (DECL_CONSTRUCTOR_P (list)
+			  ? "constructor" : "method");
       /* FIXME: WFL yields the wrong message here but I don't know
 	 what else to use.  */
       parse_error_context (wfl,


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