diff options
| author | ghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-03-28 19:31:43 +0000 |
|---|---|---|
| committer | ghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-03-28 19:31:43 +0000 |
| commit | dc2c98d3bd30658ab2b1b64ff8bbb23b31ee7d3d (patch) | |
| tree | e23785d4eee463f83a1239e37d4b84c198cf1fcf /gcc/java/expr.c | |
| parent | 2aed6bc4b1a02deae7d0528b72aeaab75662f1a1 (diff) | |
| download | ppe42-gcc-dc2c98d3bd30658ab2b1b64ff8bbb23b31ee7d3d.tar.gz ppe42-gcc-dc2c98d3bd30658ab2b1b64ff8bbb23b31ee7d3d.zip | |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@40940 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/java/expr.c')
| -rw-r--r-- | gcc/java/expr.c | 25 |
1 files changed, 6 insertions, 19 deletions
diff --git a/gcc/java/expr.c b/gcc/java/expr.c index 072be6dea94..2ea6a813526 100644 --- a/gcc/java/expr.c +++ b/gcc/java/expr.c @@ -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; |

