[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gcc-patches
Subject:    PATCH: bug fix for Java string concatenation
From:       Tom Tromey <tromey () cygnus ! com>
Date:       1999-01-29 23:14:35
[Download RAW message or body]

I'm committing the appended patch.  It fixes a bug in string
concatenation where one of the arguments was a char[].

1999-01-29  Tom Tromey  <tromey@cygnus.com>

	* parse.h (BUILD_APPEND): If ARG is a non-String object reference,
	then cast it to Object before calling `append' method.

Tom

Index: parse.h
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/java/parse.h,v
retrieving revision 1.33.2.12
diff -u -r1.33.2.12 parse.h
--- parse.h	1999/01/13 12:00:57	1.33.2.12
+++ parse.h	1999/01/29 20:32:35
@@ -498,9 +498,16 @@
 #define COMPLETE_CHECK_OP_2(NODE) COMPLETE_CHECK_OP(NODE, 2)
 
 /* Building invocations: append(ARG) and StringBuffer(ARG) */
-#define BUILD_APPEND(ARG)						     \
-  build_method_invocation (wfl_append, 					     \
-			   (ARG ? build_tree_list (NULL, (ARG)): NULL_TREE))
+#define BUILD_APPEND(ARG)						      \
+  ((JSTRING_TYPE_P (TREE_TYPE (ARG)) || JPRIMITIVE_TYPE_P (TREE_TYPE (ARG)))  \
+   ? build_method_invocation (wfl_append,                                     \
+			      ARG ? build_tree_list (NULL, (ARG)) : NULL_TREE)\
+   : build_method_invocation (wfl_append,                                     \
+			      ARG ? build_tree_list (NULL,                    \
+						     build1 (CONVERT_EXPR,    \
+							     object_type_node,\
+							     (ARG)))          \
+			      : NULL_TREE))
 #define BUILD_STRING_BUFFER(ARG)					      \
   build_new_invocation (wfl_string_buffer, 				      \
 			(ARG ? build_tree_list (NULL, (ARG)) : NULL_TREE))

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic