+1999-10-14 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * 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.
+
Tue Oct 12 22:28:10 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
* jcf-write.c (RELOCATION_VALUE_1): Fixed integer value from 0 to 1.
case CONSTANT_Class:
n = JPOOL_USHORT1 (jcf, index);
if (verbosity > 0)
- fprintf (out, verbosity > 1 ? "Class name: %d=" : "Class ", n);
+ {
+ if (verbosity > 1)
+ fprintf (out, "Class name: %d=", n);
+ else
+ fprintf (out, "Class ");
+ }
if (! CPOOL_INDEX_IN_RANGE (&jcf->cpool, n))
fprintf (out, "<out of range>");
else if (verbosity < 2 && JPOOL_TAG (jcf, n) == CONSTANT_Utf8)
else if (verbosity > 0)
fprintf (out, "%s ", str);
print_constant_terse (out, jcf, tclass, CONSTANT_Class);
- fprintf (out, verbosity < 2 ? "." : " name_and_type: %d=<",
- name_and_type);
+ if (verbosity < 2)
+ fprintf (out, ".");
+ else
+ fprintf (out, " name_and_type: %d=<", name_and_type);
print_constant_terse (out, jcf, name_and_type, CONSTANT_NameAndType);
if (verbosity == 2)
fputc ('>', out);
case CONSTANT_String:
j = JPOOL_USHORT1 (jcf, index);
if (verbosity > 0)
- fprintf (out, verbosity > 1 ? "String %d=" : "String ", j);
+ {
+ if (verbosity > 1)
+ fprintf (out, "String %d=", j);
+ else
+ fprintf (out, "String ");
+ }
print_constant_terse (out, jcf, j, CONSTANT_Utf8);
break;
case CONSTANT_Integer:
uint16 name = JPOOL_USHORT1 (jcf, index);
uint16 sig = JPOOL_USHORT2 (jcf, index);
if (verbosity > 0)
- fprintf (out, verbosity > 1 ? "%s name: %d=" : "%s ",
- "NameAndType", name);
+ {
+ if (verbosity > 1)
+ fprintf (out, "NameAndType name: %d=", name);
+ else
+ fprintf (out, "NameAndType ");
+ }
print_name (out, jcf, name);
if (verbosity <= 1)
fputc (' ', out);
#define ARRAY_NEW(TYPE) ARRAY_NEW_##TYPE
#define ARRAY_NEW_NUM \
INT_temp = IMMEDIATE_u1; \
- { const char *str; \
- switch (INT_temp) { \
- case 4: str = "boolean"; break; \
- case 5: str = "char"; break; \
- case 6: str = "float"; break; \
- case 7: str = "double"; break; \
- case 8: str = "byte"; break; \
- case 9: str = "short"; break; \
- case 10: str = "int"; break; \
- case 11: str = "long"; break; \
- default: str = "<unknown type code %d>"; break; \
- } \
- fputc (' ', out); fprintf (out, str, INT_temp); }
+ { switch (INT_temp) { \
+ case 4: fputs (" boolean", out); break; \
+ case 5: fputs (" char", out); break; \
+ case 6: fputs (" float", out); break; \
+ case 7: fputs (" double", out); break; \
+ case 8: fputs (" byte", out); break; \
+ case 9: fputs (" short", out); break; \
+ case 10: fputs (" int", out); break; \
+ case 11: fputs (" long", out); break; \
+ default: fprintf (out, " <unknown type code %ld>", (long)INT_temp); break;\
+ } }
#define ARRAY_NEW_PTR \
fputc (' ', out); print_constant_ref (out, jcf, IMMEDIATE_u2);
if (package_name)
fprintf (out, "%s.%s ", package_name, current_class);
else
- fprintf (out, current_class);
+ fprintf (out, "%s", current_class);
previous_output = 1;
}
}
if (package_name)
fprintf (out, "%s.%s ", package_name, current_class);
else
- fprintf (out, current_class);
+ fprintf (out, "%s", current_class);
previous_output = 1;
}
}
/* Prevent warning if -Wstrict-prototypes. */
#ifdef __GNUC__
-#ifndef YYPARSE_PARAM
int yyparse (void);
#endif
-#endif
\f
#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
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;
}
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;
}
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;
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;
}
"numeric type", operator_string ((NODE)), lang_printable_name ((TYPE), 0))
#define ERROR_CAST_NEEDED_TO_INTEGRAL(OPERATOR, NODE, TYPE) \
- parse_error_context \
- ((OPERATOR), (JPRIMITIVE_TYPE_P (TYPE) ? \
- "Incompatible type for `%s'. Explicit cast needed to convert " \
- "`%s' to integral" : "Incompatible type for `%s'. Can't convert " \
- "`%s' to integral"), operator_string ((NODE)), \
- lang_printable_name ((TYPE), 0))
+do { \
+ tree _operator = (OPERATOR), _node = (NODE), _type = (TYPE); \
+ if (JPRIMITIVE_TYPE_P (_type)) \
+ parse_error_context (_operator, "Incompatible type for `%s'. Explicit" \
+ " cast needed to convert `%s' to integral", \
+ operator_string(_node), \
+ lang_printable_name (_type, 0)); \
+ else \
+ parse_error_context (_operator, "Incompatible type for `%s'. Can't" \
+ " convert `%s' to integral", \
+ operator_string(_node), \
+ lang_printable_name (_type, 0)); \
+} while (0)
#define ERROR_VARIABLE_NOT_INITIALIZED(WFL, V) \
parse_error_context \
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;
}
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;
}
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;
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;
}
char buf[12];
tree elsig = build_java_signature (element_type);
tree el_name = element_type;
- sprintf (buf, length >= 0 ? "[%d" : "[", length);
+ buf[0] = '[';
+ if (length >= 0)
+ sprintf (buf+1, HOST_WIDE_INT_PRINT_DEC, length);
+ else
+ buf[1] = '\0';
sig = ident_subst (IDENTIFIER_POINTER (elsig), IDENTIFIER_LENGTH (elsig),
buf, 0, 0, "");
t = IDENTIFIER_SIGNATURE_TYPE (sig);
goto verify_error;
verify_error:
error ("verification error at PC=%d", oldpc);
- error (message);
+ error ("%s", message);
return 0;
}