+1999-12-30 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * class.c (assume_compiled, assume_compiled_node): Add static
+ prototype.
+ (add_assume_compiled): Use xmalloc/xstrdup, not malloc/strdup.
+
+ * jcf-dump.c (ARRAY_NEW_NUM): Cast long to int in switch.
+
+ * jvgenmain.c (usage): Add static prototype with ATTRIBUTE_NORETURN.
+
+ * parse.h (OBSOLETE_MODIFIER_WARNING): Rename parameter `modifier'
+ to `__modifier' to avoid stringifying it.
+
+ * parse.y (verify_constructor_circularity): Don't call a variadic
+ function with a non-literal format string.
+ (java_check_abstract_methods): Move unreachable code inside
+ `continue' statement.
+ (lookup_method_invoke): Call xstrdup, not strdup.
+
+ * expr.c (expand_java_field_op): Avoid the use of ANSI string
+ concatenation.
+
+ * jcf-parse.c (yyparse): Likewise.
+
+ * jv-scan.c (main): Likewise.
+
1999-12-30 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* parse.h (ABSTRACT_CHECK, JCONSTRUCTOR_CHECK,
static tree mangle_static_field PROTO ((tree));
static void add_interface_do PROTO ((tree, tree, int));
static tree maybe_layout_super_class PROTO ((tree, tree));
+static int assume_compiled PROTO ((const char *));
static rtx registerClass_libfunc;
struct assume_compiled_node_struct *child;
} assume_compiled_node;
+static assume_compiled_node *find_assume_compiled_node
+ PROTO ((assume_compiled_node *, const char *));
+
/* This is the root of the include/exclude tree. */
static assume_compiled_node *assume_compiled_tree;
is IDENT. Start the search from NODE. Return NULL if an
appropriate node does not exist. */
-assume_compiled_node *
+static assume_compiled_node *
find_assume_compiled_node (node, ident)
assume_compiled_node *node;
const char *ident;
{
assume_compiled_node *parent;
assume_compiled_node *node =
- (assume_compiled_node *) malloc (sizeof (assume_compiled_node));
+ (assume_compiled_node *) xmalloc (sizeof (assume_compiled_node));
- node->ident = strdup (ident);
+ node->ident = xstrdup (ident);
node->excludep = excludep;
node->child = NULL;
if (NULL == assume_compiled_tree)
{
assume_compiled_tree =
- (assume_compiled_node *) malloc (sizeof (assume_compiled_node));
+ (assume_compiled_node *) xmalloc (sizeof (assume_compiled_node));
assume_compiled_tree->ident = "";
assume_compiled_tree->excludep = 0;
assume_compiled_tree->sibling = NULL;
/* Returns non-zero if IDENT is the name of a class that the compiler
should assume has been compiled to FIXME */
-int
+static int
assume_compiled (ident)
const char *ident;
{
tree cfndecl_name = DECL_NAME (current_function_decl);
if (! DECL_CONSTRUCTOR_P (current_function_decl)
&& (cfndecl_name != finit_identifier_node))
- error_with_decl (field_decl, "assignment to final field `%s' "
- "not in constructor");
+ error_with_decl (field_decl, "assignment to final field `%s' not in constructor");
}
}
expand_assignment (field_ref, new_value, 0, 0);
#define ARRAY_NEW(TYPE) ARRAY_NEW_##TYPE
#define ARRAY_NEW_NUM \
INT_temp = IMMEDIATE_u1; \
- { switch (INT_temp) { \
+ { switch ((int) INT_temp) { \
case 4: fputs (" boolean", out); break; \
case 5: fputs (" char", out); break; \
case 6: fputs (" float", out); break; \
{
char *saved_input_filename = input_filename;
input_filename = value;
- warning ("source file seen twice on command line and will be "
- "compiled only once.");
+ warning ("source file seen twice on command line and will be compiled only once.");
input_filename = saved_input_filename;
}
else
/* Check on bad usage */
if (flag_find_main && flag_dump_class)
- fatal ("Options `--print-main' and `--list-class' can't be turned on "
- "at the same time");
+ fatal ("Options `--print-main' and `--list-class' can't be turned on at the same time");
if (output_file && !(out = fopen (output_file, "w")))
fatal ("Can't open output file `%s'", output_file);
(void (*) PROTO((void *))) OBSTACK_CHUNK_FREE);
}
+static void usage (const char *) ATTRIBUTE_NORETURN;
+
static void
usage (const char *name)
{
for (liste = list; liste; liste = TREE_CHAIN (liste))
{
parse_error_context
- (TREE_PURPOSE (TREE_PURPOSE (liste)),
+ (TREE_PURPOSE (TREE_PURPOSE (liste)), "%s",
constructor_circularity_msg
(TREE_VALUE (liste), TREE_VALUE (TREE_PURPOSE (liste))));
java_error_count--;
IDENTIFIER_POINTER
(DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
free (t);
- continue;
-
DECL_NAME (found) = saved_found_wfl;
+ continue;
}
}
method = make_node (FUNCTION_TYPE);
TYPE_ARG_TYPES (method) = atl;
signature = build_java_argument_signature (method);
- dup = strdup (lang_printable_name (class, 0));
+ dup = xstrdup (lang_printable_name (class, 0));
parse_error_context (cl, "Can't find %s `%s(%s)' in type `%s'%s",
(lc ? "constructor" : "method"),
(lc ? dup : IDENTIFIER_POINTER (name)),
/* Pedantic warning on obsolete modifiers. Note: when cl is NULL,
flags was set artificially, such as for a interface method */
-#define OBSOLETE_MODIFIER_WARNING(cl, flags, modifier, format, arg) \
+#define OBSOLETE_MODIFIER_WARNING(cl, flags, __modifier, format, arg) \
{ \
- if (flag_redundant && (cl) && ((flags) & (modifier))) \
+ if (flag_redundant && (cl) && ((flags) & (__modifier))) \
parse_warning_context (cl, \
"Discouraged redundant use of `%s' modifier in declaration of " format, \
- java_accstring_lookup (modifier), arg); \
+ java_accstring_lookup (__modifier), arg); \
}
/* Quickly build a temporary pointer on hypothetical type NAME. */
for (liste = list; liste; liste = TREE_CHAIN (liste))
{
parse_error_context
- (TREE_PURPOSE (TREE_PURPOSE (liste)),
+ (TREE_PURPOSE (TREE_PURPOSE (liste)), "%s",
constructor_circularity_msg
(TREE_VALUE (liste), TREE_VALUE (TREE_PURPOSE (liste))));
java_error_count--;
IDENTIFIER_POINTER
(DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
free (t);
- continue;
-
DECL_NAME (found) = saved_found_wfl;
+ continue;
}
}
method = make_node (FUNCTION_TYPE);
TYPE_ARG_TYPES (method) = atl;
signature = build_java_argument_signature (method);
- dup = strdup (lang_printable_name (class, 0));
+ dup = xstrdup (lang_printable_name (class, 0));
parse_error_context (cl, "Can't find %s `%s(%s)' in type `%s'%s",
(lc ? "constructor" : "method"),
(lc ? dup : IDENTIFIER_POINTER (name)),