This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PATCH for java warnings (ANSI string concat)
- To: egcs-patches at egcs dot cygnus dot com
- Subject: PATCH for java warnings (ANSI string concat)
- From: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- Date: Sat, 11 Dec 1999 11:29:54 -0500 (EST)
- Cc: apbianco at cygnus dot com
This gets rid of all but five of the ANSI string concat warnings
recently added to -Wtraditional. Okay to install?
--Kaveh
1999-12-11 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* parse.h (ABSTRACT_CHECK, JCONSTRUCTOR_CHECK,
ERROR_CANT_CONVERT_TO_BOOLEAN, ERROR_CANT_CONVERT_TO_NUMERIC,
ERROR_CAST_NEEDED_TO_INTEGRAL): Avoid the use of ANSI string
concatenation.
* parse.y (synchronized, variable_redefinition_error,
check_class_interface_creation, create_interface, create_class,
method_header, finish_method_declaration,
check_modifiers_consistency, method_declarator,
complete_class_report_errors, check_abstract_method_definitions,
java_check_regular_methods, check_throws_clauses,
java_check_abstract_methods, read_import_dir,
check_pkg_class_access, declare_local_variables, fix_constructors,
cut_identifier_in_qualified, resolve_expression_name,
resolve_qualified_expression_name, patch_method_invocation,
java_complete_lhs, patch_assignment, try_builtin_assignconv,
patch_binop, patch_array_ref, patch_newarray, build_labeled_block,
patch_exit_expr, patch_exit_expr, patch_switch_statement,
patch_try_statement, patch_synchronized_statement,
patch_throw_statement, check_thrown_exceptions,
patch_conditional_expr): Likewise.
diff -rup test/egcs-CVS19991210/gcc/java/parse.h egcs-CVS19991210/gcc/java/parse.h
--- test/egcs-CVS19991210/gcc/java/parse.h Fri Dec 10 15:58:16 1999
+++ egcs-CVS19991210/gcc/java/parse.h Sat Dec 11 10:51:12 1999
@@ -101,7 +101,7 @@ extern tree stabilize_reference PROTO ((
#define ABSTRACT_CHECK(FLAG, V, CL, S) \
if ((FLAG) & (V)) \
- parse_error_context ((CL), S " method can't be abstract");
+ parse_error_context ((CL), "%s method can't be abstract", (S));
#define JCONSTRUCTOR_CHECK(FLAG, V, CL, S) \
if ((FLAG) & (V)) \
@@ -142,8 +142,7 @@ extern tree stabilize_reference PROTO ((
{ \
if (flag_redundant && (cl) && ((flags) & (modifier))) \
parse_warning_context (cl, \
- "Discouraged redundant use of `%s' modifier " \
- "in declaration of " format, \
+ "Discouraged redundant use of `%s' modifier in declaration of " format, \
java_accstring_lookup (modifier), arg); \
}
@@ -212,26 +211,26 @@ extern tree stabilize_reference PROTO ((
/* Standard error messages */
#define ERROR_CANT_CONVERT_TO_BOOLEAN(OPERATOR, NODE, TYPE) \
- parse_error_context \
- ((OPERATOR), "Incompatible type for `%s'. Can't convert `%s' to " \
- "boolean", operator_string ((NODE)), lang_printable_name ((TYPE),0))
+ parse_error_context ((OPERATOR), \
+ "Incompatible type for `%s'. Can't convert `%s' to boolean", \
+ operator_string ((NODE)), lang_printable_name ((TYPE),0))
#define ERROR_CANT_CONVERT_TO_NUMERIC(OPERATOR, NODE, TYPE) \
- parse_error_context \
- ((OPERATOR), "Incompatible type for `%s'. Can't convert `%s' to " \
- "numeric type", operator_string ((NODE)), lang_printable_name ((TYPE), 0))
+ parse_error_context ((OPERATOR), \
+ "Incompatible type for `%s'. Can't convert `%s' to numeric type", \
+ operator_string ((NODE)), lang_printable_name ((TYPE), 0))
#define ERROR_CAST_NEEDED_TO_INTEGRAL(OPERATOR, NODE, TYPE) \
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", \
+ 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", \
+ parse_error_context (_operator, \
+ "Incompatible type for `%s'. Can't convert `%s' to integral", \
operator_string(_node), \
lang_printable_name (_type, 0)); \
} while (0)
diff -rup test/egcs-CVS19991210/gcc/java/parse.y egcs-CVS19991210/gcc/java/parse.y
--- test/egcs-CVS19991210/gcc/java/parse.y Mon Dec 6 15:36:07 1999
+++ egcs-CVS19991210/gcc/java/parse.y Sat Dec 11 10:52:40 1999
@@ -1674,8 +1674,8 @@ synchronized_statement:
synchronized:
modifiers
{
- check_modifiers ("Illegal modifier `%s'. Only "
- "`synchronized' was expected here",
+ check_modifiers (
+ "Illegal modifier `%s'. Only `synchronized' was expected here",
$1, ACC_SYNCHRONIZED);
if ($1 != ACC_SYNCHRONIZED)
MODIFIER_WFL (SYNCHRONIZED_TK) =
@@ -2745,8 +2745,7 @@ variable_redefinition_error (context, na
type_name = lang_printable_name (type, 0);
parse_error_context (context,
- "Variable `%s' is already defined in this method and "
- "was declared `%s %s' at line %d",
+ "Variable `%s' is already defined in this method and was declared `%s %s' at line %d",
IDENTIFIER_POINTER (name),
type_name, IDENTIFIER_POINTER (name), line);
}
@@ -2907,8 +2906,8 @@ check_class_interface_creation (is_inter
if (strncmp (IDENTIFIER_POINTER (raw_name),
f , IDENTIFIER_LENGTH (raw_name)) ||
f [IDENTIFIER_LENGTH (raw_name)] != '.')
- parse_error_context (cl, "Public %s `%s' must be defined in a file "
- "called `%s.java'",
+ parse_error_context
+ (cl, "Public %s `%s' must be defined in a file called `%s.java'",
(is_interface ? "interface" : "class"),
IDENTIFIER_POINTER (qualified_name),
IDENTIFIER_POINTER (raw_name));
@@ -3012,8 +3011,7 @@ create_interface (flags, id, super)
if ((flags & ACC_ABSTRACT) && flag_redundant)
parse_warning_context
(MODIFIER_WFL (ABSTRACT_TK),
- "Redundant use of `abstract' modifier. Interface `%s' is implicitely "
- "abstract", IDENTIFIER_POINTER (raw_name));
+ "Redundant use of `abstract' modifier. Interface `%s' is implicitely abstract", IDENTIFIER_POINTER (raw_name));
/* Create a new decl if DECL is NULL, otherwise fix it */
decl = maybe_create_class_interface_decl (decl, q_name, id);
@@ -3054,8 +3052,9 @@ create_class (flags, id, super, interfac
- abstract AND final forbidden
- Public classes defined in the correct file */
if ((flags & ACC_ABSTRACT) && (flags & ACC_FINAL))
- parse_error_context (id, "Class `%s' can't be declared both abstract "
- "and final", IDENTIFIER_POINTER (raw_name));
+ parse_error_context
+ (id, "Class `%s' can't be declared both abstract and final",
+ IDENTIFIER_POINTER (raw_name));
/* Create a new decl if DECL is NULL, otherwise fix it */
decl = maybe_create_class_interface_decl (decl, class_id, id);
@@ -3387,8 +3386,7 @@ method_header (flags, type, mdecl, throw
if (!CLASS_ABSTRACT (TYPE_NAME (this_class))
&& !CLASS_INTERFACE (TYPE_NAME (this_class)))
parse_error_context
- (id, "Class `%s' must be declared abstract to define abstract "
- "method `%s'",
+ (id, "Class `%s' must be declared abstract to define abstract method `%s'",
IDENTIFIER_POINTER (DECL_NAME (ctxp->current_parsed_class)),
IDENTIFIER_POINTER (EXPR_WFL_NODE (id)));
}
@@ -3590,10 +3588,10 @@ finish_method_declaration (method_body)
else if (!(flags & ACC_ABSTRACT) && !(flags & ACC_NATIVE) && !method_body)
{
tree wfl = DECL_NAME (current_function_decl);
- parse_error_context (wfl,
- "Non native and non abstract method `%s' must "
- "have a body defined",
- IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl)));
+ parse_error_context
+ (wfl,
+ "Non native and non abstract method `%s' must have a body defined",
+ IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl)));
method_body = NULL_TREE;
}
@@ -3689,8 +3687,7 @@ check_modifiers_consistency (flags)
THIS_MODIFIER_ONLY (flags, ACC_PROTECTED, 2, acc_count, cl);
if (acc_count > 1)
parse_error_context
- (cl, "Inconsistent member declaration. At most one of `public', "
- "`private', or `protected' may be specified");
+ (cl, "Inconsistent member declaration. At most one of `public', `private', or `protected' may be specified");
}
/* Check the methode header METH for abstract specifics features */
@@ -3758,9 +3755,9 @@ method_declarator (id, list)
for (already = arg_types; already; already = TREE_CHAIN (already))
if (TREE_PURPOSE (already) == name)
{
- parse_error_context
- (wfl_name, "Variable `%s' is used more than once in the "
- "argument list of method `%s'", IDENTIFIER_POINTER (name),
+ parse_error_context
+ (wfl_name, "Variable `%s' is used more than once in the argument list of method `%s'",
+ IDENTIFIER_POINTER (name),
IDENTIFIER_POINTER (EXPR_WFL_NODE (id)));
break;
}
@@ -4455,16 +4452,14 @@ complete_class_report_errors (dep)
break;
case JDEP_METHOD: /* Covers arguments */
parse_error_context
- (JDEP_WFL (dep), "Type `%s' not found in the declaration of the "
- "argument `%s' of method `%s'",
+ (JDEP_WFL (dep), "Type `%s' not found in the declaration of the argument `%s' of method `%s'",
purify_type_name (name),
IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_DECL_WFL (dep))),
IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_MISC (dep))));
break;
case JDEP_METHOD_RETURN: /* Covers return type */
parse_error_context
- (JDEP_WFL (dep), "Type `%s' not found in the declaration of the "
- "return type of method `%s'",
+ (JDEP_WFL (dep), "Type `%s' not found in the declaration of the return type of method `%s'",
purify_type_name (name),
IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_DECL_WFL (dep))));
break;
@@ -4477,8 +4472,7 @@ complete_class_report_errors (dep)
break;
case JDEP_VARIABLE:
parse_error_context
- (JDEP_WFL (dep), "Type `%s' not found in the declaration of the "
- "local variable `%s'",
+ (JDEP_WFL (dep), "Type `%s' not found in the declaration of the local variable `%s'",
purify_type_name (IDENTIFIER_POINTER
(EXPR_WFL_NODE (JDEP_WFL (dep)))),
IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep))));
@@ -4672,9 +4666,7 @@ check_abstract_method_definitions (do_in
parse_error_context
(lookup_cl (class_decl),
- "Class `%s' doesn't define the abstract method `%s %s' from "
- "%s `%s'. This method must be defined or %s `%s' must be "
- "declared abstract",
+ "Class `%s' doesn't define the abstract method `%s %s' from %s `%s'. This method must be defined or %s `%s' must be declared abstract",
IDENTIFIER_POINTER (DECL_NAME (class_decl)),
t, lang_printable_name (method, 0),
(CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (method))) ?
@@ -4782,8 +4774,7 @@ java_check_regular_methods (class_decl)
{
if (!inherits_from_p (TREE_VALUE (mthrows), throwable_type_node))
parse_error_context
- (TREE_PURPOSE (mthrows), "Class `%s' in `throws' clause must be "
- "a subclass of class `java.lang.Throwable'",
+ (TREE_PURPOSE (mthrows), "Class `%s' in `throws' clause must be a subclass of class `java.lang.Throwable'",
IDENTIFIER_POINTER
(DECL_NAME (TYPE_NAME (TREE_VALUE (mthrows)))));
}
@@ -4832,9 +4823,7 @@ java_check_regular_methods (class_decl)
&& flag_not_overriding)
{
parse_warning_context
- (method_wfl, "Method `%s' in class `%s' does not "
- "override the corresponding method in class `%s', which is "
- "private to a different package",
+ (method_wfl, "Method `%s' in class `%s' does not override the corresponding method in class `%s', which is private to a different package",
lang_printable_name (found, 0),
IDENTIFIER_POINTER (DECL_NAME (class_decl)),
IDENTIFIER_POINTER (DECL_NAME
@@ -4864,8 +4853,7 @@ java_check_regular_methods (class_decl)
{
parse_error_context
(method_wfl,
- "Instance methods can't be overriden by a static method. Method "
- "`%s' is an instance method in class `%s'",
+ "Instance methods can't be overriden by a static method. Method `%s' is an instance method in class `%s'",
lang_printable_name (found, 0),
IDENTIFIER_POINTER
(DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
@@ -4885,8 +4873,7 @@ java_check_regular_methods (class_decl)
{
parse_error_context
(method_wfl,
- "Methods can't be overridden to be more private. Method `%s' is "
- "not %s in class `%s'", lang_printable_name (method, 0),
+ "Methods can't be overridden to be more private. Method `%s' is not %s in class `%s'", lang_printable_name (method, 0),
(METHOD_PUBLIC (method) ? "public" :
(METHOD_PRIVATE (method) ? "private" : "protected")),
IDENTIFIER_POINTER (DECL_NAME
@@ -4963,9 +4950,7 @@ check_throws_clauses (method, method_wfl
if (!fthrows)
{
parse_error_context
- (method_wfl, "Invalid checked exception class `%s' in "
- "`throws' clause. The exception must be a subclass of an "
- "exception thrown by `%s' from class `%s'",
+ (method_wfl, "Invalid checked exception class `%s' in `throws' clause. The exception must be a subclass of an exception thrown by `%s' from class `%s'",
IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (TREE_VALUE (mthrows)))),
lang_printable_name (found, 0),
IDENTIFIER_POINTER
@@ -5037,9 +5022,7 @@ java_check_abstract_methods (interface_d
reset_method_name (found);
parse_error_context
(lookup_cl (sub_interface_method),
- "Interface `%s' inherits method `%s' from interface `%s'. "
- "This method is redefined with a different return type in "
- "interface `%s'",
+ "Interface `%s' inherits method `%s' from interface `%s'. This method is redefined with a different return type in interface `%s'",
IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (interface))),
lang_printable_name (found, 0),
IDENTIFIER_POINTER
@@ -5343,9 +5326,7 @@ read_import_dir (wfl)
static int first = 1;
if (first)
{
- error ("Can't find default package `%s'. Check "
- "the CLASSPATH environment variable and the access to the "
- "archives.", package_name);
+ 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;
}
@@ -5548,8 +5529,7 @@ check_pkg_class_access (class_name, cl)
return 0;
parse_error_context
- (cl, "Can't access %s `%s'. Only public classes and interfaces in "
- "other packages can be accessed",
+ (cl, "Can't access %s `%s'. Only public classes and interfaces in other packages can be accessed",
(CLASS_INTERFACE (TYPE_NAME (type)) ? "interface" : "class"),
IDENTIFIER_POINTER (class_name));
return 1;
@@ -5586,8 +5566,7 @@ declare_local_variables (modifier, type,
{
if (flag_static_local_jdk1_1)
parse_warning_context (ctxp->modifier_ctx [i],
- "Unsupported JDK1.1 `final' local variable "
- "(treated as non final)");
+ "Unsupported JDK1.1 `final' local variable (treated as non final)");
}
else
{
@@ -6187,9 +6166,9 @@ fix_constructors (mdecl)
{
tree sclass_decl = TYPE_NAME (CLASSTYPE_SUPER (current_class));
const char *n = IDENTIFIER_POINTER (DECL_NAME (sclass_decl));
- parse_error_context (lookup_cl (TYPE_NAME (current_class)),
- "No constructor matching `%s()' found in "
- "class `%s'", n, n);
+ parse_error_context
+ (lookup_cl (TYPE_NAME (current_class)),
+ "No constructor matching `%s()' found in class `%s'", n, n);
}
start_artificial_method_body (mdecl);
@@ -6410,8 +6389,7 @@ cut_identifier_in_qualified (wfl)
if (!TREE_CHAIN (q))
{
if (!previous)
- fatal ("Operating on a non qualified qualified WFL - "
- "cut_identifier_in_qualified");
+ fatal ("Operating on a non qualified qualified WFL - cut_identifier_in_qualified");
TREE_CHAIN (previous) = NULL_TREE;
return TREE_PURPOSE (q);
}
@@ -6455,8 +6433,7 @@ resolve_expression_name (id, orig)
if (!fs && ctxp->explicit_constructor_p)
{
parse_error_context
- (id, "Can't reference `%s' before the superclass "
- "constructor has been called", IDENTIFIER_POINTER (name));
+ (id, "Can't reference `%s' before the superclass constructor has been called", IDENTIFIER_POINTER (name));
return error_mark_node;
}
@@ -6746,8 +6723,7 @@ resolve_qualified_expression_name (wfl,
}
if (ctxp->explicit_constructor_p)
{
- parse_error_context (wfl, "Can't reference `this' before the "
- "superclass constructor has been called");
+ parse_error_context (wfl, "Can't reference `this' before the superclass constructor has been called");
return 1;
}
/* We have to generate code for intermediate acess */
@@ -7163,9 +7139,10 @@ patch_method_invocation (patch, primary,
{
tree remainder;
breakdown_qualified (&remainder, NULL, EXPR_WFL_NODE (wfl));
- parse_error_context (wfl, "Can't search method `%s' in package "
- "`%s'",IDENTIFIER_POINTER (identifier),
- IDENTIFIER_POINTER (remainder));
+ parse_error_context
+ (wfl, "Can't search method `%s' in package `%s'",
+ IDENTIFIER_POINTER (identifier),
+ IDENTIFIER_POINTER (remainder));
PATCH_METHOD_RETURN_ERROR ();
}
RESOLVE_PACKAGE_NAME_P (wfl) = 0;
@@ -7193,8 +7170,9 @@ patch_method_invocation (patch, primary,
if (CLASS_INTERFACE (decl))
{
parse_error_context
- (identifier_wfl, "Can't make static reference to method "
- "`%s' in interface `%s'", IDENTIFIER_POINTER (identifier),
+ (identifier_wfl,
+ "Can't make static reference to method `%s' in interface `%s'",
+ IDENTIFIER_POINTER (identifier),
IDENTIFIER_POINTER (name));
PATCH_METHOD_RETURN_ERROR ();
}
@@ -7272,8 +7250,7 @@ patch_method_invocation (patch, primary,
DECL_NAME (TYPE_NAME (CLASSTYPE_SUPER (current_class)));
else
{
- parse_error_context (wfl, "Can't invoke super constructor "
- "on java.lang.Object");
+ parse_error_context (wfl, "Can't invoke super constructor on java.lang.Object");
PATCH_METHOD_RETURN_ERROR ();
}
}
@@ -7298,8 +7275,8 @@ patch_method_invocation (patch, primary,
&& TREE_CODE (patch) == NEW_CLASS_EXPR)
{
parse_error_context
- (wfl, "Class `%s' is an abstract class. It can't be "
- "instantiated", IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl)));
+ (wfl, "Class `%s' is an abstract class. It can't be instantiated",
+ IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl)));
PATCH_METHOD_RETURN_ERROR ();
}
class_to_search = TREE_TYPE (class_to_search);
@@ -7375,9 +7352,7 @@ patch_method_invocation (patch, primary,
&& (!primary || primary == current_this)
&& (TREE_CODE (patch) != NEW_CLASS_EXPR))
{
- parse_error_context
- (wfl, "Can't reference `this' before the superclass constructor has "
- "been called");
+ parse_error_context (wfl, "Can't reference `this' before the superclass constructor has been called");
PATCH_METHOD_RETURN_ERROR ();
}
java_parser_context_restore_global ();
@@ -8719,8 +8694,8 @@ java_complete_lhs (node)
if (!current_this)
{
EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
- parse_error_context (wfl_operator, "Keyword `this' used outside "
- "allowed context");
+ parse_error_context (wfl_operator,
+ "Keyword `this' used outside allowed context");
TREE_TYPE (node) = error_mark_node;
return error_mark_node;
}
@@ -8728,8 +8703,7 @@ java_complete_lhs (node)
{
EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
parse_error_context
- (wfl_operator, "Can't reference `this' or `super' before the "
- "superclass constructor has been called");
+ (wfl_operator, "Can't reference `this' or `super' before the superclass constructor has been called");
TREE_TYPE (node) = error_mark_node;
return error_mark_node;
}
@@ -9171,12 +9145,11 @@ patch_assignment (node, wfl_op1, wfl_op2
}
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);
+ 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'",
+ 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;
@@ -9313,8 +9286,7 @@ try_builtin_assignconv (wfl_op1, lhs_typ
new_rhs = convert (lhs_type, rhs);
else if (wfl_op1) /* Might be called with a NULL */
parse_warning_context
- (wfl_op1, "Constant expression `%s' to wide for narrowing "
- "primitive conversion to `%s'",
+ (wfl_op1, "Constant expression `%s' to wide for narrowing primitive conversion to `%s'",
print_int_node (rhs), lang_printable_name (lhs_type, 0));
/* Reported a warning that will turn into an error further
down, so we don't return */
@@ -9783,15 +9755,12 @@ patch_binop (node, wfl_op1, wfl_op2)
{
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",
+ "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",
+ 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));
}
@@ -9999,8 +9968,9 @@ patch_binop (node, wfl_op1, wfl_op2)
char *t1;
t1 = xstrdup (lang_printable_name (op1_type, 0));
parse_error_context
- (wfl_operator, "Incompatible type for `%s'. Can't convert `%s' "
- "to `%s'", operator_string (node), t1,
+ (wfl_operator,
+ "Incompatible type for `%s'. Can't convert `%s' to `%s'",
+ operator_string (node), t1,
lang_printable_name (op2_type, 0));
free (t1);
TREE_TYPE (node) = boolean_type_node;
@@ -10644,8 +10614,9 @@ patch_array_ref (node)
if (!TYPE_ARRAY_P (array_type))
{
parse_error_context
- (wfl_operator, "`[]' can only be applied to arrays. It can't be "
- "applied to `%s'", lang_printable_name (array_type, 0));
+ (wfl_operator,
+ "`[]' can only be applied to arrays. It can't be applied to `%s'",
+ lang_printable_name (array_type, 0));
TREE_TYPE (node) = error_mark_node;
error_found = 1;
}
@@ -10656,12 +10627,12 @@ patch_array_ref (node)
if (TREE_TYPE (index) != int_type_node)
{
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'",
+ 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'",
+ 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;
@@ -10745,8 +10716,7 @@ patch_newarray (node)
{
parse_error_context
(TREE_PURPOSE (cdim),
- "Incompatible type for dimension in array creation expression. "
- "%s convert `%s' to `int'",
+ "Incompatible type for dimension in array creation expression. %s convert `%s' to `int'",
(valid_cast_to_p (TREE_TYPE (dim), int_type_node) ?
"Explicit cast needed to" : "Can't"),
lang_printable_name (TREE_TYPE (dim), 0));
@@ -11137,13 +11107,13 @@ build_labeled_block (location, label)
if (IDENTIFIER_LOCAL_VALUE (label_name))
{
EXPR_WFL_LINECOL (wfl_operator) = location;
- parse_error_context (wfl_operator, "Declaration of `%s' shadows "
- "a previous label declaration",
+ parse_error_context (wfl_operator,
+ "Declaration of `%s' shadows a previous label declaration",
IDENTIFIER_POINTER (label));
EXPR_WFL_LINECOL (wfl_operator) =
EXPR_WFL_LINECOL (IDENTIFIER_LOCAL_VALUE (label_name));
- parse_error_context (wfl_operator, "This is the location of the "
- "previous declaration of label `%s'",
+ parse_error_context (wfl_operator,
+ "This is the location of the previous declaration of label `%s'",
IDENTIFIER_POINTER (label));
java_error_count--;
}
@@ -11464,8 +11434,7 @@ patch_exit_expr (node)
{
parse_error_context
(wfl_operator,
- "Incompatible type for loop conditional. Can't convert `%s' to "
- "`boolean'",
+ "Incompatible type for loop conditional. Can't convert `%s' to `boolean'",
lang_printable_name (TREE_TYPE (expression), 0));
return error_mark_node;
}
@@ -11502,8 +11471,8 @@ patch_switch_statement (node)
if (!JINTEGRAL_TYPE_P (se_type))
{
EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
- parse_error_context (wfl_operator, "Incompatible type for `switch'. "
- "Can't convert `%s' to `int'",
+ parse_error_context (wfl_operator,
+ "Incompatible type for `switch'. Can't convert `%s' to `int'",
lang_printable_name (se_type, 0));
/* This is what java_complete_tree will check */
TREE_OPERAND (node, 0) = error_mark_node;
@@ -11591,9 +11560,7 @@ patch_try_statement (node)
{
EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (current);
parse_error_context (wfl_operator,
- "Can't catch class `%s'. Catch clause "
- "parameter type must be a subclass of "
- "class `java.lang.Throwable'",
+ "Can't catch class `%s'. Catch clause parameter type must be a subclass of class `java.lang.Throwable'",
lang_printable_name (carg_type, 0));
error_found = 1;
continue;
@@ -11616,8 +11583,9 @@ patch_try_statement (node)
{
EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (current);
parse_error_context
- (wfl_operator, "`catch' not reached because of the catch "
- "clause at line %d", EXPR_WFL_LINENO (sub_current));
+ (wfl_operator,
+ "`catch' not reached because of the catch clause at line %d",
+ EXPR_WFL_LINENO (sub_current));
unreachable = error_found = 1;
break;
}
@@ -11680,8 +11648,7 @@ patch_synchronized_statement (node, wfl_
if (!JREFERENCE_TYPE_P (TREE_TYPE (expr)))
{
SET_WFL_OPERATOR (wfl_operator, node, wfl_op1);
- parse_error_context (wfl_operator, "Incompatible type for `synchronized'"
- ". Can't convert `%s' to `java.lang.Object'",
+ parse_error_context (wfl_operator, "Incompatible type for `synchronized'. Can't convert `%s' to `java.lang.Object'",
lang_printable_name (TREE_TYPE (expr), 0));
return error_mark_node;
}
@@ -11744,8 +11711,8 @@ patch_throw_statement (node, wfl_op1)
if (!try_reference_assignconv (throwable_type_node, expr))
{
SET_WFL_OPERATOR (wfl_operator, node, wfl_op1);
- parse_error_context (wfl_operator, "Can't throw `%s'; it must be a "
- "subclass of class `java.lang.Throwable'",
+ parse_error_context (wfl_operator,
+ "Can't throw `%s'; it must be a subclass of class `java.lang.Throwable'",
lang_printable_name (type, 0));
/* If the thrown expression was a reference, we further the
compile-time check. */
@@ -11775,9 +11742,7 @@ patch_throw_statement (node, wfl_op1)
only if there is something after the list of checked
exception thrown by the current function (if any). */
if (IN_TRY_BLOCK_P ())
- parse_error_context (wfl_operator, "Checked exception `%s' can't be "
- "caught by any of the catch clause(s) "
- "of the surrounding `try' block",
+ parse_error_context (wfl_operator, "Checked exception `%s' can't be caught by any of the catch clause(s) of the surrounding `try' block",
lang_printable_name (type, 0));
/* If we have no surrounding try statement and the method doesn't have
any throws, report it now. FIXME */
@@ -11789,20 +11754,18 @@ patch_throw_statement (node, wfl_op1)
&& !tryblock_throws_ok)
{
if (IS_CLINIT (current_function_decl))
- parse_error_context (wfl_operator, "Checked exception `%s' can't "
- "be thrown in initializer",
+ parse_error_context (wfl_operator,
+ "Checked exception `%s' can't be thrown in initializer",
lang_printable_name (type, 0));
else
- parse_error_context (wfl_operator, "Checked exception `%s' isn't "
- "thrown from a `try' block",
+ parse_error_context (wfl_operator,
+ "Checked exception `%s' isn't thrown from a `try' block",
lang_printable_name (type, 0));
}
/* Otherwise, the current method doesn't have the appropriate
throws declaration */
else
- parse_error_context (wfl_operator, "Checked exception `%s' doesn't "
- "match any of current method's `throws' "
- "declaration(s)",
+ parse_error_context (wfl_operator, "Checked exception `%s' doesn't match any of current method's `throws' declaration(s)",
lang_printable_name (type, 0));
return error_mark_node;
}
@@ -11843,8 +11806,7 @@ check_thrown_exceptions (location, decl)
else
{
parse_error_context
- (wfl_operator, "Exception `%s' must be caught, or it must be "
- "declared in the `throws' clause of `%s'",
+ (wfl_operator, "Exception `%s' must be caught, or it must be declared in the `throws' clause of `%s'",
lang_printable_name (TREE_VALUE (throws), 0),
(DECL_NAME (current_function_decl) == init_identifier_node ?
IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class))) :
@@ -11926,8 +11888,8 @@ patch_conditional_expr (node, wfl_cond,
if (TREE_TYPE (cond) != boolean_type_node)
{
SET_WFL_OPERATOR (wfl_operator, node, wfl_cond);
- parse_error_context (wfl_operator, "Incompatible type for `?:'. Can't "
- "convert `%s' to `boolean'",
+ parse_error_context (wfl_operator,
+ "Incompatible type for `?:'. Can't convert `%s' to `boolean'",
lang_printable_name (TREE_TYPE (cond), 0));
error_found = 1;
}
@@ -11994,9 +11956,9 @@ patch_conditional_expr (node, wfl_cond,
{
char *t = xstrdup (lang_printable_name (t1, 0));
SET_WFL_OPERATOR (wfl_operator, node, wfl_op1);
- parse_error_context (wfl_operator, "Incompatible type for `?:'. Can't "
- "convert `%s' to `%s'", t,
- lang_printable_name (t2, 0));
+ parse_error_context (wfl_operator,
+ "Incompatible type for `?:'. Can't convert `%s' to `%s'",
+ t, lang_printable_name (t2, 0));
free (t);
error_found = 1;
}