diff options
author | Kaveh R. Ghazi <ghazi@caip.rutgers.edu> | 1999-10-14 17:13:57 +0000 |
---|---|---|
committer | Kaveh Ghazi <ghazi@gcc.gnu.org> | 1999-10-14 17:13:57 +0000 |
commit | 1ebadc609b97abf76eddff241200b4dcf8b10eb9 (patch) | |
tree | ec9cc3db1f41e003ff786220d74ae92ec3483df3 /gcc/java/parse.c | |
parent | fe50c0eb3bcd01019e3b8e610b3906510a5d4b8e (diff) | |
download | gcc-1ebadc609b97abf76eddff241200b4dcf8b10eb9.zip gcc-1ebadc609b97abf76eddff241200b4dcf8b10eb9.tar.gz gcc-1ebadc609b97abf76eddff241200b4dcf8b10eb9.tar.bz2 |
jcf-dump.c (print_constant, [...]): Don't call a variadic function with a non-literal format string.
* jcf-dump.c (print_constant, disassemble_method): Don't call a
variadic function with a non-literal format string.
* parse-scan.y (report_main_declaration): Likewise.
* parse.h (ERROR_CAST_NEEDED_TO_INTEGRAL): Likewise.
* parse.y (read_import_dir, patch_assignment, patch_binop,
patch_array_ref): Likewise.
* typeck.c (build_java_array_type): Likewise.
* verify.c (verify_jvm_instructions): Likewise.
From-SVN: r29981
Diffstat (limited to 'gcc/java/parse.c')
-rw-r--r-- | gcc/java/parse.c | 60 |
1 files changed, 34 insertions, 26 deletions
diff --git a/gcc/java/parse.c b/gcc/java/parse.c index d19a78c..9cc96f8 100644 --- a/gcc/java/parse.c +++ b/gcc/java/parse.c @@ -2388,10 +2388,8 @@ int yydebug; /* nonzero means print parse trace */ /* Prevent warning if -Wstrict-prototypes. */ #ifdef __GNUC__ -#ifndef YYPARSE_PARAM int yyparse (void); #endif -#endif #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) @@ -7911,11 +7909,9 @@ read_import_dir (wfl) static int first = 1; if (first) { - char buffer [256]; - sprintf (buffer, "Can't find default package `%s'. Check " - "the CLASSPATH environment variable and the access to the " - "archives.", package_name); - error (buffer); + error ("Can't find default package `%s'. Check " + "the CLASSPATH environment variable and the access to the " + "archives.", package_name); java_error_count++; first = 0; } @@ -11717,11 +11713,14 @@ patch_assignment (node, wfl_op1, wfl_op2) strcpy (operation, "`='"); } - parse_error_context - (wfl, (!valid_cast_to_p (rhs_type, lhs_type) ? - "Incompatible type for %s. Can't convert `%s' to `%s'" : - "Incompatible type for %s. Explicit cast " - "needed to convert `%s' to `%s'"), operation, t1, t2); + if (!valid_cast_to_p (rhs_type, lhs_type)) + parse_error_context (wfl, "Incompatible type for %s. " + "Can't convert `%s' to `%s'", + operation, t1, t2); + else + parse_error_context (wfl, "Incompatible type for %s. " + "Explicit cast needed to convert `%s' to `%s'", + operation, t1, t2); free (t1); free (t2); error_found = 1; } @@ -12325,13 +12324,21 @@ patch_binop (node, wfl_op1, wfl_op2) if (!JINTEGRAL_TYPE_P (op1_type)) ERROR_CAST_NEEDED_TO_INTEGRAL (wfl_operator, node, op1_type); else - parse_error_context - (wfl_operator, (JPRIMITIVE_TYPE_P (op2_type) ? - "Incompatible type for `%s'. Explicit cast needed to convert " - "shift distance from `%s' to integral" : - "Incompatible type for `%s'. Can't convert shift distance from " - "`%s' to integral"), - operator_string (node), lang_printable_name (op2_type, 0)); + { + if (JPRIMITIVE_TYPE_P (op2_type)) + parse_error_context (wfl_operator, + "Incompatible type for `%s'. " + "Explicit cast needed to convert " + "shift distance from `%s' to integral", + operator_string (node), + lang_printable_name (op2_type, 0)); + else + parse_error_context (wfl_operator, "Incompatible type for `%s'." + " Can't convert shift distance from " + "`%s' to integral", + operator_string (node), + lang_printable_name (op2_type, 0)); + } TREE_TYPE (node) = error_mark_node; error_found = 1; break; @@ -13191,13 +13198,14 @@ patch_array_ref (node) index = do_unary_numeric_promotion (index); if (TREE_TYPE (index) != int_type_node) { - int could_cast = valid_cast_to_p (index_type, int_type_node); - parse_error_context - (wfl_operator, - (could_cast ? "Incompatible type for `[]'. Explicit cast needed to " - "convert `%s' to `int'" : "Incompatible type for `[]'. " - "Can't convert `%s' to `int'"), - lang_printable_name (index_type, 0)); + if (valid_cast_to_p (index_type, int_type_node)) + parse_error_context (wfl_operator, "Incompatible type for `[]'. " + "Explicit cast needed to convert `%s' to `int'", + lang_printable_name (index_type, 0)); + else + parse_error_context (wfl_operator, "Incompatible type for `[]'. " + "Can't convert `%s' to `int'", + lang_printable_name (index_type, 0)); TREE_TYPE (node) = error_mark_node; error_found = 1; } |